Bless tests.

This commit is contained in:
Camille GILLOT 2023-01-26 03:51:26 +00:00
parent 60e04d1e8c
commit 0e52a671d4
86 changed files with 644 additions and 1694 deletions

View File

@ -12,30 +12,43 @@ LL | let r = Rc::new(());
| - has type `Rc<()>` which is not `Send`
LL | bar().await
| ^^^^^^ await occurs here, with `r` maybe used later
LL | };
| - `r` is later dropped here
note: required by a bound in `is_send`
--> $DIR/async-await-let-else.rs:19:15
|
LL | fn is_send<T: Send>(_: T) {}
| ^^^^ required by this bound in `is_send`
error: future cannot be sent between threads safely
error[E0277]: `Rc<()>` cannot be sent between threads safely
--> $DIR/async-await-let-else.rs:50:13
|
LL | async fn foo2(x: Option<bool>) {
| - within this `impl Future<Output = ()>`
...
LL | is_send(foo2(Some(true)));
| ^^^^^^^^^^^^^^^^ future returned by `foo2` is not `Send`
| ------- ^^^^^^^^^^^^^^^^ `Rc<()>` cannot be sent between threads safely
| |
| required by a bound introduced by this call
|
= help: within `impl Future<Output = ()>`, the trait `Send` is not implemented for `Rc<()>`
note: future is not `Send` as this value is used across an await
--> $DIR/async-await-let-else.rs:23:26
note: required because it's used within this `async fn` body
--> $DIR/async-await-let-else.rs:27:29
|
LL | bar2(Rc::new(())).await
| ----------- ^^^^^^ await occurs here, with `Rc::new(())` maybe used later
| |
| has type `Rc<()>` which is not `Send`
LL | };
| - `Rc::new(())` is later dropped here
LL | async fn bar2<T>(_: T) -> ! {
| _____________________________^
LL | | panic!()
LL | | }
| |_^
= note: required because it captures the following types: `impl Future<Output = !>`
note: required because it's used within this `async fn` body
--> $DIR/async-await-let-else.rs:21:32
|
LL | async fn foo2(x: Option<bool>) {
| ________________________________^
LL | | let Some(_) = x else {
LL | | bar2(Rc::new(())).await
LL | | };
LL | | }
| |_^
note: required by a bound in `is_send`
--> $DIR/async-await-let-else.rs:19:15
|
@ -53,9 +66,8 @@ note: future is not `Send` as this value is used across an await
--> $DIR/async-await-let-else.rs:33:28
|
LL | (Rc::new(()), bar().await);
| ----------- ^^^^^^ - `Rc::new(())` is later dropped here
| | |
| | await occurs here, with `Rc::new(())` maybe used later
| ----------- ^^^^^^ await occurs here, with `Rc::new(())` maybe used later
| |
| has type `Rc<()>` which is not `Send`
note: required by a bound in `is_send`
--> $DIR/async-await-let-else.rs:19:15
@ -77,9 +89,6 @@ LL | let r = Rc::new(());
| - has type `Rc<()>` which is not `Send`
LL | bar().await;
| ^^^^^^ await occurs here, with `r` maybe used later
...
LL | };
| - `r` is later dropped here
note: required by a bound in `is_send`
--> $DIR/async-await-let-else.rs:19:15
|
@ -88,3 +97,4 @@ LL | fn is_send<T: Send>(_: T) {}
error: aborting due to 4 previous errors
For more information about this error, try `rustc --explain E0277`.

View File

@ -14,7 +14,7 @@ LL | let a;
| ^ cannot infer type
|
note: the type is part of the `async fn` body because of this `await`
--> $DIR/async-error-span.rs:17:17
--> $DIR/async-error-span.rs:19:17
|
LL | get_future().await;
| ^^^^^^

View File

@ -7,19 +7,18 @@ LL | fn get_future() -> impl Future<Output = ()> {
= help: the trait `Future` is not implemented for `()`
= note: () must be a future or must implement `IntoFuture` to be awaited
error[E0698]: type inside `async fn` body must be known in this context
error[E0282]: type annotations needed
--> $DIR/async-error-span.rs:16:9
|
LL | let a;
| ^ cannot infer type
| ^
|
note: the type is part of the `async fn` body because of this `await`
--> $DIR/async-error-span.rs:17:17
help: consider giving `a` an explicit type
|
LL | get_future().await;
| ^^^^^^
LL | let a: /* Type */;
| ++++++++++++
error: aborting due to 2 previous errors
Some errors have detailed explanations: E0277, E0698.
Some errors have detailed explanations: E0277, E0282.
For more information about an error, try `rustc --explain E0277`.

View File

@ -14,7 +14,7 @@ LL | let a;
| ^ cannot infer type
|
note: the type is part of the `async fn` body because of this `await`
--> $DIR/async-error-span.rs:17:17
--> $DIR/async-error-span.rs:19:17
|
LL | get_future().await;
| ^^^^^^

View File

@ -13,7 +13,9 @@ fn get_future() -> impl Future<Output = ()> {
}
async fn foo() {
let a; //~ ERROR type inside `async fn` body must be known in this context
let a;
//[no_drop_tracking,drop_tracking]~^ ERROR type inside `async fn` body must be known in this context
//[drop_tracking_mir]~^^ ERROR type annotations needed
get_future().await;
}

View File

@ -1,25 +0,0 @@
error[E0277]: `()` is not a future
--> $DIR/async-error-span.rs:10:20
|
LL | fn get_future() -> impl Future<Output = ()> {
| ^^^^^^^^^^^^^^^^^^^^^^^^ `()` is not a future
|
= help: the trait `Future` is not implemented for `()`
= note: () must be a future or must implement `IntoFuture` to be awaited
error[E0698]: type inside `async fn` body must be known in this context
--> $DIR/async-error-span.rs:16:9
|
LL | let a;
| ^ cannot infer type
|
note: the type is part of the `async fn` body because of this `await`
--> $DIR/async-error-span.rs:17:17
|
LL | get_future().await;
| ^^^^^^
error: aborting due to 2 previous errors
Some errors have detailed explanations: E0277, E0698.
For more information about an error, try `rustc --explain E0277`.

View File

@ -1,26 +1,3 @@
error: future cannot be sent between threads safely
--> $DIR/async-fn-nonsend.rs:70:17
|
LL | assert_send(local_dropped_before_await());
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ future returned by `local_dropped_before_await` is not `Send`
|
= help: within `impl Future<Output = ()>`, the trait `Send` is not implemented for `Rc<()>`
note: future is not `Send` as this value is used across an await
--> $DIR/async-fn-nonsend.rs:27:10
|
LL | let x = non_send();
| - has type `impl Debug` which is not `Send`
LL | drop(x);
LL | fut().await;
| ^^^^^^ await occurs here, with `x` maybe used later
LL | }
| - `x` is later dropped here
note: required by a bound in `assert_send`
--> $DIR/async-fn-nonsend.rs:67:24
|
LL | fn assert_send(_: impl Send) {}
| ^^^^ required by this bound in `assert_send`
error: future cannot be sent between threads safely
--> $DIR/async-fn-nonsend.rs:72:17
|
@ -32,12 +9,9 @@ note: future is not `Send` as this value is used across an await
--> $DIR/async-fn-nonsend.rs:36:25
|
LL | match Some(non_send()) {
| ---------- has type `impl Debug` which is not `Send`
| ---------------- has type `Option<impl Debug>` which is not `Send`
LL | Some(_) => fut().await,
| ^^^^^^ await occurs here, with `non_send()` maybe used later
...
LL | }
| - `non_send()` is later dropped here
| ^^^^^^ await occurs here, with `Some(non_send())` maybe used later
note: required by a bound in `assert_send`
--> $DIR/async-fn-nonsend.rs:67:24
|
@ -59,62 +33,11 @@ LL | let f: &mut std::fmt::Formatter = &mut get_formatter();
...
LL | fut().await;
| ^^^^^^ await occurs here, with `get_formatter()` maybe used later
LL | }
LL | }
| - `get_formatter()` is later dropped here
note: required by a bound in `assert_send`
--> $DIR/async-fn-nonsend.rs:67:24
|
LL | fn assert_send(_: impl Send) {}
| ^^^^ required by this bound in `assert_send`
error: future cannot be sent between threads safely
--> $DIR/async-fn-nonsend.rs:76:17
|
LL | assert_send(non_sync_with_method_call_panic());
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ future returned by `non_sync_with_method_call_panic` is not `Send`
|
= help: within `impl Future<Output = ()>`, the trait `Send` is not implemented for `dyn std::fmt::Write`
note: future is not `Send` as this value is used across an await
--> $DIR/async-fn-nonsend.rs:56:14
|
LL | let f: &mut std::fmt::Formatter = panic!();
| - has type `&mut Formatter<'_>` which is not `Send`
LL | if non_sync().fmt(f).unwrap() == () {
LL | fut().await;
| ^^^^^^ await occurs here, with `f` maybe used later
LL | }
LL | }
| - `f` is later dropped here
note: required by a bound in `assert_send`
--> $DIR/async-fn-nonsend.rs:67:24
|
LL | fn assert_send(_: impl Send) {}
| ^^^^ required by this bound in `assert_send`
error: future cannot be sent between threads safely
--> $DIR/async-fn-nonsend.rs:78:17
|
LL | assert_send(non_sync_with_method_call_infinite_loop());
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ future returned by `non_sync_with_method_call_infinite_loop` is not `Send`
|
= help: within `impl Future<Output = ()>`, the trait `Send` is not implemented for `dyn std::fmt::Write`
note: future is not `Send` as this value is used across an await
--> $DIR/async-fn-nonsend.rs:63:14
|
LL | let f: &mut std::fmt::Formatter = loop {};
| - has type `&mut Formatter<'_>` which is not `Send`
LL | if non_sync().fmt(f).unwrap() == () {
LL | fut().await;
| ^^^^^^ await occurs here, with `f` maybe used later
LL | }
LL | }
| - `f` is later dropped here
note: required by a bound in `assert_send`
--> $DIR/async-fn-nonsend.rs:67:24
|
LL | fn assert_send(_: impl Send) {}
| ^^^^ required by this bound in `assert_send`
error: aborting due to 5 previous errors
error: aborting due to 2 previous errors

View File

@ -68,13 +68,13 @@ fn assert_send(_: impl Send) {}
pub fn pass_assert() {
assert_send(local_dropped_before_await());
//[no_drop_tracking,drop_tracking_mir]~^ ERROR future cannot be sent between threads safely
//[no_drop_tracking]~^ ERROR future cannot be sent between threads safely
assert_send(non_send_temporary_in_match());
//~^ ERROR future cannot be sent between threads safely
assert_send(non_sync_with_method_call());
//~^ ERROR future cannot be sent between threads safely
assert_send(non_sync_with_method_call_panic());
//[no_drop_tracking,drop_tracking_mir]~^ ERROR future cannot be sent between threads safely
//[no_drop_tracking]~^ ERROR future cannot be sent between threads safely
assert_send(non_sync_with_method_call_infinite_loop());
//[no_drop_tracking,drop_tracking_mir]~^ ERROR future cannot be sent between threads safely
//[no_drop_tracking]~^ ERROR future cannot be sent between threads safely
}

View File

@ -13,8 +13,6 @@ LL | let mut info = self.info_result.clone();
...
LL | let _ = send_element(element).await;
| ^^^^^^ await occurs here, with `mut info` maybe used later
LL | }
| - `mut info` is later dropped here
note: required by a bound in `assert_send`
--> $DIR/drop-track-field-assign-nonsend.rs:40:19
|

View File

@ -13,8 +13,6 @@ LL | let mut info = self.info_result.clone();
...
LL | let _ = send_element(element).await;
| ^^^^^^ await occurs here, with `mut info` maybe used later
LL | }
| - `mut info` is later dropped here
note: required by a bound in `assert_send`
--> $DIR/field-assign-nonsend.rs:40:19
|

View File

@ -1,5 +1,5 @@
error: future cannot be shared between threads safely
--> $DIR/issue-64130-1-sync.rs:24:13
--> $DIR/issue-64130-1-sync.rs:25:13
|
LL | is_sync(bar());
| ^^^^^ future returned by `bar` is not `Sync`
@ -12,6 +12,7 @@ LL | let x = Foo;
| - has type `Foo` which is not `Sync`
LL | baz().await;
| ^^^^^^ await occurs here, with `x` maybe used later
LL | drop(x);
LL | }
| - `x` is later dropped here
note: required by a bound in `is_sync`

View File

@ -1,5 +1,5 @@
error: future cannot be shared between threads safely
--> $DIR/issue-64130-1-sync.rs:24:13
--> $DIR/issue-64130-1-sync.rs:25:13
|
LL | is_sync(bar());
| ^^^^^ future returned by `bar` is not `Sync`
@ -12,8 +12,6 @@ LL | let x = Foo;
| - has type `Foo` which is not `Sync`
LL | baz().await;
| ^^^^^^ await occurs here, with `x` maybe used later
LL | }
| - `x` is later dropped here
note: required by a bound in `is_sync`
--> $DIR/issue-64130-1-sync.rs:14:15
|

View File

@ -1,5 +1,5 @@
error: future cannot be shared between threads safely
--> $DIR/issue-64130-1-sync.rs:24:13
--> $DIR/issue-64130-1-sync.rs:25:13
|
LL | is_sync(bar());
| ^^^^^ future returned by `bar` is not `Sync`
@ -12,6 +12,7 @@ LL | let x = Foo;
| - has type `Foo` which is not `Sync`
LL | baz().await;
| ^^^^^^ await occurs here, with `x` maybe used later
LL | drop(x);
LL | }
| - `x` is later dropped here
note: required by a bound in `is_sync`

View File

@ -16,6 +16,7 @@ fn is_sync<T: Sync>(t: T) { }
async fn bar() {
let x = Foo;
baz().await;
drop(x);
}
async fn baz() { }

View File

@ -4,12 +4,12 @@ error: future cannot be sent between threads safely
LL | is_send(bar());
| ^^^^^ future returned by `bar` is not `Send`
|
= help: within `impl Future<Output = ()>`, the trait `Send` is not implemented for `Foo`
= note: the trait bound `Unique<Foo>: Send` is not satisfied
note: future is not `Send` as this value is used across an await
--> $DIR/issue-64130-2-send.rs:18:10
|
LL | let x = Foo;
| - has type `Foo` which is not `Send`
LL | let x = Box::new(Foo);
| - has type `Box<Foo>` which is not `Send`
LL | baz().await;
| ^^^^^^ await occurs here, with `x` maybe used later
LL | }
@ -19,6 +19,10 @@ note: required by a bound in `is_send`
|
LL | fn is_send<T: Send>(t: T) { }
| ^^^^ required by this bound in `is_send`
help: consider borrowing here
|
LL | is_send(&bar());
| +
error: aborting due to previous error

View File

@ -4,21 +4,23 @@ error: future cannot be sent between threads safely
LL | is_send(bar());
| ^^^^^ future returned by `bar` is not `Send`
|
= help: within `impl Future<Output = ()>`, the trait `Send` is not implemented for `Foo`
= note: the trait bound `Unique<Foo>: Send` is not satisfied
note: future is not `Send` as this value is used across an await
--> $DIR/issue-64130-2-send.rs:18:10
|
LL | let x = Foo;
| - has type `Foo` which is not `Send`
LL | let x = Box::new(Foo);
| - has type `Box<Foo>` which is not `Send`
LL | baz().await;
| ^^^^^^ await occurs here, with `x` maybe used later
LL | }
| - `x` is later dropped here
note: required by a bound in `is_send`
--> $DIR/issue-64130-2-send.rs:14:15
|
LL | fn is_send<T: Send>(t: T) { }
| ^^^^ required by this bound in `is_send`
help: consider borrowing here
|
LL | is_send(&bar());
| +
error: aborting due to previous error

View File

@ -4,12 +4,12 @@ error: future cannot be sent between threads safely
LL | is_send(bar());
| ^^^^^ future returned by `bar` is not `Send`
|
= help: within `impl Future<Output = ()>`, the trait `Send` is not implemented for `Foo`
= note: the trait bound `Unique<Foo>: Send` is not satisfied
note: future is not `Send` as this value is used across an await
--> $DIR/issue-64130-2-send.rs:18:10
|
LL | let x = Foo;
| - has type `Foo` which is not `Send`
LL | let x = Box::new(Foo);
| - has type `Box<Foo>` which is not `Send`
LL | baz().await;
| ^^^^^^ await occurs here, with `x` maybe used later
LL | }
@ -19,6 +19,10 @@ note: required by a bound in `is_send`
|
LL | fn is_send<T: Send>(t: T) { }
| ^^^^ required by this bound in `is_send`
help: consider borrowing here
|
LL | is_send(&bar());
| +
error: aborting due to previous error

View File

@ -14,7 +14,7 @@ impl !Send for Foo {}
fn is_send<T: Send>(t: T) { }
async fn bar() {
let x = Foo;
let x = Box::new(Foo);
baz().await;
}

View File

@ -10,8 +10,8 @@ LL | is_qux(bar());
note: future does not implement `Qux` as this value is used across an await
--> $DIR/issue-64130-3-other.rs:21:10
|
LL | let x = Foo;
| - has type `Foo` which does not implement `Qux`
LL | let x = Box::new(Foo);
| - has type `Box<Foo>` which does not implement `Qux`
LL | baz().await;
| ^^^^^^ await occurs here, with `x` maybe used later
LL | }

View File

@ -10,12 +10,10 @@ LL | is_qux(bar());
note: future does not implement `Qux` as this value is used across an await
--> $DIR/issue-64130-3-other.rs:21:10
|
LL | let x = Foo;
| - has type `Foo` which does not implement `Qux`
LL | let x = Box::new(Foo);
| - has type `Box<Foo>` which does not implement `Qux`
LL | baz().await;
| ^^^^^^ await occurs here, with `x` maybe used later
LL | }
| - `x` is later dropped here
note: required by a bound in `is_qux`
--> $DIR/issue-64130-3-other.rs:17:14
|

View File

@ -10,8 +10,8 @@ LL | is_qux(bar());
note: future does not implement `Qux` as this value is used across an await
--> $DIR/issue-64130-3-other.rs:21:10
|
LL | let x = Foo;
| - has type `Foo` which does not implement `Qux`
LL | let x = Box::new(Foo);
| - has type `Box<Foo>` which does not implement `Qux`
LL | baz().await;
| ^^^^^^ await occurs here, with `x` maybe used later
LL | }

View File

@ -17,7 +17,7 @@ impl !Qux for Foo {}
fn is_qux<T: Qux>(t: T) {}
async fn bar() {
let x = Foo;
let x = Box::new(Foo);
baz().await;
}

View File

@ -1,26 +0,0 @@
error: future cannot be sent between threads safely
--> $DIR/issue-64130-4-async-move.rs:20:17
|
LL | pub fn foo() -> impl Future + Send {
| ^^^^^^^^^^^^^^^^^^ future created by async block is not `Send`
|
= help: the trait `Sync` is not implemented for `(dyn Any + Send + 'static)`
note: future is not `Send` as this value is used across an await
--> $DIR/issue-64130-4-async-move.rs:27:31
|
LL | match client.status() {
| ------ has type `&Client` which is not `Send`
LL | 200 => {
LL | let _x = get().await;
| ^^^^^^ await occurs here, with `client` maybe used later
...
LL | }
| - `client` is later dropped here
help: consider moving this into a `let` binding to create a shorter lived borrow
--> $DIR/issue-64130-4-async-move.rs:25:15
|
LL | match client.status() {
| ^^^^^^^^^^^^^^^
error: aborting due to previous error

View File

@ -1,5 +1,5 @@
error: future cannot be sent between threads safely
--> $DIR/issue-64130-4-async-move.rs:20:17
--> $DIR/issue-64130-4-async-move.rs:21:17
|
LL | pub fn foo() -> impl Future + Send {
| ^^^^^^^^^^^^^^^^^^ future created by async block is not `Send`

View File

@ -2,6 +2,7 @@
// revisions: no_drop_tracking drop_tracking drop_tracking_mir
// [drop_tracking] compile-flags: -Zdrop-tracking
// [drop_tracking_mir] compile-flags: -Zdrop-tracking-mir
// [drop_tracking_mir] check-pass
// [drop_tracking] check-pass
use std::any::Any;
@ -19,7 +20,6 @@ async fn get() {}
pub fn foo() -> impl Future + Send {
//[no_drop_tracking]~^ ERROR future cannot be sent between threads safely
//[drop_tracking_mir]~^^ ERROR future cannot be sent between threads safely
let client = Client(Box::new(true));
async move {
match client.status() {

View File

@ -3,21 +3,23 @@ error: future cannot be sent between threads safely
|
LL | spawn(async {
| ___________^
LL | | let _a = std::ptr::null_mut::<()>(); // `*mut ()` is not `Send`
LL | | let a = std::ptr::null_mut::<()>(); // `*mut ()` is not `Send`
LL | | AFuture.await;
LL | | drop(a);
LL | | });
| |_____^ future created by async block is not `Send`
|
= help: within `[async block@$DIR/issue-67252-unnamed-future.rs:21:11: 24:6]`, the trait `Send` is not implemented for `*mut ()`
= help: within `[async block@$DIR/issue-67252-unnamed-future.rs:21:11: 25:6]`, the trait `Send` is not implemented for `*mut ()`
note: future is not `Send` as this value is used across an await
--> $DIR/issue-67252-unnamed-future.rs:23:16
|
LL | let _a = std::ptr::null_mut::<()>(); // `*mut ()` is not `Send`
| -- has type `*mut ()` which is not `Send`
LL | let a = std::ptr::null_mut::<()>(); // `*mut ()` is not `Send`
| - has type `*mut ()` which is not `Send`
LL | AFuture.await;
| ^^^^^^ await occurs here, with `_a` maybe used later
| ^^^^^^ await occurs here, with `a` maybe used later
LL | drop(a);
LL | });
| - `_a` is later dropped here
| - `a` is later dropped here
note: required by a bound in `spawn`
--> $DIR/issue-67252-unnamed-future.rs:9:13
|

View File

@ -1,23 +1,17 @@
error: future cannot be sent between threads safely
--> $DIR/issue-67252-unnamed-future.rs:21:11
--> $DIR/issue-67252-unnamed-future.rs:21:5
|
LL | spawn(async {
| ___________^
LL | | let _a = std::ptr::null_mut::<()>(); // `*mut ()` is not `Send`
LL | | AFuture.await;
LL | | });
| |_____^ future created by async block is not `Send`
LL | spawn(async {
| ^^^^^ future created by async block is not `Send`
|
= help: within `[async block@$DIR/issue-67252-unnamed-future.rs:21:11: 24:6]`, the trait `Send` is not implemented for `*mut ()`
= help: within `[async block@$DIR/issue-67252-unnamed-future.rs:21:11: 25:6]`, the trait `Send` is not implemented for `*mut ()`
note: future is not `Send` as this value is used across an await
--> $DIR/issue-67252-unnamed-future.rs:23:16
|
LL | let _a = std::ptr::null_mut::<()>(); // `*mut ()` is not `Send`
| -- has type `*mut ()` which is not `Send`
LL | let a = std::ptr::null_mut::<()>(); // `*mut ()` is not `Send`
| - has type `*mut ()` which is not `Send`
LL | AFuture.await;
| ^^^^^^ await occurs here, with `_a` maybe used later
LL | });
| - `_a` is later dropped here
| ^^^^^^ await occurs here, with `a` maybe used later
note: required by a bound in `spawn`
--> $DIR/issue-67252-unnamed-future.rs:9:13
|

View File

@ -3,21 +3,23 @@ error: future cannot be sent between threads safely
|
LL | spawn(async {
| ___________^
LL | | let _a = std::ptr::null_mut::<()>(); // `*mut ()` is not `Send`
LL | | let a = std::ptr::null_mut::<()>(); // `*mut ()` is not `Send`
LL | | AFuture.await;
LL | | drop(a);
LL | | });
| |_____^ future created by async block is not `Send`
|
= help: within `[async block@$DIR/issue-67252-unnamed-future.rs:21:11: 24:6]`, the trait `Send` is not implemented for `*mut ()`
= help: within `[async block@$DIR/issue-67252-unnamed-future.rs:21:11: 25:6]`, the trait `Send` is not implemented for `*mut ()`
note: future is not `Send` as this value is used across an await
--> $DIR/issue-67252-unnamed-future.rs:23:16
|
LL | let _a = std::ptr::null_mut::<()>(); // `*mut ()` is not `Send`
| -- has type `*mut ()` which is not `Send`
LL | let a = std::ptr::null_mut::<()>(); // `*mut ()` is not `Send`
| - has type `*mut ()` which is not `Send`
LL | AFuture.await;
| ^^^^^^ await occurs here, with `_a` maybe used later
| ^^^^^^ await occurs here, with `a` maybe used later
LL | drop(a);
LL | });
| - `_a` is later dropped here
| - `a` is later dropped here
note: required by a bound in `spawn`
--> $DIR/issue-67252-unnamed-future.rs:9:13
|

View File

@ -19,8 +19,9 @@ impl Future for AFuture{
async fn foo() {
spawn(async { //~ ERROR future cannot be sent between threads safely
let _a = std::ptr::null_mut::<()>(); // `*mut ()` is not `Send`
let a = std::ptr::null_mut::<()>(); // `*mut ()` is not `Send`
AFuture.await;
drop(a);
});
}

View File

@ -1,8 +1,8 @@
error: future cannot be sent between threads safely
--> $DIR/issue-68112.rs:37:18
--> $DIR/issue-68112.rs:37:5
|
LL | require_send(send_fut);
| ^^^^^^^^ future created by async block is not `Send`
| ^^^^^^^^^^^^ future created by async block is not `Send`
|
= help: the trait `Sync` is not implemented for `RefCell<i32>`
= note: if you want to do aliasing and mutation between multiple threads, use `std::sync::RwLock` instead
@ -18,10 +18,10 @@ LL | fn require_send(_: impl Send) {}
| ^^^^ required by this bound in `require_send`
error: future cannot be sent between threads safely
--> $DIR/issue-68112.rs:46:18
--> $DIR/issue-68112.rs:46:5
|
LL | require_send(send_fut);
| ^^^^^^^^ future created by async block is not `Send`
| ^^^^^^^^^^^^ future created by async block is not `Send`
|
= help: the trait `Sync` is not implemented for `RefCell<i32>`
= note: if you want to do aliasing and mutation between multiple threads, use `std::sync::RwLock` instead
@ -37,12 +37,10 @@ LL | fn require_send(_: impl Send) {}
| ^^^^ required by this bound in `require_send`
error[E0277]: `RefCell<i32>` cannot be shared between threads safely
--> $DIR/issue-68112.rs:65:18
--> $DIR/issue-68112.rs:65:5
|
LL | require_send(send_fut);
| ------------ ^^^^^^^^ `RefCell<i32>` cannot be shared between threads safely
| |
| required by a bound introduced by this call
| ^^^^^^^^^^^^ `RefCell<i32>` cannot be shared between threads safely
|
= help: the trait `Sync` is not implemented for `RefCell<i32>`
= note: if you want to do aliasing and mutation between multiple threads, use `std::sync::RwLock` instead
@ -60,7 +58,7 @@ note: required because it appears within the type `impl Future<Output = Arc<RefC
|
LL | fn make_non_send_future2() -> impl Future<Output = Arc<RefCell<i32>>> {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
= note: required because it captures the following types: `ResumeTy`, `impl Future<Output = Arc<RefCell<i32>>>`, `()`, `i32`, `Ready<i32>`
= note: required because it captures the following types: `impl Future<Output = Arc<RefCell<i32>>>`, `Ready<i32>`
note: required because it's used within this `async` block
--> $DIR/issue-68112.rs:60:20
|

View File

@ -14,7 +14,7 @@ use std::{
fn require_send(_: impl Send) {}
struct Ready<T>(Option<T>);
impl<T> Future for Ready<T> {
impl<T: Unpin> Future for Ready<T> {
type Output = T;
fn poll(mut self: Pin<&mut Self>, _cx: &mut Context<'_>) -> Poll<T> {
Poll::Ready(self.0.take().unwrap())

View File

@ -7,7 +7,7 @@ LL | fn foo(tx: std::sync::mpsc::Sender<i32>) -> impl Future + Send {
= help: the trait `Sync` is not implemented for `Sender<i32>`
= note: required for `&Sender<i32>` to implement `Send`
note: required because it's used within this closure
--> $DIR/issue-70935-complex-spans.rs:18:13
--> $DIR/issue-70935-complex-spans.rs:17:13
|
LL | baz(|| async{
| ^^
@ -20,7 +20,7 @@ LL | | }
| |_^
= note: required because it captures the following types: `ResumeTy`, `impl Future<Output = ()>`, `()`
note: required because it's used within this `async` block
--> $DIR/issue-70935-complex-spans.rs:17:5
--> $DIR/issue-70935-complex-spans.rs:16:5
|
LL | / async move {
LL | | baz(|| async{

View File

@ -1,21 +1,34 @@
error: future cannot be sent between threads safely
error[E0277]: `Sender<i32>` cannot be shared between threads safely
--> $DIR/issue-70935-complex-spans.rs:13:45
|
LL | fn foo(tx: std::sync::mpsc::Sender<i32>) -> impl Future + Send {
| ^^^^^^^^^^^^^^^^^^ future created by async block is not `Send`
| ^^^^^^^^^^^^^^^^^^ `Sender<i32>` cannot be shared between threads safely
|
= help: the trait `Sync` is not implemented for `Sender<i32>`
note: future is not `Send` as this value is used across an await
--> $DIR/issue-70935-complex-spans.rs:20:11
= note: required for `&Sender<i32>` to implement `Send`
note: required because it's used within this closure
--> $DIR/issue-70935-complex-spans.rs:17:13
|
LL | baz(|| async{
| _____________-
LL | baz(|| async{
| ^^
note: required because it's used within this `async fn` body
--> $DIR/issue-70935-complex-spans.rs:10:67
|
LL | async fn baz<T>(_c: impl FnMut() -> T) where T: Future<Output=()> {
| ___________________________________________________________________^
LL | | }
| |_^
= note: required because it captures the following types: `impl Future<Output = ()>`
note: required because it's used within this `async` block
--> $DIR/issue-70935-complex-spans.rs:16:5
|
LL | / async move {
LL | | baz(|| async{
LL | | foo(tx.clone());
LL | | }).await;
| | - ^^^^^^- the value is later dropped here
| | | |
| |_________| await occurs here, with the value maybe used later
| has type `[closure@$DIR/issue-70935-complex-spans.rs:18:13: 18:15]` which is not `Send`
LL | | }
| |_____^
error: aborting due to previous error
For more information about this error, try `rustc --explain E0277`.

View File

@ -6,7 +6,7 @@ LL | fn foo(tx: std::sync::mpsc::Sender<i32>) -> impl Future + Send {
|
= help: the trait `Sync` is not implemented for `Sender<i32>`
note: future is not `Send` as this value is used across an await
--> $DIR/issue-70935-complex-spans.rs:20:11
--> $DIR/issue-70935-complex-spans.rs:19:11
|
LL | baz(|| async{
| _____________-
@ -15,7 +15,7 @@ LL | | }).await;
| | - ^^^^^^- the value is later dropped here
| | | |
| |_________| await occurs here, with the value maybe used later
| has type `[closure@$DIR/issue-70935-complex-spans.rs:18:13: 18:15]` which is not `Send`
| has type `[closure@$DIR/issue-70935-complex-spans.rs:17:13: 17:15]` which is not `Send`
error: aborting due to previous error

View File

@ -12,8 +12,7 @@ async fn baz<T>(_c: impl FnMut() -> T) where T: Future<Output=()> {
fn foo(tx: std::sync::mpsc::Sender<i32>) -> impl Future + Send {
//[no_drop_tracking]~^ ERROR future cannot be sent between threads safely
//[drop_tracking]~^^ ERROR `Sender<i32>` cannot be shared between threads
//[drop_tracking_mir]~^^^ ERROR future cannot be sent between threads safely
//[drop_tracking,drop_tracking_mir]~^^ ERROR `Sender<i32>` cannot be shared between threads
async move {
baz(|| async{
foo(tx.clone());

View File

@ -1,33 +0,0 @@
error: future cannot be sent between threads safely
--> $DIR/issue-65436-raw-ptr-not-send.rs:16:17
|
LL | assert_send(async {
| _________________^
LL | |
LL | |
LL | | bar(Foo(std::ptr::null())).await;
LL | | })
| |_____^ future created by async block is not `Send`
|
= help: within `[async block@$DIR/issue-65436-raw-ptr-not-send.rs:16:17: 20:6]`, the trait `Send` is not implemented for `*const u8`
note: future is not `Send` as this value is used across an await
--> $DIR/issue-65436-raw-ptr-not-send.rs:19:35
|
LL | bar(Foo(std::ptr::null())).await;
| ---------------- ^^^^^^- `std::ptr::null()` is later dropped here
| | |
| | await occurs here, with `std::ptr::null()` maybe used later
| has type `*const u8` which is not `Send`
help: consider moving this into a `let` binding to create a shorter lived borrow
--> $DIR/issue-65436-raw-ptr-not-send.rs:19:13
|
LL | bar(Foo(std::ptr::null())).await;
| ^^^^^^^^^^^^^^^^^^^^^
note: required by a bound in `assert_send`
--> $DIR/issue-65436-raw-ptr-not-send.rs:13:19
|
LL | fn assert_send<T: Send>(_: T) {}
| ^^^^ required by this bound in `assert_send`
error: aborting due to previous error

View File

@ -1,15 +1,14 @@
error: future cannot be sent between threads safely
--> $DIR/issue-65436-raw-ptr-not-send.rs:16:17
--> $DIR/issue-65436-raw-ptr-not-send.rs:17:17
|
LL | assert_send(async {
| _________________^
LL | |
LL | |
LL | | bar(Foo(std::ptr::null())).await;
LL | | })
| |_____^ future created by async block is not `Send`
|
= help: within `[async block@$DIR/issue-65436-raw-ptr-not-send.rs:16:17: 20:6]`, the trait `Send` is not implemented for `*const u8`
= help: within `[async block@$DIR/issue-65436-raw-ptr-not-send.rs:17:17: 20:6]`, the trait `Send` is not implemented for `*const u8`
note: future is not `Send` as this value is used across an await
--> $DIR/issue-65436-raw-ptr-not-send.rs:19:35
|
@ -24,7 +23,7 @@ help: consider moving this into a `let` binding to create a shorter lived borrow
LL | bar(Foo(std::ptr::null())).await;
| ^^^^^^^^^^^^^^^^^^^^^
note: required by a bound in `assert_send`
--> $DIR/issue-65436-raw-ptr-not-send.rs:13:19
--> $DIR/issue-65436-raw-ptr-not-send.rs:14:19
|
LL | fn assert_send<T: Send>(_: T) {}
| ^^^^ required by this bound in `assert_send`

View File

@ -3,6 +3,7 @@
// [drop_tracking] compile-flags: -Zdrop-tracking
// [drop_tracking_mir] compile-flags: -Zdrop-tracking-mir
// [drop_tracking] check-pass
// [drop_tracking_mir] check-pass
struct Foo(*const u8);
@ -15,7 +16,6 @@ fn assert_send<T: Send>(_: T) {}
fn main() {
assert_send(async {
//[no_drop_tracking]~^ ERROR future cannot be sent between threads safely
//[drop_tracking_mir]~^^ ERROR future cannot be sent between threads safely
bar(Foo(std::ptr::null())).await;
})
}

View File

@ -0,0 +1,37 @@
// edition: 2021
// check-pass
// This test verifies that we do not create a query cycle when typechecking has several inference
// variables that point to the same generator interior type.
use std::future::Future;
use std::pin::Pin;
use std::task::{Context, Poll};
type ChannelTask = Pin<Box<dyn Future<Output = ()> + Send>>;
pub fn register_message_type() -> ChannelTask {
Box::pin(async move {
let f = |__cx: &mut Context<'_>| Poll::<()>::Pending;
PollFn { f }.await
})
}
struct PollFn<F> {
f: F,
}
impl<F> Unpin for PollFn<F> {}
impl<T, F> Future for PollFn<F>
where
F: FnMut(&mut Context<'_>) -> Poll<T>,
{
type Output = T;
fn poll(mut self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll<T> {
(&mut self.f)(cx)
}
}
fn main() {}

View File

@ -1,35 +1,35 @@
error[E0698]: type inside `async fn` body must be known in this context
--> $DIR/unresolved_type_param.rs:13:5
--> $DIR/unresolved_type_param.rs:12:5
|
LL | bar().await;
| ^^^ cannot infer type for type parameter `T` declared on the function `bar`
|
note: the type is part of the `async fn` body because of this `await`
--> $DIR/unresolved_type_param.rs:13:10
--> $DIR/unresolved_type_param.rs:12:10
|
LL | bar().await;
| ^^^^^^
error[E0698]: type inside `async fn` body must be known in this context
--> $DIR/unresolved_type_param.rs:13:5
--> $DIR/unresolved_type_param.rs:12:5
|
LL | bar().await;
| ^^^ cannot infer type for type parameter `T` declared on the function `bar`
|
note: the type is part of the `async fn` body because of this `await`
--> $DIR/unresolved_type_param.rs:13:10
--> $DIR/unresolved_type_param.rs:12:10
|
LL | bar().await;
| ^^^^^^
error[E0698]: type inside `async fn` body must be known in this context
--> $DIR/unresolved_type_param.rs:13:5
--> $DIR/unresolved_type_param.rs:12:5
|
LL | bar().await;
| ^^^ cannot infer type for type parameter `T` declared on the function `bar`
|
note: the type is part of the `async fn` body because of this `await`
--> $DIR/unresolved_type_param.rs:13:10
--> $DIR/unresolved_type_param.rs:12:10
|
LL | bar().await;
| ^^^^^^

View File

@ -1,39 +1,14 @@
error[E0698]: type inside `async fn` body must be known in this context
--> $DIR/unresolved_type_param.rs:13:5
error[E0282]: type annotations needed
--> $DIR/unresolved_type_param.rs:12:5
|
LL | bar().await;
| ^^^ cannot infer type for type parameter `T` declared on the function `bar`
| ^^^ cannot infer type of the type parameter `T` declared on the function `bar`
|
note: the type is part of the `async fn` body because of this `await`
--> $DIR/unresolved_type_param.rs:13:10
help: consider specifying the generic argument
|
LL | bar().await;
| ^^^^^^
LL | bar::<T>().await;
| +++++
error[E0698]: type inside `async fn` body must be known in this context
--> $DIR/unresolved_type_param.rs:13:5
|
LL | bar().await;
| ^^^ cannot infer type for type parameter `T` declared on the function `bar`
|
note: the type is part of the `async fn` body because of this `await`
--> $DIR/unresolved_type_param.rs:13:10
|
LL | bar().await;
| ^^^^^^
error: aborting due to previous error
error[E0698]: type inside `async fn` body must be known in this context
--> $DIR/unresolved_type_param.rs:13:5
|
LL | bar().await;
| ^^^ cannot infer type for type parameter `T` declared on the function `bar`
|
note: the type is part of the `async fn` body because of this `await`
--> $DIR/unresolved_type_param.rs:13:10
|
LL | bar().await;
| ^^^^^^
error: aborting due to 3 previous errors
For more information about this error, try `rustc --explain E0698`.
For more information about this error, try `rustc --explain E0282`.

View File

@ -1,39 +1,63 @@
error[E0698]: type inside `async fn` body must be known in this context
--> $DIR/unresolved_type_param.rs:13:5
--> $DIR/unresolved_type_param.rs:12:5
|
LL | bar().await;
| ^^^ cannot infer type for type parameter `T` declared on the function `bar`
|
note: the type is part of the `async fn` body because of this `await`
--> $DIR/unresolved_type_param.rs:13:10
--> $DIR/unresolved_type_param.rs:12:10
|
LL | bar().await;
| ^^^^^^
error[E0698]: type inside `async fn` body must be known in this context
--> $DIR/unresolved_type_param.rs:13:5
--> $DIR/unresolved_type_param.rs:12:5
|
LL | bar().await;
| ^^^ cannot infer type for type parameter `T` declared on the function `bar`
|
note: the type is part of the `async fn` body because of this `await`
--> $DIR/unresolved_type_param.rs:13:10
--> $DIR/unresolved_type_param.rs:12:10
|
LL | bar().await;
| ^^^^^^
error[E0698]: type inside `async fn` body must be known in this context
--> $DIR/unresolved_type_param.rs:13:5
--> $DIR/unresolved_type_param.rs:12:5
|
LL | bar().await;
| ^^^ cannot infer type for type parameter `T` declared on the function `bar`
|
note: the type is part of the `async fn` body because of this `await`
--> $DIR/unresolved_type_param.rs:13:10
--> $DIR/unresolved_type_param.rs:12:10
|
LL | bar().await;
| ^^^^^^
error: aborting due to 3 previous errors
error[E0698]: type inside `async fn` body must be known in this context
--> $DIR/unresolved_type_param.rs:12:5
|
LL | bar().await;
| ^^^ cannot infer type for type parameter `T` declared on the function `bar`
|
note: the type is part of the `async fn` body because of this `await`
--> $DIR/unresolved_type_param.rs:12:10
|
LL | bar().await;
| ^^^^^^
error[E0698]: type inside `async fn` body must be known in this context
--> $DIR/unresolved_type_param.rs:12:5
|
LL | bar().await;
| ^^^ cannot infer type for type parameter `T` declared on the function `bar`
|
note: the type is part of the `async fn` body because of this `await`
--> $DIR/unresolved_type_param.rs:12:10
|
LL | bar().await;
| ^^^^^^
error: aborting due to 5 previous errors
For more information about this error, try `rustc --explain E0698`.

View File

@ -5,23 +5,32 @@
// Error message should pinpoint the type parameter T as needing to be bound
// (rather than give a general error message)
// edition:2018
// compile-flags: -Zdrop-tracking
async fn bar<T>() -> () {}
async fn foo() {
bar().await;
//~^ ERROR type inside `async fn` body must be known in this context
//~| ERROR type inside `async fn` body must be known in this context
//~| ERROR type inside `async fn` body must be known in this context
//~| NOTE cannot infer type for type parameter `T`
//~| NOTE cannot infer type for type parameter `T`
//~| NOTE cannot infer type for type parameter `T`
//~| NOTE the type is part of the `async fn` body because of this `await`
//~| NOTE the type is part of the `async fn` body because of this `await`
//~| NOTE the type is part of the `async fn` body because of this `await`
//~| NOTE in this expansion of desugaring of `await`
//~| NOTE in this expansion of desugaring of `await`
//~| NOTE in this expansion of desugaring of `await`
//[drop_tracking_mir]~^ ERROR type annotations needed
//[drop_tracking_mir]~| NOTE cannot infer type of the type parameter `T`
//[no_drop_tracking,drop_tracking]~^^^ ERROR type inside `async fn` body must be known in this context
//[no_drop_tracking,drop_tracking]~| ERROR type inside `async fn` body must be known in this context
//[no_drop_tracking,drop_tracking]~| ERROR type inside `async fn` body must be known in this context
//[no_drop_tracking,drop_tracking]~| NOTE cannot infer type for type parameter `T`
//[no_drop_tracking,drop_tracking]~| NOTE cannot infer type for type parameter `T`
//[no_drop_tracking,drop_tracking]~| NOTE cannot infer type for type parameter `T`
//[no_drop_tracking,drop_tracking]~| NOTE the type is part of the `async fn` body because of this `await`
//[no_drop_tracking,drop_tracking]~| NOTE the type is part of the `async fn` body because of this `await`
//[no_drop_tracking,drop_tracking]~| NOTE the type is part of the `async fn` body because of this `await`
//[no_drop_tracking,drop_tracking]~| NOTE in this expansion of desugaring of `await`
//[no_drop_tracking,drop_tracking]~| NOTE in this expansion of desugaring of `await`
//[no_drop_tracking,drop_tracking]~| NOTE in this expansion of desugaring of `await`
//[no_drop_tracking]~^^^^^^^^^^^^^^^ ERROR type inside `async fn` body must be known in this context
//[no_drop_tracking]~| ERROR type inside `async fn` body must be known in this context
//[no_drop_tracking]~| NOTE cannot infer type for type parameter `T`
//[no_drop_tracking]~| NOTE cannot infer type for type parameter `T`
//[no_drop_tracking]~| NOTE the type is part of the `async fn` body because of this `await`
//[no_drop_tracking]~| NOTE the type is part of the `async fn` body because of this `await`
//[no_drop_tracking]~| NOTE in this expansion of desugaring of `await`
//[no_drop_tracking]~| NOTE in this expansion of desugaring of `await`
}
fn main() {}

View File

@ -1,91 +1,8 @@
error: generator cannot be sent between threads safely
--> $DIR/drop-tracking-parent-expression.rs:27:25
--> $DIR/drop-tracking-parent-expression.rs:27:13
|
LL | assert_send(g);
| ^ generator is not `Send`
...
LL | / type_combinations!(
LL | | // OK
LL | | copy => { #[derive(Copy, Clone, Default)] pub struct Client; };
LL | | // NOT OK: MIR borrowck thinks that this is used after the yield, even though
... |
LL | | };
LL | | );
| |_____- in this macro invocation
|
= help: within `[generator@$DIR/drop-tracking-parent-expression.rs:21:21: 21:28]`, the trait `Send` is not implemented for `copy::Client`
note: generator is not `Send` as this value is used across a yield
--> $DIR/drop-tracking-parent-expression.rs:25:22
|
LL | let g = move || match drop($name::Client { ..$name::Client::default() }) {
| ------------------------ has type `copy::Client` which is not `Send`
...
LL | _ => yield,
| ^^^^^ yield occurs here, with `$name::Client::default()` maybe used later
LL | };
| - `$name::Client::default()` is later dropped here
...
LL | / type_combinations!(
LL | | // OK
LL | | copy => { #[derive(Copy, Clone, Default)] pub struct Client; };
LL | | // NOT OK: MIR borrowck thinks that this is used after the yield, even though
... |
LL | | };
LL | | );
| |_____- in this macro invocation
note: required by a bound in `assert_send`
--> $DIR/drop-tracking-parent-expression.rs:49:19
|
LL | fn assert_send<T: Send>(_thing: T) {}
| ^^^^ required by this bound in `assert_send`
= note: this error originates in the macro `type_combinations` (in Nightly builds, run with -Z macro-backtrace for more info)
error: generator cannot be sent between threads safely
--> $DIR/drop-tracking-parent-expression.rs:40:25
|
LL | assert_send(g);
| ^ generator is not `Send`
...
LL | / type_combinations!(
LL | | // OK
LL | | copy => { #[derive(Copy, Clone, Default)] pub struct Client; };
LL | | // NOT OK: MIR borrowck thinks that this is used after the yield, even though
... |
LL | | };
LL | | );
| |_____- in this macro invocation
|
= help: within `[generator@$DIR/drop-tracking-parent-expression.rs:37:21: 37:28]`, the trait `Send` is not implemented for `copy::Client`
note: generator is not `Send` as this value is used across a yield
--> $DIR/drop-tracking-parent-expression.rs:38:22
|
LL | let g = move || match drop($name::Client::default()) {
| ------------------------ has type `copy::Client` which is not `Send`
LL | _ => yield,
| ^^^^^ yield occurs here, with `$name::Client::default()` maybe used later
LL | };
| - `$name::Client::default()` is later dropped here
...
LL | / type_combinations!(
LL | | // OK
LL | | copy => { #[derive(Copy, Clone, Default)] pub struct Client; };
LL | | // NOT OK: MIR borrowck thinks that this is used after the yield, even though
... |
LL | | };
LL | | );
| |_____- in this macro invocation
note: required by a bound in `assert_send`
--> $DIR/drop-tracking-parent-expression.rs:49:19
|
LL | fn assert_send<T: Send>(_thing: T) {}
| ^^^^ required by this bound in `assert_send`
= note: this error originates in the macro `type_combinations` (in Nightly builds, run with -Z macro-backtrace for more info)
error: generator cannot be sent between threads safely
--> $DIR/drop-tracking-parent-expression.rs:27:25
|
LL | assert_send(g);
| ^ generator is not `Send`
| ^^^^^^^^^^^ generator is not `Send`
...
LL | / type_combinations!(
LL | | // OK
@ -105,8 +22,6 @@ LL | let g = move || match drop($name::Client { ..$name::Client::d
...
LL | _ => yield,
| ^^^^^ yield occurs here, with `$name::Client::default()` maybe used later
LL | };
| - `$name::Client::default()` is later dropped here
...
LL | / type_combinations!(
LL | | // OK
@ -124,51 +39,10 @@ LL | fn assert_send<T: Send>(_thing: T) {}
= note: this error originates in the macro `type_combinations` (in Nightly builds, run with -Z macro-backtrace for more info)
error: generator cannot be sent between threads safely
--> $DIR/drop-tracking-parent-expression.rs:40:25
--> $DIR/drop-tracking-parent-expression.rs:27:13
|
LL | assert_send(g);
| ^ generator is not `Send`
...
LL | / type_combinations!(
LL | | // OK
LL | | copy => { #[derive(Copy, Clone, Default)] pub struct Client; };
LL | | // NOT OK: MIR borrowck thinks that this is used after the yield, even though
... |
LL | | };
LL | | );
| |_____- in this macro invocation
|
= help: within `[generator@$DIR/drop-tracking-parent-expression.rs:37:21: 37:28]`, the trait `Send` is not implemented for `derived_drop::Client`
note: generator is not `Send` as this value is used across a yield
--> $DIR/drop-tracking-parent-expression.rs:38:22
|
LL | let g = move || match drop($name::Client::default()) {
| ------------------------ has type `derived_drop::Client` which is not `Send`
LL | _ => yield,
| ^^^^^ yield occurs here, with `$name::Client::default()` maybe used later
LL | };
| - `$name::Client::default()` is later dropped here
...
LL | / type_combinations!(
LL | | // OK
LL | | copy => { #[derive(Copy, Clone, Default)] pub struct Client; };
LL | | // NOT OK: MIR borrowck thinks that this is used after the yield, even though
... |
LL | | };
LL | | );
| |_____- in this macro invocation
note: required by a bound in `assert_send`
--> $DIR/drop-tracking-parent-expression.rs:49:19
|
LL | fn assert_send<T: Send>(_thing: T) {}
| ^^^^ required by this bound in `assert_send`
= note: this error originates in the macro `type_combinations` (in Nightly builds, run with -Z macro-backtrace for more info)
error: generator cannot be sent between threads safely
--> $DIR/drop-tracking-parent-expression.rs:27:25
|
LL | assert_send(g);
| ^ generator is not `Send`
| ^^^^^^^^^^^ generator is not `Send`
...
LL | / type_combinations!(
LL | | // OK
@ -188,8 +62,6 @@ LL | let g = move || match drop($name::Client { ..$name::Client::d
...
LL | _ => yield,
| ^^^^^ yield occurs here, with `$name::Client::default()` maybe used later
LL | };
| - `$name::Client::default()` is later dropped here
...
LL | / type_combinations!(
LL | | // OK
@ -207,51 +79,10 @@ LL | fn assert_send<T: Send>(_thing: T) {}
= note: this error originates in the macro `type_combinations` (in Nightly builds, run with -Z macro-backtrace for more info)
error: generator cannot be sent between threads safely
--> $DIR/drop-tracking-parent-expression.rs:40:25
--> $DIR/drop-tracking-parent-expression.rs:27:13
|
LL | assert_send(g);
| ^ generator is not `Send`
...
LL | / type_combinations!(
LL | | // OK
LL | | copy => { #[derive(Copy, Clone, Default)] pub struct Client; };
LL | | // NOT OK: MIR borrowck thinks that this is used after the yield, even though
... |
LL | | };
LL | | );
| |_____- in this macro invocation
|
= help: within `[generator@$DIR/drop-tracking-parent-expression.rs:37:21: 37:28]`, the trait `Send` is not implemented for `significant_drop::Client`
note: generator is not `Send` as this value is used across a yield
--> $DIR/drop-tracking-parent-expression.rs:38:22
|
LL | let g = move || match drop($name::Client::default()) {
| ------------------------ has type `significant_drop::Client` which is not `Send`
LL | _ => yield,
| ^^^^^ yield occurs here, with `$name::Client::default()` maybe used later
LL | };
| - `$name::Client::default()` is later dropped here
...
LL | / type_combinations!(
LL | | // OK
LL | | copy => { #[derive(Copy, Clone, Default)] pub struct Client; };
LL | | // NOT OK: MIR borrowck thinks that this is used after the yield, even though
... |
LL | | };
LL | | );
| |_____- in this macro invocation
note: required by a bound in `assert_send`
--> $DIR/drop-tracking-parent-expression.rs:49:19
|
LL | fn assert_send<T: Send>(_thing: T) {}
| ^^^^ required by this bound in `assert_send`
= note: this error originates in the macro `type_combinations` (in Nightly builds, run with -Z macro-backtrace for more info)
error: generator cannot be sent between threads safely
--> $DIR/drop-tracking-parent-expression.rs:27:25
|
LL | assert_send(g);
| ^ generator is not `Send`
| ^^^^^^^^^^^ generator is not `Send`
...
LL | / type_combinations!(
LL | | // OK
@ -271,8 +102,6 @@ LL | let g = move || match drop($name::Client { ..$name::Client::d
...
LL | _ => yield,
| ^^^^^ yield occurs here, with `$name::Client::default()` maybe used later
LL | };
| - `$name::Client::default()` is later dropped here
...
LL | / type_combinations!(
LL | | // OK
@ -289,46 +118,5 @@ LL | fn assert_send<T: Send>(_thing: T) {}
| ^^^^ required by this bound in `assert_send`
= note: this error originates in the macro `type_combinations` (in Nightly builds, run with -Z macro-backtrace for more info)
error: generator cannot be sent between threads safely
--> $DIR/drop-tracking-parent-expression.rs:40:25
|
LL | assert_send(g);
| ^ generator is not `Send`
...
LL | / type_combinations!(
LL | | // OK
LL | | copy => { #[derive(Copy, Clone, Default)] pub struct Client; };
LL | | // NOT OK: MIR borrowck thinks that this is used after the yield, even though
... |
LL | | };
LL | | );
| |_____- in this macro invocation
|
= help: within `[generator@$DIR/drop-tracking-parent-expression.rs:37:21: 37:28]`, the trait `Send` is not implemented for `insignificant_dtor::Client`
note: generator is not `Send` as this value is used across a yield
--> $DIR/drop-tracking-parent-expression.rs:38:22
|
LL | let g = move || match drop($name::Client::default()) {
| ------------------------ has type `insignificant_dtor::Client` which is not `Send`
LL | _ => yield,
| ^^^^^ yield occurs here, with `$name::Client::default()` maybe used later
LL | };
| - `$name::Client::default()` is later dropped here
...
LL | / type_combinations!(
LL | | // OK
LL | | copy => { #[derive(Copy, Clone, Default)] pub struct Client; };
LL | | // NOT OK: MIR borrowck thinks that this is used after the yield, even though
... |
LL | | };
LL | | );
| |_____- in this macro invocation
note: required by a bound in `assert_send`
--> $DIR/drop-tracking-parent-expression.rs:49:19
|
LL | fn assert_send<T: Send>(_thing: T) {}
| ^^^^ required by this bound in `assert_send`
= note: this error originates in the macro `type_combinations` (in Nightly builds, run with -Z macro-backtrace for more info)
error: aborting due to 8 previous errors
error: aborting due to 3 previous errors

View File

@ -21,14 +21,14 @@ macro_rules! type_combinations {
let g = move || match drop($name::Client { ..$name::Client::default() }) {
//~^ `significant_drop::Client` which is not `Send`
//~| `insignificant_dtor::Client` which is not `Send`
//~| `derived_drop::Client` which is not `Send`
//[no_drop_tracking,drop_tracking]~| `derived_drop::Client` which is not `Send`
_ => yield,
};
assert_send(g);
//~^ ERROR cannot be sent between threads
//~| ERROR cannot be sent between threads
//~| ERROR cannot be sent between threads
//[no_drop_tracking,drop_tracking_mir]~^^^^ ERROR cannot be sent between threads
//[no_drop_tracking]~| ERROR cannot be sent between threads
}
// Simple owned value. This works because the Client is considered moved into `drop`,
@ -38,10 +38,10 @@ macro_rules! type_combinations {
_ => yield,
};
assert_send(g);
//[no_drop_tracking,drop_tracking_mir]~^ ERROR cannot be sent between threads
//[no_drop_tracking,drop_tracking_mir]~| ERROR cannot be sent between threads
//[no_drop_tracking,drop_tracking_mir]~| ERROR cannot be sent between threads
//[no_drop_tracking,drop_tracking_mir]~| ERROR cannot be sent between threads
//[no_drop_tracking]~^ ERROR cannot be sent between threads
//[no_drop_tracking]~| ERROR cannot be sent between threads
//[no_drop_tracking]~| ERROR cannot be sent between threads
//[no_drop_tracking]~| ERROR cannot be sent between threads
}
)* }
}

View File

@ -1,248 +0,0 @@
error: generator cannot be sent between threads safely
--> $DIR/issue-57017.rs:30:25
|
LL | assert_send(g);
| ^ generator is not `Send`
...
LL | / type_combinations!(
LL | | copy => { #[derive(Copy, Clone, Default)] pub struct Client; };
LL | | derived_drop => { #[derive(Default)] pub struct Client { pub nickname: String } };
LL | | significant_drop => {
... |
LL | | }
LL | | );
| |_____- in this macro invocation
|
= help: the trait `Sync` is not implemented for `copy::unsync::Client`
note: generator is not `Send` as this value is used across a yield
--> $DIR/issue-57017.rs:28:28
|
LL | let g = move || match drop(&$name::unsync::Client::default()) {
| --------------------------------- has type `&copy::unsync::Client` which is not `Send`
LL | _status => yield,
| ^^^^^ yield occurs here, with `&$name::unsync::Client::default()` maybe used later
LL | };
| - `&$name::unsync::Client::default()` is later dropped here
...
LL | / type_combinations!(
LL | | copy => { #[derive(Copy, Clone, Default)] pub struct Client; };
LL | | derived_drop => { #[derive(Default)] pub struct Client { pub nickname: String } };
LL | | significant_drop => {
... |
LL | | }
LL | | );
| |_____- in this macro invocation
note: required by a bound in `assert_send`
--> $DIR/issue-57017.rs:50:19
|
LL | fn assert_send<T: Send>(_thing: T) {}
| ^^^^ required by this bound in `assert_send`
= note: this error originates in the macro `type_combinations` (in Nightly builds, run with -Z macro-backtrace for more info)
error: generator cannot be sent between threads safely
--> $DIR/issue-57017.rs:42:25
|
LL | assert_send(g);
| ^ generator is not `Send`
...
LL | / type_combinations!(
LL | | copy => { #[derive(Copy, Clone, Default)] pub struct Client; };
LL | | derived_drop => { #[derive(Default)] pub struct Client { pub nickname: String } };
LL | | significant_drop => {
... |
LL | | }
LL | | );
| |_____- in this macro invocation
|
= help: within `[generator@$DIR/issue-57017.rs:39:21: 39:28]`, the trait `Send` is not implemented for `copy::unsend::Client`
note: generator is not `Send` as this value is used across a yield
--> $DIR/issue-57017.rs:40:28
|
LL | let g = move || match drop($name::unsend::Client::default()) {
| -------------------------------- has type `copy::unsend::Client` which is not `Send`
LL | _status => yield,
| ^^^^^ yield occurs here, with `$name::unsend::Client::default()` maybe used later
LL | };
| - `$name::unsend::Client::default()` is later dropped here
...
LL | / type_combinations!(
LL | | copy => { #[derive(Copy, Clone, Default)] pub struct Client; };
LL | | derived_drop => { #[derive(Default)] pub struct Client { pub nickname: String } };
LL | | significant_drop => {
... |
LL | | }
LL | | );
| |_____- in this macro invocation
note: required by a bound in `assert_send`
--> $DIR/issue-57017.rs:50:19
|
LL | fn assert_send<T: Send>(_thing: T) {}
| ^^^^ required by this bound in `assert_send`
= note: this error originates in the macro `type_combinations` (in Nightly builds, run with -Z macro-backtrace for more info)
error: generator cannot be sent between threads safely
--> $DIR/issue-57017.rs:30:25
|
LL | assert_send(g);
| ^ generator is not `Send`
...
LL | / type_combinations!(
LL | | copy => { #[derive(Copy, Clone, Default)] pub struct Client; };
LL | | derived_drop => { #[derive(Default)] pub struct Client { pub nickname: String } };
LL | | significant_drop => {
... |
LL | | }
LL | | );
| |_____- in this macro invocation
|
= help: the trait `Sync` is not implemented for `derived_drop::unsync::Client`
note: generator is not `Send` as this value is used across a yield
--> $DIR/issue-57017.rs:28:28
|
LL | let g = move || match drop(&$name::unsync::Client::default()) {
| --------------------------------- has type `&derived_drop::unsync::Client` which is not `Send`
LL | _status => yield,
| ^^^^^ yield occurs here, with `&$name::unsync::Client::default()` maybe used later
LL | };
| - `&$name::unsync::Client::default()` is later dropped here
...
LL | / type_combinations!(
LL | | copy => { #[derive(Copy, Clone, Default)] pub struct Client; };
LL | | derived_drop => { #[derive(Default)] pub struct Client { pub nickname: String } };
LL | | significant_drop => {
... |
LL | | }
LL | | );
| |_____- in this macro invocation
note: required by a bound in `assert_send`
--> $DIR/issue-57017.rs:50:19
|
LL | fn assert_send<T: Send>(_thing: T) {}
| ^^^^ required by this bound in `assert_send`
= note: this error originates in the macro `type_combinations` (in Nightly builds, run with -Z macro-backtrace for more info)
error: generator cannot be sent between threads safely
--> $DIR/issue-57017.rs:42:25
|
LL | assert_send(g);
| ^ generator is not `Send`
...
LL | / type_combinations!(
LL | | copy => { #[derive(Copy, Clone, Default)] pub struct Client; };
LL | | derived_drop => { #[derive(Default)] pub struct Client { pub nickname: String } };
LL | | significant_drop => {
... |
LL | | }
LL | | );
| |_____- in this macro invocation
|
= help: within `[generator@$DIR/issue-57017.rs:39:21: 39:28]`, the trait `Send` is not implemented for `derived_drop::unsend::Client`
note: generator is not `Send` as this value is used across a yield
--> $DIR/issue-57017.rs:40:28
|
LL | let g = move || match drop($name::unsend::Client::default()) {
| -------------------------------- has type `derived_drop::unsend::Client` which is not `Send`
LL | _status => yield,
| ^^^^^ yield occurs here, with `$name::unsend::Client::default()` maybe used later
LL | };
| - `$name::unsend::Client::default()` is later dropped here
...
LL | / type_combinations!(
LL | | copy => { #[derive(Copy, Clone, Default)] pub struct Client; };
LL | | derived_drop => { #[derive(Default)] pub struct Client { pub nickname: String } };
LL | | significant_drop => {
... |
LL | | }
LL | | );
| |_____- in this macro invocation
note: required by a bound in `assert_send`
--> $DIR/issue-57017.rs:50:19
|
LL | fn assert_send<T: Send>(_thing: T) {}
| ^^^^ required by this bound in `assert_send`
= note: this error originates in the macro `type_combinations` (in Nightly builds, run with -Z macro-backtrace for more info)
error: generator cannot be sent between threads safely
--> $DIR/issue-57017.rs:30:25
|
LL | assert_send(g);
| ^ generator is not `Send`
...
LL | / type_combinations!(
LL | | copy => { #[derive(Copy, Clone, Default)] pub struct Client; };
LL | | derived_drop => { #[derive(Default)] pub struct Client { pub nickname: String } };
LL | | significant_drop => {
... |
LL | | }
LL | | );
| |_____- in this macro invocation
|
= help: the trait `Sync` is not implemented for `significant_drop::unsync::Client`
note: generator is not `Send` as this value is used across a yield
--> $DIR/issue-57017.rs:28:28
|
LL | let g = move || match drop(&$name::unsync::Client::default()) {
| --------------------------------- has type `&significant_drop::unsync::Client` which is not `Send`
LL | _status => yield,
| ^^^^^ yield occurs here, with `&$name::unsync::Client::default()` maybe used later
LL | };
| - `&$name::unsync::Client::default()` is later dropped here
...
LL | / type_combinations!(
LL | | copy => { #[derive(Copy, Clone, Default)] pub struct Client; };
LL | | derived_drop => { #[derive(Default)] pub struct Client { pub nickname: String } };
LL | | significant_drop => {
... |
LL | | }
LL | | );
| |_____- in this macro invocation
note: required by a bound in `assert_send`
--> $DIR/issue-57017.rs:50:19
|
LL | fn assert_send<T: Send>(_thing: T) {}
| ^^^^ required by this bound in `assert_send`
= note: this error originates in the macro `type_combinations` (in Nightly builds, run with -Z macro-backtrace for more info)
error: generator cannot be sent between threads safely
--> $DIR/issue-57017.rs:42:25
|
LL | assert_send(g);
| ^ generator is not `Send`
...
LL | / type_combinations!(
LL | | copy => { #[derive(Copy, Clone, Default)] pub struct Client; };
LL | | derived_drop => { #[derive(Default)] pub struct Client { pub nickname: String } };
LL | | significant_drop => {
... |
LL | | }
LL | | );
| |_____- in this macro invocation
|
= help: within `[generator@$DIR/issue-57017.rs:39:21: 39:28]`, the trait `Send` is not implemented for `significant_drop::unsend::Client`
note: generator is not `Send` as this value is used across a yield
--> $DIR/issue-57017.rs:40:28
|
LL | let g = move || match drop($name::unsend::Client::default()) {
| -------------------------------- has type `significant_drop::unsend::Client` which is not `Send`
LL | _status => yield,
| ^^^^^ yield occurs here, with `$name::unsend::Client::default()` maybe used later
LL | };
| - `$name::unsend::Client::default()` is later dropped here
...
LL | / type_combinations!(
LL | | copy => { #[derive(Copy, Clone, Default)] pub struct Client; };
LL | | derived_drop => { #[derive(Default)] pub struct Client { pub nickname: String } };
LL | | significant_drop => {
... |
LL | | }
LL | | );
| |_____- in this macro invocation
note: required by a bound in `assert_send`
--> $DIR/issue-57017.rs:50:19
|
LL | fn assert_send<T: Send>(_thing: T) {}
| ^^^^ required by this bound in `assert_send`
= note: this error originates in the macro `type_combinations` (in Nightly builds, run with -Z macro-backtrace for more info)
error: aborting due to 6 previous errors

View File

@ -1,5 +1,5 @@
error: generator cannot be sent between threads safely
--> $DIR/issue-57017.rs:30:25
--> $DIR/issue-57017.rs:31:25
|
LL | assert_send(g);
| ^ generator is not `Send`
@ -15,7 +15,7 @@ LL | | );
|
= help: the trait `Sync` is not implemented for `copy::unsync::Client`
note: generator is not `Send` as this value is used across a yield
--> $DIR/issue-57017.rs:28:28
--> $DIR/issue-57017.rs:29:28
|
LL | let g = move || match drop(&$name::unsync::Client::default()) {
| --------------------------------- has type `&copy::unsync::Client` which is not `Send`
@ -33,14 +33,14 @@ LL | | }
LL | | );
| |_____- in this macro invocation
note: required by a bound in `assert_send`
--> $DIR/issue-57017.rs:50:19
--> $DIR/issue-57017.rs:51:19
|
LL | fn assert_send<T: Send>(_thing: T) {}
| ^^^^ required by this bound in `assert_send`
= note: this error originates in the macro `type_combinations` (in Nightly builds, run with -Z macro-backtrace for more info)
error: generator cannot be sent between threads safely
--> $DIR/issue-57017.rs:42:25
--> $DIR/issue-57017.rs:43:25
|
LL | assert_send(g);
| ^ generator is not `Send`
@ -54,9 +54,9 @@ LL | | }
LL | | );
| |_____- in this macro invocation
|
= help: within `[generator@$DIR/issue-57017.rs:39:21: 39:28]`, the trait `Send` is not implemented for `copy::unsend::Client`
= help: within `[generator@$DIR/issue-57017.rs:40:21: 40:28]`, the trait `Send` is not implemented for `copy::unsend::Client`
note: generator is not `Send` as this value is used across a yield
--> $DIR/issue-57017.rs:40:28
--> $DIR/issue-57017.rs:41:28
|
LL | let g = move || match drop($name::unsend::Client::default()) {
| -------------------------------- has type `copy::unsend::Client` which is not `Send`
@ -74,14 +74,14 @@ LL | | }
LL | | );
| |_____- in this macro invocation
note: required by a bound in `assert_send`
--> $DIR/issue-57017.rs:50:19
--> $DIR/issue-57017.rs:51:19
|
LL | fn assert_send<T: Send>(_thing: T) {}
| ^^^^ required by this bound in `assert_send`
= note: this error originates in the macro `type_combinations` (in Nightly builds, run with -Z macro-backtrace for more info)
error: generator cannot be sent between threads safely
--> $DIR/issue-57017.rs:30:25
--> $DIR/issue-57017.rs:31:25
|
LL | assert_send(g);
| ^ generator is not `Send`
@ -97,7 +97,7 @@ LL | | );
|
= help: the trait `Sync` is not implemented for `derived_drop::unsync::Client`
note: generator is not `Send` as this value is used across a yield
--> $DIR/issue-57017.rs:28:28
--> $DIR/issue-57017.rs:29:28
|
LL | let g = move || match drop(&$name::unsync::Client::default()) {
| --------------------------------- has type `&derived_drop::unsync::Client` which is not `Send`
@ -115,14 +115,14 @@ LL | | }
LL | | );
| |_____- in this macro invocation
note: required by a bound in `assert_send`
--> $DIR/issue-57017.rs:50:19
--> $DIR/issue-57017.rs:51:19
|
LL | fn assert_send<T: Send>(_thing: T) {}
| ^^^^ required by this bound in `assert_send`
= note: this error originates in the macro `type_combinations` (in Nightly builds, run with -Z macro-backtrace for more info)
error: generator cannot be sent between threads safely
--> $DIR/issue-57017.rs:42:25
--> $DIR/issue-57017.rs:43:25
|
LL | assert_send(g);
| ^ generator is not `Send`
@ -136,9 +136,9 @@ LL | | }
LL | | );
| |_____- in this macro invocation
|
= help: within `[generator@$DIR/issue-57017.rs:39:21: 39:28]`, the trait `Send` is not implemented for `derived_drop::unsend::Client`
= help: within `[generator@$DIR/issue-57017.rs:40:21: 40:28]`, the trait `Send` is not implemented for `derived_drop::unsend::Client`
note: generator is not `Send` as this value is used across a yield
--> $DIR/issue-57017.rs:40:28
--> $DIR/issue-57017.rs:41:28
|
LL | let g = move || match drop($name::unsend::Client::default()) {
| -------------------------------- has type `derived_drop::unsend::Client` which is not `Send`
@ -156,14 +156,14 @@ LL | | }
LL | | );
| |_____- in this macro invocation
note: required by a bound in `assert_send`
--> $DIR/issue-57017.rs:50:19
--> $DIR/issue-57017.rs:51:19
|
LL | fn assert_send<T: Send>(_thing: T) {}
| ^^^^ required by this bound in `assert_send`
= note: this error originates in the macro `type_combinations` (in Nightly builds, run with -Z macro-backtrace for more info)
error: generator cannot be sent between threads safely
--> $DIR/issue-57017.rs:30:25
--> $DIR/issue-57017.rs:31:25
|
LL | assert_send(g);
| ^ generator is not `Send`
@ -179,7 +179,7 @@ LL | | );
|
= help: the trait `Sync` is not implemented for `significant_drop::unsync::Client`
note: generator is not `Send` as this value is used across a yield
--> $DIR/issue-57017.rs:28:28
--> $DIR/issue-57017.rs:29:28
|
LL | let g = move || match drop(&$name::unsync::Client::default()) {
| --------------------------------- has type `&significant_drop::unsync::Client` which is not `Send`
@ -197,14 +197,14 @@ LL | | }
LL | | );
| |_____- in this macro invocation
note: required by a bound in `assert_send`
--> $DIR/issue-57017.rs:50:19
--> $DIR/issue-57017.rs:51:19
|
LL | fn assert_send<T: Send>(_thing: T) {}
| ^^^^ required by this bound in `assert_send`
= note: this error originates in the macro `type_combinations` (in Nightly builds, run with -Z macro-backtrace for more info)
error: generator cannot be sent between threads safely
--> $DIR/issue-57017.rs:42:25
--> $DIR/issue-57017.rs:43:25
|
LL | assert_send(g);
| ^ generator is not `Send`
@ -218,9 +218,9 @@ LL | | }
LL | | );
| |_____- in this macro invocation
|
= help: within `[generator@$DIR/issue-57017.rs:39:21: 39:28]`, the trait `Send` is not implemented for `significant_drop::unsend::Client`
= help: within `[generator@$DIR/issue-57017.rs:40:21: 40:28]`, the trait `Send` is not implemented for `significant_drop::unsend::Client`
note: generator is not `Send` as this value is used across a yield
--> $DIR/issue-57017.rs:40:28
--> $DIR/issue-57017.rs:41:28
|
LL | let g = move || match drop($name::unsend::Client::default()) {
| -------------------------------- has type `significant_drop::unsend::Client` which is not `Send`
@ -238,7 +238,7 @@ LL | | }
LL | | );
| |_____- in this macro invocation
note: required by a bound in `assert_send`
--> $DIR/issue-57017.rs:50:19
--> $DIR/issue-57017.rs:51:19
|
LL | fn assert_send<T: Send>(_thing: T) {}
| ^^^^ required by this bound in `assert_send`

View File

@ -2,6 +2,7 @@
// [drop_tracking] compile-flags: -Zdrop-tracking
// [drop_tracking_mir] compile-flags: -Zdrop-tracking-mir
// [drop_tracking] build-pass
// [drop_tracking_mir] build-pass
#![feature(generators, negative_impls)]
@ -28,9 +29,9 @@ macro_rules! type_combinations {
_status => yield,
};
assert_send(g);
//[no_drop_tracking,drop_tracking_mir]~^ ERROR generator cannot be sent between threads safely
//[no_drop_tracking,drop_tracking_mir]~| ERROR generator cannot be sent between threads safely
//[no_drop_tracking,drop_tracking_mir]~| ERROR generator cannot be sent between threads safely
//[no_drop_tracking]~^ ERROR generator cannot be sent between threads safely
//[no_drop_tracking]~| ERROR generator cannot be sent between threads safely
//[no_drop_tracking]~| ERROR generator cannot be sent between threads safely
}
// This tests that `Client` is properly considered to be dropped after moving it into the
@ -40,9 +41,9 @@ macro_rules! type_combinations {
_status => yield,
};
assert_send(g);
//[no_drop_tracking,drop_tracking_mir]~^ ERROR generator cannot be sent between threads safely
//[no_drop_tracking,drop_tracking_mir]~| ERROR generator cannot be sent between threads safely
//[no_drop_tracking,drop_tracking_mir]~| ERROR generator cannot be sent between threads safely
//[no_drop_tracking]~^ ERROR generator cannot be sent between threads safely
//[no_drop_tracking]~| ERROR generator cannot be sent between threads safely
//[no_drop_tracking]~| ERROR generator cannot be sent between threads safely
}
)* }
}

View File

@ -1,32 +0,0 @@
error: generator cannot be sent between threads safely
--> $DIR/issue-57478.rs:12:17
|
LL | assert_send(|| {
| _________________^
LL | |
LL | |
LL | | let guard = Foo;
LL | | drop(guard);
LL | | yield;
LL | | })
| |_____^ generator is not `Send`
|
= help: within `[generator@$DIR/issue-57478.rs:12:17: 12:19]`, the trait `Send` is not implemented for `Foo`
note: generator is not `Send` as this value is used across a yield
--> $DIR/issue-57478.rs:17:9
|
LL | let guard = Foo;
| ----- has type `Foo` which is not `Send`
LL | drop(guard);
LL | yield;
| ^^^^^ yield occurs here, with `guard` maybe used later
LL | })
| - `guard` is later dropped here
note: required by a bound in `assert_send`
--> $DIR/issue-57478.rs:21:19
|
LL | fn assert_send<T: Send>(_: T) {}
| ^^^^ required by this bound in `assert_send`
error: aborting due to previous error

View File

@ -1,17 +1,16 @@
error: generator cannot be sent between threads safely
--> $DIR/issue-57478.rs:12:17
--> $DIR/issue-57478.rs:13:17
|
LL | assert_send(|| {
| _________________^
LL | |
LL | |
LL | | let guard = Foo;
LL | | drop(guard);
LL | | yield;
LL | | })
| |_____^ generator is not `Send`
|
= help: within `[generator@$DIR/issue-57478.rs:12:17: 12:19]`, the trait `Send` is not implemented for `Foo`
= help: within `[generator@$DIR/issue-57478.rs:13:17: 13:19]`, the trait `Send` is not implemented for `Foo`
note: generator is not `Send` as this value is used across a yield
--> $DIR/issue-57478.rs:17:9
|

View File

@ -2,6 +2,7 @@
// [drop_tracking] compile-flags: -Zdrop-tracking
// [drop_tracking_mir] compile-flags: -Zdrop-tracking-mir
// [drop_tracking] check-pass
// [drop_tracking_mir] check-pass
#![feature(negative_impls, generators)]
@ -11,7 +12,6 @@ impl !Send for Foo {}
fn main() {
assert_send(|| {
//[no_drop_tracking]~^ ERROR generator cannot be sent between threads safely
//[drop_tracking_mir]~^^ ERROR generator cannot be sent between threads safely
let guard = Foo;
drop(guard);
yield;

View File

@ -1,8 +1,8 @@
error: generator cannot be sent between threads safely
--> $DIR/issue-68112.rs:43:18
--> $DIR/issue-68112.rs:43:5
|
LL | require_send(send_gen);
| ^^^^^^^^ generator is not `Send`
| ^^^^^^^^^^^^ generator is not `Send`
|
= help: the trait `Sync` is not implemented for `RefCell<i32>`
= note: if you want to do aliasing and mutation between multiple threads, use `std::sync::RwLock` instead
@ -14,9 +14,6 @@ LL | let _non_send_gen = make_non_send_generator();
LL |
LL | yield;
| ^^^^^ yield occurs here, with `_non_send_gen` maybe used later
...
LL | };
| - `_non_send_gen` is later dropped here
note: required by a bound in `require_send`
--> $DIR/issue-68112.rs:25:25
|
@ -24,12 +21,10 @@ LL | fn require_send(_: impl Send) {}
| ^^^^ required by this bound in `require_send`
error[E0277]: `RefCell<i32>` cannot be shared between threads safely
--> $DIR/issue-68112.rs:67:18
--> $DIR/issue-68112.rs:67:5
|
LL | require_send(send_gen);
| ------------ ^^^^^^^^ `RefCell<i32>` cannot be shared between threads safely
| |
| required by a bound introduced by this call
| ^^^^^^^^^^^^ `RefCell<i32>` cannot be shared between threads safely
|
= help: the trait `Sync` is not implemented for `RefCell<i32>`
= note: if you want to do aliasing and mutation between multiple threads, use `std::sync::RwLock` instead
@ -49,7 +44,7 @@ note: required because it appears within the type `impl Generator<Return = Arc<R
|
LL | fn make_non_send_generator2() -> impl Generator<Return = Arc<RefCell<i32>>> {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
= note: required because it captures the following types: `impl Generator<Return = Arc<RefCell<i32>>>`, `()`
= note: required because it captures the following types: `impl Generator<Return = Arc<RefCell<i32>>>`
note: required because it's used within this generator
--> $DIR/issue-68112.rs:63:20
|

View File

@ -11,7 +11,7 @@ use std::{
};
pub struct Ready<T>(Option<T>);
impl<T> Generator<()> for Ready<T> {
impl<T: Unpin> Generator<()> for Ready<T> {
type Return = T;
type Yield = ();
fn resume(mut self: Pin<&mut Self>, _args: ()) -> GeneratorState<(), T> {
@ -39,7 +39,7 @@ fn test1() {
yield;
//~^ NOTE yield occurs here
//~| NOTE value is used across a yield
}; //~ NOTE later dropped here
}; //[no_drop_tracking,drop_tracking]~ NOTE later dropped here
require_send(send_gen);
//~^ ERROR generator cannot be sent between threads
//~| NOTE not `Send`
@ -68,7 +68,7 @@ fn test2() {
//~^ ERROR `RefCell<i32>` cannot be shared between threads safely
//~| NOTE `RefCell<i32>` cannot be shared between threads safely
//~| NOTE required for
//~| NOTE required by a bound introduced by this call
//[no_drop_tracking,drop_tracking]~| NOTE required by a bound introduced by this call
//~| NOTE captures the following types
//~| NOTE use `std::sync::RwLock` instead
}

View File

@ -1,58 +1,60 @@
error[E0277]: `Cell<i32>` cannot be shared between threads safely
--> $DIR/not-send-sync.rs:19:17
|
LL | assert_send(|| {
| _____-----------_^
| | |
| | required by a bound introduced by this call
LL | |
LL | | drop(&a);
LL | | yield;
LL | | });
| |_____^ `Cell<i32>` cannot be shared between threads safely
|
= help: the trait `Sync` is not implemented for `Cell<i32>`
= note: if you want to do aliasing and mutation between multiple threads, use `std::sync::RwLock` or `std::sync::atomic::AtomicI32` instead
= note: required for `&Cell<i32>` to implement `Send`
note: required because it's used within this generator
--> $DIR/not-send-sync.rs:19:17
|
LL | assert_send(|| {
| ^^
note: required by a bound in `assert_send`
--> $DIR/not-send-sync.rs:10:23
|
LL | fn assert_send<T: Send>(_: T) {}
| ^^^^ required by this bound in `assert_send`
error: generator cannot be shared between threads safely
--> $DIR/not-send-sync.rs:12:17
--> $DIR/not-send-sync.rs:17:17
|
LL | assert_sync(|| {
| _________________^
LL | |
LL | | let a = Cell::new(2);
LL | | let a = NotSync;
LL | | yield;
LL | | drop(a);
LL | | });
| |_____^ generator is not `Sync`
|
= help: within `[generator@$DIR/not-send-sync.rs:12:17: 12:19]`, the trait `Sync` is not implemented for `Cell<i32>`
= note: if you want to do aliasing and mutation between multiple threads, use `std::sync::RwLock` or `std::sync::atomic::AtomicI32` instead
= help: within `[generator@$DIR/not-send-sync.rs:17:17: 17:19]`, the trait `Sync` is not implemented for `NotSync`
note: generator is not `Sync` as this value is used across a yield
--> $DIR/not-send-sync.rs:15:9
--> $DIR/not-send-sync.rs:20:9
|
LL | let a = Cell::new(2);
| - has type `Cell<i32>` which is not `Sync`
LL | let a = NotSync;
| - has type `NotSync` which is not `Sync`
LL | yield;
| ^^^^^ yield occurs here, with `a` maybe used later
LL | drop(a);
LL | });
| - `a` is later dropped here
note: required by a bound in `assert_sync`
--> $DIR/not-send-sync.rs:9:23
--> $DIR/not-send-sync.rs:14:23
|
LL | fn assert_sync<T: Sync>(_: T) {}
| ^^^^ required by this bound in `assert_sync`
error: generator cannot be sent between threads safely
--> $DIR/not-send-sync.rs:24:17
|
LL | assert_send(|| {
| _________________^
LL | |
LL | | let a = NotSend;
LL | | yield;
LL | | drop(a);
LL | | });
| |_____^ generator is not `Send`
|
= help: within `[generator@$DIR/not-send-sync.rs:24:17: 24:19]`, the trait `Send` is not implemented for `NotSend`
note: generator is not `Send` as this value is used across a yield
--> $DIR/not-send-sync.rs:27:9
|
LL | let a = NotSend;
| - has type `NotSend` which is not `Send`
LL | yield;
| ^^^^^ yield occurs here, with `a` maybe used later
LL | drop(a);
LL | });
| - `a` is later dropped here
note: required by a bound in `assert_send`
--> $DIR/not-send-sync.rs:15:23
|
LL | fn assert_send<T: Send>(_: T) {}
| ^^^^ required by this bound in `assert_send`
error: aborting due to 2 previous errors
For more information about this error, try `rustc --explain E0277`.

View File

@ -1,58 +1,42 @@
error[E0277]: `Cell<i32>` cannot be shared between threads safely
--> $DIR/not-send-sync.rs:19:17
|
LL | assert_send(|| {
| _____-----------_^
| | |
| | required by a bound introduced by this call
LL | |
LL | | drop(&a);
LL | | yield;
LL | | });
| |_____^ `Cell<i32>` cannot be shared between threads safely
|
= help: the trait `Sync` is not implemented for `Cell<i32>`
= note: if you want to do aliasing and mutation between multiple threads, use `std::sync::RwLock` or `std::sync::atomic::AtomicI32` instead
= note: required for `&Cell<i32>` to implement `Send`
note: required because it's used within this generator
--> $DIR/not-send-sync.rs:19:17
|
LL | assert_send(|| {
| ^^
note: required by a bound in `assert_send`
--> $DIR/not-send-sync.rs:10:23
|
LL | fn assert_send<T: Send>(_: T) {}
| ^^^^ required by this bound in `assert_send`
error: generator cannot be shared between threads safely
--> $DIR/not-send-sync.rs:12:17
--> $DIR/not-send-sync.rs:17:5
|
LL | assert_sync(|| {
| _________________^
LL | |
LL | | let a = Cell::new(2);
LL | | yield;
LL | | });
| |_____^ generator is not `Sync`
LL | assert_sync(|| {
| ^^^^^^^^^^^ generator is not `Sync`
|
= help: within `[generator@$DIR/not-send-sync.rs:12:17: 12:19]`, the trait `Sync` is not implemented for `Cell<i32>`
= note: if you want to do aliasing and mutation between multiple threads, use `std::sync::RwLock` or `std::sync::atomic::AtomicI32` instead
= help: within `[generator@$DIR/not-send-sync.rs:17:17: 17:19]`, the trait `Sync` is not implemented for `NotSync`
note: generator is not `Sync` as this value is used across a yield
--> $DIR/not-send-sync.rs:15:9
--> $DIR/not-send-sync.rs:20:9
|
LL | let a = Cell::new(2);
| - has type `Cell<i32>` which is not `Sync`
LL | let a = NotSync;
| - has type `NotSync` which is not `Sync`
LL | yield;
| ^^^^^ yield occurs here, with `a` maybe used later
LL | });
| - `a` is later dropped here
note: required by a bound in `assert_sync`
--> $DIR/not-send-sync.rs:9:23
--> $DIR/not-send-sync.rs:14:23
|
LL | fn assert_sync<T: Sync>(_: T) {}
| ^^^^ required by this bound in `assert_sync`
error: generator cannot be sent between threads safely
--> $DIR/not-send-sync.rs:24:5
|
LL | assert_send(|| {
| ^^^^^^^^^^^ generator is not `Send`
|
= help: within `[generator@$DIR/not-send-sync.rs:24:17: 24:19]`, the trait `Send` is not implemented for `NotSend`
note: generator is not `Send` as this value is used across a yield
--> $DIR/not-send-sync.rs:27:9
|
LL | let a = NotSend;
| - has type `NotSend` which is not `Send`
LL | yield;
| ^^^^^ yield occurs here, with `a` maybe used later
note: required by a bound in `assert_send`
--> $DIR/not-send-sync.rs:15:23
|
LL | fn assert_send<T: Send>(_: T) {}
| ^^^^ required by this bound in `assert_send`
error: aborting due to 2 previous errors
For more information about this error, try `rustc --explain E0277`.

View File

@ -1,58 +1,60 @@
error[E0277]: `Cell<i32>` cannot be shared between threads safely
--> $DIR/not-send-sync.rs:19:17
|
LL | assert_send(|| {
| _____-----------_^
| | |
| | required by a bound introduced by this call
LL | |
LL | | drop(&a);
LL | | yield;
LL | | });
| |_____^ `Cell<i32>` cannot be shared between threads safely
|
= help: the trait `Sync` is not implemented for `Cell<i32>`
= note: if you want to do aliasing and mutation between multiple threads, use `std::sync::RwLock` or `std::sync::atomic::AtomicI32` instead
= note: required for `&Cell<i32>` to implement `Send`
note: required because it's used within this generator
--> $DIR/not-send-sync.rs:19:17
|
LL | assert_send(|| {
| ^^
note: required by a bound in `assert_send`
--> $DIR/not-send-sync.rs:10:23
|
LL | fn assert_send<T: Send>(_: T) {}
| ^^^^ required by this bound in `assert_send`
error: generator cannot be shared between threads safely
--> $DIR/not-send-sync.rs:12:17
--> $DIR/not-send-sync.rs:17:17
|
LL | assert_sync(|| {
| _________________^
LL | |
LL | | let a = Cell::new(2);
LL | | let a = NotSync;
LL | | yield;
LL | | drop(a);
LL | | });
| |_____^ generator is not `Sync`
|
= help: within `[generator@$DIR/not-send-sync.rs:12:17: 12:19]`, the trait `Sync` is not implemented for `Cell<i32>`
= note: if you want to do aliasing and mutation between multiple threads, use `std::sync::RwLock` or `std::sync::atomic::AtomicI32` instead
= help: within `[generator@$DIR/not-send-sync.rs:17:17: 17:19]`, the trait `Sync` is not implemented for `NotSync`
note: generator is not `Sync` as this value is used across a yield
--> $DIR/not-send-sync.rs:15:9
--> $DIR/not-send-sync.rs:20:9
|
LL | let a = Cell::new(2);
| - has type `Cell<i32>` which is not `Sync`
LL | let a = NotSync;
| - has type `NotSync` which is not `Sync`
LL | yield;
| ^^^^^ yield occurs here, with `a` maybe used later
LL | drop(a);
LL | });
| - `a` is later dropped here
note: required by a bound in `assert_sync`
--> $DIR/not-send-sync.rs:9:23
--> $DIR/not-send-sync.rs:14:23
|
LL | fn assert_sync<T: Sync>(_: T) {}
| ^^^^ required by this bound in `assert_sync`
error: generator cannot be sent between threads safely
--> $DIR/not-send-sync.rs:24:17
|
LL | assert_send(|| {
| _________________^
LL | |
LL | | let a = NotSend;
LL | | yield;
LL | | drop(a);
LL | | });
| |_____^ generator is not `Send`
|
= help: within `[generator@$DIR/not-send-sync.rs:24:17: 24:19]`, the trait `Send` is not implemented for `NotSend`
note: generator is not `Send` as this value is used across a yield
--> $DIR/not-send-sync.rs:27:9
|
LL | let a = NotSend;
| - has type `NotSend` which is not `Send`
LL | yield;
| ^^^^^ yield occurs here, with `a` maybe used later
LL | drop(a);
LL | });
| - `a` is later dropped here
note: required by a bound in `assert_send`
--> $DIR/not-send-sync.rs:15:23
|
LL | fn assert_send<T: Send>(_: T) {}
| ^^^^ required by this bound in `assert_send`
error: aborting due to 2 previous errors
For more information about this error, try `rustc --explain E0277`.

View File

@ -2,8 +2,13 @@
// [drop_tracking] compile-flags: -Zdrop-tracking
// [drop_tracking_mir] compile-flags: -Zdrop-tracking-mir
#![feature(generators)]
#![feature(negative_impls)]
use std::cell::Cell;
struct NotSend;
struct NotSync;
impl !Send for NotSend {}
impl !Sync for NotSync {}
fn main() {
fn assert_sync<T: Sync>(_: T) {}
@ -11,14 +16,15 @@ fn main() {
assert_sync(|| {
//~^ ERROR: generator cannot be shared between threads safely
let a = Cell::new(2);
let a = NotSync;
yield;
drop(a);
});
let a = Cell::new(2);
assert_send(|| {
//~^ ERROR: E0277
drop(&a);
//~^ ERROR: generator cannot be sent between threads safely
let a = NotSend;
yield;
drop(a);
});
}

View File

@ -1,91 +1,8 @@
error: generator cannot be sent between threads safely
--> $DIR/parent-expression.rs:27:25
--> $DIR/parent-expression.rs:27:13
|
LL | assert_send(g);
| ^ generator is not `Send`
...
LL | / type_combinations!(
LL | | // OK
LL | | copy => { #[derive(Copy, Clone, Default)] pub struct Client; };
LL | | // NOT OK: MIR borrowck thinks that this is used after the yield, even though
... |
LL | | };
LL | | );
| |_____- in this macro invocation
|
= help: within `[generator@$DIR/parent-expression.rs:21:21: 21:28]`, the trait `Send` is not implemented for `copy::Client`
note: generator is not `Send` as this value is used across a yield
--> $DIR/parent-expression.rs:25:22
|
LL | let g = move || match drop($name::Client { ..$name::Client::default() }) {
| ------------------------ has type `copy::Client` which is not `Send`
...
LL | _ => yield,
| ^^^^^ yield occurs here, with `$name::Client::default()` maybe used later
LL | };
| - `$name::Client::default()` is later dropped here
...
LL | / type_combinations!(
LL | | // OK
LL | | copy => { #[derive(Copy, Clone, Default)] pub struct Client; };
LL | | // NOT OK: MIR borrowck thinks that this is used after the yield, even though
... |
LL | | };
LL | | );
| |_____- in this macro invocation
note: required by a bound in `assert_send`
--> $DIR/parent-expression.rs:49:19
|
LL | fn assert_send<T: Send>(_thing: T) {}
| ^^^^ required by this bound in `assert_send`
= note: this error originates in the macro `type_combinations` (in Nightly builds, run with -Z macro-backtrace for more info)
error: generator cannot be sent between threads safely
--> $DIR/parent-expression.rs:40:25
|
LL | assert_send(g);
| ^ generator is not `Send`
...
LL | / type_combinations!(
LL | | // OK
LL | | copy => { #[derive(Copy, Clone, Default)] pub struct Client; };
LL | | // NOT OK: MIR borrowck thinks that this is used after the yield, even though
... |
LL | | };
LL | | );
| |_____- in this macro invocation
|
= help: within `[generator@$DIR/parent-expression.rs:37:21: 37:28]`, the trait `Send` is not implemented for `copy::Client`
note: generator is not `Send` as this value is used across a yield
--> $DIR/parent-expression.rs:38:22
|
LL | let g = move || match drop($name::Client::default()) {
| ------------------------ has type `copy::Client` which is not `Send`
LL | _ => yield,
| ^^^^^ yield occurs here, with `$name::Client::default()` maybe used later
LL | };
| - `$name::Client::default()` is later dropped here
...
LL | / type_combinations!(
LL | | // OK
LL | | copy => { #[derive(Copy, Clone, Default)] pub struct Client; };
LL | | // NOT OK: MIR borrowck thinks that this is used after the yield, even though
... |
LL | | };
LL | | );
| |_____- in this macro invocation
note: required by a bound in `assert_send`
--> $DIR/parent-expression.rs:49:19
|
LL | fn assert_send<T: Send>(_thing: T) {}
| ^^^^ required by this bound in `assert_send`
= note: this error originates in the macro `type_combinations` (in Nightly builds, run with -Z macro-backtrace for more info)
error: generator cannot be sent between threads safely
--> $DIR/parent-expression.rs:27:25
|
LL | assert_send(g);
| ^ generator is not `Send`
| ^^^^^^^^^^^ generator is not `Send`
...
LL | / type_combinations!(
LL | | // OK
@ -105,8 +22,6 @@ LL | let g = move || match drop($name::Client { ..$name::Client::d
...
LL | _ => yield,
| ^^^^^ yield occurs here, with `$name::Client::default()` maybe used later
LL | };
| - `$name::Client::default()` is later dropped here
...
LL | / type_combinations!(
LL | | // OK
@ -124,51 +39,10 @@ LL | fn assert_send<T: Send>(_thing: T) {}
= note: this error originates in the macro `type_combinations` (in Nightly builds, run with -Z macro-backtrace for more info)
error: generator cannot be sent between threads safely
--> $DIR/parent-expression.rs:40:25
--> $DIR/parent-expression.rs:27:13
|
LL | assert_send(g);
| ^ generator is not `Send`
...
LL | / type_combinations!(
LL | | // OK
LL | | copy => { #[derive(Copy, Clone, Default)] pub struct Client; };
LL | | // NOT OK: MIR borrowck thinks that this is used after the yield, even though
... |
LL | | };
LL | | );
| |_____- in this macro invocation
|
= help: within `[generator@$DIR/parent-expression.rs:37:21: 37:28]`, the trait `Send` is not implemented for `derived_drop::Client`
note: generator is not `Send` as this value is used across a yield
--> $DIR/parent-expression.rs:38:22
|
LL | let g = move || match drop($name::Client::default()) {
| ------------------------ has type `derived_drop::Client` which is not `Send`
LL | _ => yield,
| ^^^^^ yield occurs here, with `$name::Client::default()` maybe used later
LL | };
| - `$name::Client::default()` is later dropped here
...
LL | / type_combinations!(
LL | | // OK
LL | | copy => { #[derive(Copy, Clone, Default)] pub struct Client; };
LL | | // NOT OK: MIR borrowck thinks that this is used after the yield, even though
... |
LL | | };
LL | | );
| |_____- in this macro invocation
note: required by a bound in `assert_send`
--> $DIR/parent-expression.rs:49:19
|
LL | fn assert_send<T: Send>(_thing: T) {}
| ^^^^ required by this bound in `assert_send`
= note: this error originates in the macro `type_combinations` (in Nightly builds, run with -Z macro-backtrace for more info)
error: generator cannot be sent between threads safely
--> $DIR/parent-expression.rs:27:25
|
LL | assert_send(g);
| ^ generator is not `Send`
| ^^^^^^^^^^^ generator is not `Send`
...
LL | / type_combinations!(
LL | | // OK
@ -188,8 +62,6 @@ LL | let g = move || match drop($name::Client { ..$name::Client::d
...
LL | _ => yield,
| ^^^^^ yield occurs here, with `$name::Client::default()` maybe used later
LL | };
| - `$name::Client::default()` is later dropped here
...
LL | / type_combinations!(
LL | | // OK
@ -207,51 +79,10 @@ LL | fn assert_send<T: Send>(_thing: T) {}
= note: this error originates in the macro `type_combinations` (in Nightly builds, run with -Z macro-backtrace for more info)
error: generator cannot be sent between threads safely
--> $DIR/parent-expression.rs:40:25
--> $DIR/parent-expression.rs:27:13
|
LL | assert_send(g);
| ^ generator is not `Send`
...
LL | / type_combinations!(
LL | | // OK
LL | | copy => { #[derive(Copy, Clone, Default)] pub struct Client; };
LL | | // NOT OK: MIR borrowck thinks that this is used after the yield, even though
... |
LL | | };
LL | | );
| |_____- in this macro invocation
|
= help: within `[generator@$DIR/parent-expression.rs:37:21: 37:28]`, the trait `Send` is not implemented for `significant_drop::Client`
note: generator is not `Send` as this value is used across a yield
--> $DIR/parent-expression.rs:38:22
|
LL | let g = move || match drop($name::Client::default()) {
| ------------------------ has type `significant_drop::Client` which is not `Send`
LL | _ => yield,
| ^^^^^ yield occurs here, with `$name::Client::default()` maybe used later
LL | };
| - `$name::Client::default()` is later dropped here
...
LL | / type_combinations!(
LL | | // OK
LL | | copy => { #[derive(Copy, Clone, Default)] pub struct Client; };
LL | | // NOT OK: MIR borrowck thinks that this is used after the yield, even though
... |
LL | | };
LL | | );
| |_____- in this macro invocation
note: required by a bound in `assert_send`
--> $DIR/parent-expression.rs:49:19
|
LL | fn assert_send<T: Send>(_thing: T) {}
| ^^^^ required by this bound in `assert_send`
= note: this error originates in the macro `type_combinations` (in Nightly builds, run with -Z macro-backtrace for more info)
error: generator cannot be sent between threads safely
--> $DIR/parent-expression.rs:27:25
|
LL | assert_send(g);
| ^ generator is not `Send`
| ^^^^^^^^^^^ generator is not `Send`
...
LL | / type_combinations!(
LL | | // OK
@ -271,8 +102,6 @@ LL | let g = move || match drop($name::Client { ..$name::Client::d
...
LL | _ => yield,
| ^^^^^ yield occurs here, with `$name::Client::default()` maybe used later
LL | };
| - `$name::Client::default()` is later dropped here
...
LL | / type_combinations!(
LL | | // OK
@ -289,46 +118,5 @@ LL | fn assert_send<T: Send>(_thing: T) {}
| ^^^^ required by this bound in `assert_send`
= note: this error originates in the macro `type_combinations` (in Nightly builds, run with -Z macro-backtrace for more info)
error: generator cannot be sent between threads safely
--> $DIR/parent-expression.rs:40:25
|
LL | assert_send(g);
| ^ generator is not `Send`
...
LL | / type_combinations!(
LL | | // OK
LL | | copy => { #[derive(Copy, Clone, Default)] pub struct Client; };
LL | | // NOT OK: MIR borrowck thinks that this is used after the yield, even though
... |
LL | | };
LL | | );
| |_____- in this macro invocation
|
= help: within `[generator@$DIR/parent-expression.rs:37:21: 37:28]`, the trait `Send` is not implemented for `insignificant_dtor::Client`
note: generator is not `Send` as this value is used across a yield
--> $DIR/parent-expression.rs:38:22
|
LL | let g = move || match drop($name::Client::default()) {
| ------------------------ has type `insignificant_dtor::Client` which is not `Send`
LL | _ => yield,
| ^^^^^ yield occurs here, with `$name::Client::default()` maybe used later
LL | };
| - `$name::Client::default()` is later dropped here
...
LL | / type_combinations!(
LL | | // OK
LL | | copy => { #[derive(Copy, Clone, Default)] pub struct Client; };
LL | | // NOT OK: MIR borrowck thinks that this is used after the yield, even though
... |
LL | | };
LL | | );
| |_____- in this macro invocation
note: required by a bound in `assert_send`
--> $DIR/parent-expression.rs:49:19
|
LL | fn assert_send<T: Send>(_thing: T) {}
| ^^^^ required by this bound in `assert_send`
= note: this error originates in the macro `type_combinations` (in Nightly builds, run with -Z macro-backtrace for more info)
error: aborting due to 8 previous errors
error: aborting due to 3 previous errors

View File

@ -28,7 +28,7 @@ macro_rules! type_combinations {
//~^ ERROR cannot be sent between threads
//~| ERROR cannot be sent between threads
//~| ERROR cannot be sent between threads
//[no_drop_tracking,drop_tracking_mir]~^^^^ ERROR cannot be sent between threads
//[no_drop_tracking]~^^^^ ERROR cannot be sent between threads
}
// Simple owned value. This works because the Client is considered moved into `drop`,
@ -38,10 +38,10 @@ macro_rules! type_combinations {
_ => yield,
};
assert_send(g);
//[no_drop_tracking,drop_tracking_mir]~^ ERROR cannot be sent between threads
//[no_drop_tracking,drop_tracking_mir]~| ERROR cannot be sent between threads
//[no_drop_tracking,drop_tracking_mir]~| ERROR cannot be sent between threads
//[no_drop_tracking,drop_tracking_mir]~| ERROR cannot be sent between threads
//[no_drop_tracking]~^ ERROR cannot be sent between threads
//[no_drop_tracking]~| ERROR cannot be sent between threads
//[no_drop_tracking]~| ERROR cannot be sent between threads
//[no_drop_tracking]~| ERROR cannot be sent between threads
}
)* }
}

View File

@ -1,17 +1,16 @@
error: generator cannot be sent between threads safely
--> $DIR/partial-drop.rs:16:17
--> $DIR/partial-drop.rs:17:17
|
LL | assert_send(|| {
| _________________^
LL | |
LL | | // FIXME: it would be nice to make this work.
LL | | let guard = Bar { foo: Foo, x: 42 };
LL | | drop(guard.foo);
LL | | yield;
LL | | });
| |_____^ generator is not `Send`
|
= help: within `[generator@$DIR/partial-drop.rs:16:17: 16:19]`, the trait `Send` is not implemented for `Foo`
= help: within `[generator@$DIR/partial-drop.rs:17:17: 17:19]`, the trait `Send` is not implemented for `Foo`
note: generator is not `Send` as this value is used across a yield
--> $DIR/partial-drop.rs:21:9
|
@ -23,7 +22,7 @@ LL | yield;
LL | });
| - `guard` is later dropped here
note: required by a bound in `assert_send`
--> $DIR/partial-drop.rs:44:19
--> $DIR/partial-drop.rs:33:19
|
LL | fn assert_send<T: Send>(_: T) {}
| ^^^^ required by this bound in `assert_send`
@ -34,16 +33,16 @@ error: generator cannot be sent between threads safely
LL | assert_send(|| {
| _________________^
LL | |
LL | | // FIXME: it would be nice to make this work.
LL | | let guard = Bar { foo: Foo, x: 42 };
... |
LL | | let Bar { foo, x } = guard;
LL | | drop(foo);
LL | | yield;
LL | | });
| |_____^ generator is not `Send`
|
= help: within `[generator@$DIR/partial-drop.rs:24:17: 24:19]`, the trait `Send` is not implemented for `Foo`
note: generator is not `Send` as this value is used across a yield
--> $DIR/partial-drop.rs:31:9
--> $DIR/partial-drop.rs:29:9
|
LL | let guard = Bar { foo: Foo, x: 42 };
| ----- has type `Bar` which is not `Send`
@ -53,40 +52,10 @@ LL | yield;
LL | });
| - `guard` is later dropped here
note: required by a bound in `assert_send`
--> $DIR/partial-drop.rs:44:19
--> $DIR/partial-drop.rs:33:19
|
LL | fn assert_send<T: Send>(_: T) {}
| ^^^^ required by this bound in `assert_send`
error: generator cannot be sent between threads safely
--> $DIR/partial-drop.rs:34:17
|
LL | assert_send(|| {
| _________________^
LL | |
LL | | // FIXME: it would be nice to make this work.
LL | | let guard = Bar { foo: Foo, x: 42 };
... |
LL | | yield;
LL | | });
| |_____^ generator is not `Send`
|
= help: within `[generator@$DIR/partial-drop.rs:34:17: 34:19]`, the trait `Send` is not implemented for `Foo`
note: generator is not `Send` as this value is used across a yield
--> $DIR/partial-drop.rs:40:9
|
LL | let guard = Bar { foo: Foo, x: 42 };
| ----- has type `Bar` which is not `Send`
...
LL | yield;
| ^^^^^ yield occurs here, with `guard` maybe used later
LL | });
| - `guard` is later dropped here
note: required by a bound in `assert_send`
--> $DIR/partial-drop.rs:44:19
|
LL | fn assert_send<T: Send>(_: T) {}
| ^^^^ required by this bound in `assert_send`
error: aborting due to 3 previous errors
error: aborting due to 2 previous errors

View File

@ -1,92 +0,0 @@
error: generator cannot be sent between threads safely
--> $DIR/partial-drop.rs:16:17
|
LL | assert_send(|| {
| _________________^
LL | |
LL | | // FIXME: it would be nice to make this work.
LL | | let guard = Bar { foo: Foo, x: 42 };
LL | | drop(guard.foo);
LL | | yield;
LL | | });
| |_____^ generator is not `Send`
|
= help: within `[generator@$DIR/partial-drop.rs:16:17: 16:19]`, the trait `Send` is not implemented for `Foo`
note: generator is not `Send` as this value is used across a yield
--> $DIR/partial-drop.rs:21:9
|
LL | let guard = Bar { foo: Foo, x: 42 };
| ----- has type `Bar` which is not `Send`
LL | drop(guard.foo);
LL | yield;
| ^^^^^ yield occurs here, with `guard` maybe used later
LL | });
| - `guard` is later dropped here
note: required by a bound in `assert_send`
--> $DIR/partial-drop.rs:44:19
|
LL | fn assert_send<T: Send>(_: T) {}
| ^^^^ required by this bound in `assert_send`
error: generator cannot be sent between threads safely
--> $DIR/partial-drop.rs:24:17
|
LL | assert_send(|| {
| _________________^
LL | |
LL | | // FIXME: it would be nice to make this work.
LL | | let guard = Bar { foo: Foo, x: 42 };
... |
LL | | yield;
LL | | });
| |_____^ generator is not `Send`
|
= help: within `[generator@$DIR/partial-drop.rs:24:17: 24:19]`, the trait `Send` is not implemented for `Foo`
note: generator is not `Send` as this value is used across a yield
--> $DIR/partial-drop.rs:31:9
|
LL | let guard = Bar { foo: Foo, x: 42 };
| ----- has type `Bar` which is not `Send`
...
LL | yield;
| ^^^^^ yield occurs here, with `guard` maybe used later
LL | });
| - `guard` is later dropped here
note: required by a bound in `assert_send`
--> $DIR/partial-drop.rs:44:19
|
LL | fn assert_send<T: Send>(_: T) {}
| ^^^^ required by this bound in `assert_send`
error: generator cannot be sent between threads safely
--> $DIR/partial-drop.rs:34:17
|
LL | assert_send(|| {
| _________________^
LL | |
LL | | // FIXME: it would be nice to make this work.
LL | | let guard = Bar { foo: Foo, x: 42 };
... |
LL | | yield;
LL | | });
| |_____^ generator is not `Send`
|
= help: within `[generator@$DIR/partial-drop.rs:34:17: 34:19]`, the trait `Send` is not implemented for `Foo`
note: generator is not `Send` as this value is used across a yield
--> $DIR/partial-drop.rs:40:9
|
LL | let Bar { foo, x } = guard;
| --- has type `Foo` which is not `Send`
LL | drop(foo);
LL | yield;
| ^^^^^ yield occurs here, with `foo` maybe used later
LL | });
| - `foo` is later dropped here
note: required by a bound in `assert_send`
--> $DIR/partial-drop.rs:44:19
|
LL | fn assert_send<T: Send>(_: T) {}
| ^^^^ required by this bound in `assert_send`
error: aborting due to 3 previous errors

View File

@ -1,17 +1,16 @@
error: generator cannot be sent between threads safely
--> $DIR/partial-drop.rs:16:17
--> $DIR/partial-drop.rs:17:17
|
LL | assert_send(|| {
| _________________^
LL | |
LL | | // FIXME: it would be nice to make this work.
LL | | let guard = Bar { foo: Foo, x: 42 };
LL | | drop(guard.foo);
LL | | yield;
LL | | });
| |_____^ generator is not `Send`
|
= help: within `[generator@$DIR/partial-drop.rs:16:17: 16:19]`, the trait `Send` is not implemented for `Foo`
= help: within `[generator@$DIR/partial-drop.rs:17:17: 17:19]`, the trait `Send` is not implemented for `Foo`
note: generator is not `Send` as this value is used across a yield
--> $DIR/partial-drop.rs:21:9
|
@ -23,7 +22,7 @@ LL | yield;
LL | });
| - `guard` is later dropped here
note: required by a bound in `assert_send`
--> $DIR/partial-drop.rs:44:19
--> $DIR/partial-drop.rs:33:19
|
LL | fn assert_send<T: Send>(_: T) {}
| ^^^^ required by this bound in `assert_send`
@ -34,46 +33,16 @@ error: generator cannot be sent between threads safely
LL | assert_send(|| {
| _________________^
LL | |
LL | | // FIXME: it would be nice to make this work.
LL | | let guard = Bar { foo: Foo, x: 42 };
... |
LL | | let Bar { foo, x } = guard;
LL | | drop(foo);
LL | | yield;
LL | | });
| |_____^ generator is not `Send`
|
= help: within `[generator@$DIR/partial-drop.rs:24:17: 24:19]`, the trait `Send` is not implemented for `Foo`
note: generator is not `Send` as this value is used across a yield
--> $DIR/partial-drop.rs:31:9
|
LL | let guard = Bar { foo: Foo, x: 42 };
| ----- has type `Bar` which is not `Send`
...
LL | yield;
| ^^^^^ yield occurs here, with `guard` maybe used later
LL | });
| - `guard` is later dropped here
note: required by a bound in `assert_send`
--> $DIR/partial-drop.rs:44:19
|
LL | fn assert_send<T: Send>(_: T) {}
| ^^^^ required by this bound in `assert_send`
error: generator cannot be sent between threads safely
--> $DIR/partial-drop.rs:34:17
|
LL | assert_send(|| {
| _________________^
LL | |
LL | | // FIXME: it would be nice to make this work.
LL | | let guard = Bar { foo: Foo, x: 42 };
... |
LL | | yield;
LL | | });
| |_____^ generator is not `Send`
|
= help: within `[generator@$DIR/partial-drop.rs:34:17: 34:19]`, the trait `Send` is not implemented for `Foo`
note: generator is not `Send` as this value is used across a yield
--> $DIR/partial-drop.rs:40:9
--> $DIR/partial-drop.rs:29:9
|
LL | let Bar { foo, x } = guard;
| --- has type `Foo` which is not `Send`
@ -83,10 +52,10 @@ LL | yield;
LL | });
| - `foo` is later dropped here
note: required by a bound in `assert_send`
--> $DIR/partial-drop.rs:44:19
--> $DIR/partial-drop.rs:33:19
|
LL | fn assert_send<T: Send>(_: T) {}
| ^^^^ required by this bound in `assert_send`
error: aborting due to 3 previous errors
error: aborting due to 2 previous errors

View File

@ -1,6 +1,7 @@
// revisions: no_drop_tracking drop_tracking drop_tracking_mir
// [drop_tracking] compile-flags: -Zdrop-tracking
// [drop_tracking_mir] compile-flags: -Zdrop-tracking-mir
// [drop_tracking_mir] check-pass
#![feature(negative_impls, generators)]
@ -14,26 +15,14 @@ struct Bar {
fn main() {
assert_send(|| {
//~^ ERROR generator cannot be sent between threads safely
// FIXME: it would be nice to make this work.
//[no_drop_tracking,drop_tracking]~^ ERROR generator cannot be sent between threads safely
let guard = Bar { foo: Foo, x: 42 };
drop(guard.foo);
yield;
});
assert_send(|| {
//~^ ERROR generator cannot be sent between threads safely
// FIXME: it would be nice to make this work.
let guard = Bar { foo: Foo, x: 42 };
drop(guard);
guard.foo = Foo;
guard.x = 23;
yield;
});
assert_send(|| {
//~^ ERROR generator cannot be sent between threads safely
// FIXME: it would be nice to make this work.
//[no_drop_tracking,drop_tracking]~^ ERROR generator cannot be sent between threads safely
let guard = Bar { foo: Foo, x: 42 };
let Bar { foo, x } = guard;
drop(foo);

View File

@ -1,92 +0,0 @@
error: generator cannot be sent between threads safely
--> $DIR/partial-drop.rs:16:17
|
LL | assert_send(|| {
| _________________^
LL | |
LL | | // FIXME: it would be nice to make this work.
LL | | let guard = Bar { foo: Foo, x: 42 };
LL | | drop(guard.foo);
LL | | yield;
LL | | });
| |_____^ generator is not `Send`
|
= help: within `[generator@$DIR/partial-drop.rs:16:17: 16:19]`, the trait `Send` is not implemented for `Foo`
note: generator is not `Send` as this value is used across a yield
--> $DIR/partial-drop.rs:21:9
|
LL | let guard = Bar { foo: Foo, x: 42 };
| ----- has type `Bar` which is not `Send`
LL | drop(guard.foo);
LL | yield;
| ^^^^^ yield occurs here, with `guard` maybe used later
LL | });
| - `guard` is later dropped here
note: required by a bound in `assert_send`
--> $DIR/partial-drop.rs:44:19
|
LL | fn assert_send<T: Send>(_: T) {}
| ^^^^ required by this bound in `assert_send`
error: generator cannot be sent between threads safely
--> $DIR/partial-drop.rs:24:17
|
LL | assert_send(|| {
| _________________^
LL | |
LL | | // FIXME: it would be nice to make this work.
LL | | let guard = Bar { foo: Foo, x: 42 };
... |
LL | | yield;
LL | | });
| |_____^ generator is not `Send`
|
= help: within `[generator@$DIR/partial-drop.rs:24:17: 24:19]`, the trait `Send` is not implemented for `Foo`
note: generator is not `Send` as this value is used across a yield
--> $DIR/partial-drop.rs:31:9
|
LL | let guard = Bar { foo: Foo, x: 42 };
| ----- has type `Bar` which is not `Send`
...
LL | yield;
| ^^^^^ yield occurs here, with `guard` maybe used later
LL | });
| - `guard` is later dropped here
note: required by a bound in `assert_send`
--> $DIR/partial-drop.rs:44:19
|
LL | fn assert_send<T: Send>(_: T) {}
| ^^^^ required by this bound in `assert_send`
error: generator cannot be sent between threads safely
--> $DIR/partial-drop.rs:34:17
|
LL | assert_send(|| {
| _________________^
LL | |
LL | | // FIXME: it would be nice to make this work.
LL | | let guard = Bar { foo: Foo, x: 42 };
... |
LL | | yield;
LL | | });
| |_____^ generator is not `Send`
|
= help: within `[generator@$DIR/partial-drop.rs:34:17: 34:19]`, the trait `Send` is not implemented for `Foo`
note: generator is not `Send` as this value is used across a yield
--> $DIR/partial-drop.rs:40:9
|
LL | let guard = Bar { foo: Foo, x: 42 };
| ----- has type `Bar` which is not `Send`
...
LL | yield;
| ^^^^^ yield occurs here, with `guard` maybe used later
LL | });
| - `guard` is later dropped here
note: required by a bound in `assert_send`
--> $DIR/partial-drop.rs:44:19
|
LL | fn assert_send<T: Send>(_: T) {}
| ^^^^ required by this bound in `assert_send`
error: aborting due to 3 previous errors

View File

@ -1,8 +1,8 @@
error: generator cannot be sent between threads safely
--> $DIR/generator-print-verbose-1.rs:40:18
--> $DIR/generator-print-verbose-1.rs:40:5
|
LL | require_send(send_gen);
| ^^^^^^^^ generator is not `Send`
| ^^^^^^^^^^^^ generator is not `Send`
|
= help: the trait `Sync` is not implemented for `RefCell<i32>`
= note: if you want to do aliasing and mutation between multiple threads, use `std::sync::RwLock` instead
@ -13,8 +13,6 @@ LL | let _non_send_gen = make_non_send_generator();
| ------------- has type `Opaque(DefId(0:34 ~ generator_print_verbose_1[749a]::make_non_send_generator::{opaque#0}), [])` which is not `Send`
LL | yield;
| ^^^^^ yield occurs here, with `_non_send_gen` maybe used later
LL | };
| - `_non_send_gen` is later dropped here
note: required by a bound in `require_send`
--> $DIR/generator-print-verbose-1.rs:29:25
|
@ -22,12 +20,10 @@ LL | fn require_send(_: impl Send) {}
| ^^^^ required by this bound in `require_send`
error[E0277]: `RefCell<i32>` cannot be shared between threads safely
--> $DIR/generator-print-verbose-1.rs:59:18
--> $DIR/generator-print-verbose-1.rs:59:5
|
LL | require_send(send_gen);
| ------------ ^^^^^^^^ `RefCell<i32>` cannot be shared between threads safely
| |
| required by a bound introduced by this call
| ^^^^^^^^^^^^ `RefCell<i32>` cannot be shared between threads safely
|
= help: the trait `Sync` is not implemented for `RefCell<i32>`
= note: if you want to do aliasing and mutation between multiple threads, use `std::sync::RwLock` instead
@ -47,7 +43,7 @@ note: required because it appears within the type `Opaque(DefId(0:36 ~ generator
|
LL | fn make_non_send_generator2() -> impl Generator<Return = Arc<RefCell<i32>>> {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
= note: required because it captures the following types: `Opaque(DefId(0:36 ~ generator_print_verbose_1[749a]::make_non_send_generator2::{opaque#0}), [])`, `()`
= note: required because it captures the following types: `Opaque(DefId(0:36 ~ generator_print_verbose_1[749a]::make_non_send_generator2::{opaque#0}), [])`
note: required because it's used within this generator
--> $DIR/generator-print-verbose-1.rs:55:20
|

View File

@ -15,7 +15,7 @@ use std::{
};
pub struct Ready<T>(Option<T>);
impl<T> Generator<()> for Ready<T> {
impl<T: Unpin> Generator<()> for Ready<T> {
type Return = T;
type Yield = ();
fn resume(mut self: Pin<&mut Self>, _args: ()) -> GeneratorState<(), T> {

View File

@ -1,58 +1,60 @@
error[E0277]: `Cell<i32>` cannot be shared between threads safely
--> $DIR/generator-print-verbose-2.rs:22:17
|
LL | assert_send(|| {
| _____-----------_^
| | |
| | required by a bound introduced by this call
LL | |
LL | | drop(&a);
LL | | yield;
LL | | });
| |_____^ `Cell<i32>` cannot be shared between threads safely
|
= help: the trait `Sync` is not implemented for `Cell<i32>`
= note: if you want to do aliasing and mutation between multiple threads, use `std::sync::RwLock` or `std::sync::atomic::AtomicI32` instead
= note: required for `&'_#4r Cell<i32>` to implement `Send`
note: required because it's used within this generator
--> $DIR/generator-print-verbose-2.rs:22:17
|
LL | assert_send(|| {
| ^^
note: required by a bound in `assert_send`
--> $DIR/generator-print-verbose-2.rs:13:23
|
LL | fn assert_send<T: Send>(_: T) {}
| ^^^^ required by this bound in `assert_send`
error: generator cannot be shared between threads safely
--> $DIR/generator-print-verbose-2.rs:15:17
--> $DIR/generator-print-verbose-2.rs:20:17
|
LL | assert_sync(|| {
| _________________^
LL | |
LL | | let a = Cell::new(2);
LL | | let a = NotSync;
LL | | yield;
LL | | drop(a);
LL | | });
| |_____^ generator is not `Sync`
|
= help: within `[main::{closure#0} upvar_tys=() {Cell<i32>, ()}]`, the trait `Sync` is not implemented for `Cell<i32>`
= note: if you want to do aliasing and mutation between multiple threads, use `std::sync::RwLock` or `std::sync::atomic::AtomicI32` instead
= help: within `[main::{closure#0} upvar_tys=() {NotSync, ()}]`, the trait `Sync` is not implemented for `NotSync`
note: generator is not `Sync` as this value is used across a yield
--> $DIR/generator-print-verbose-2.rs:18:9
--> $DIR/generator-print-verbose-2.rs:23:9
|
LL | let a = Cell::new(2);
| - has type `Cell<i32>` which is not `Sync`
LL | let a = NotSync;
| - has type `NotSync` which is not `Sync`
LL | yield;
| ^^^^^ yield occurs here, with `a` maybe used later
LL | drop(a);
LL | });
| - `a` is later dropped here
note: required by a bound in `assert_sync`
--> $DIR/generator-print-verbose-2.rs:12:23
--> $DIR/generator-print-verbose-2.rs:17:23
|
LL | fn assert_sync<T: Sync>(_: T) {}
| ^^^^ required by this bound in `assert_sync`
error: generator cannot be sent between threads safely
--> $DIR/generator-print-verbose-2.rs:27:17
|
LL | assert_send(|| {
| _________________^
LL | |
LL | | let a = NotSend;
LL | | yield;
LL | | drop(a);
LL | | });
| |_____^ generator is not `Send`
|
= help: within `[main::{closure#1} upvar_tys=() {NotSend, ()}]`, the trait `Send` is not implemented for `NotSend`
note: generator is not `Send` as this value is used across a yield
--> $DIR/generator-print-verbose-2.rs:30:9
|
LL | let a = NotSend;
| - has type `NotSend` which is not `Send`
LL | yield;
| ^^^^^ yield occurs here, with `a` maybe used later
LL | drop(a);
LL | });
| - `a` is later dropped here
note: required by a bound in `assert_send`
--> $DIR/generator-print-verbose-2.rs:18:23
|
LL | fn assert_send<T: Send>(_: T) {}
| ^^^^ required by this bound in `assert_send`
error: aborting due to 2 previous errors
For more information about this error, try `rustc --explain E0277`.

View File

@ -1,58 +1,42 @@
error[E0277]: `Cell<i32>` cannot be shared between threads safely
--> $DIR/generator-print-verbose-2.rs:22:17
|
LL | assert_send(|| {
| _____-----------_^
| | |
| | required by a bound introduced by this call
LL | |
LL | | drop(&a);
LL | | yield;
LL | | });
| |_____^ `Cell<i32>` cannot be shared between threads safely
|
= help: the trait `Sync` is not implemented for `Cell<i32>`
= note: if you want to do aliasing and mutation between multiple threads, use `std::sync::RwLock` or `std::sync::atomic::AtomicI32` instead
= note: required for `&'_#4r Cell<i32>` to implement `Send`
note: required because it's used within this generator
--> $DIR/generator-print-verbose-2.rs:22:17
|
LL | assert_send(|| {
| ^^
note: required by a bound in `assert_send`
--> $DIR/generator-print-verbose-2.rs:13:23
|
LL | fn assert_send<T: Send>(_: T) {}
| ^^^^ required by this bound in `assert_send`
error: generator cannot be shared between threads safely
--> $DIR/generator-print-verbose-2.rs:15:17
--> $DIR/generator-print-verbose-2.rs:20:5
|
LL | assert_sync(|| {
| _________________^
LL | |
LL | | let a = Cell::new(2);
LL | | yield;
LL | | });
| |_____^ generator is not `Sync`
LL | assert_sync(|| {
| ^^^^^^^^^^^ generator is not `Sync`
|
= help: within `[main::{closure#0} upvar_tys=() {Cell<i32>, ()}]`, the trait `Sync` is not implemented for `Cell<i32>`
= note: if you want to do aliasing and mutation between multiple threads, use `std::sync::RwLock` or `std::sync::atomic::AtomicI32` instead
= help: within `[main::{closure#0} upvar_tys=() [main::{closure#0}]]`, the trait `Sync` is not implemented for `NotSync`
note: generator is not `Sync` as this value is used across a yield
--> $DIR/generator-print-verbose-2.rs:18:9
--> $DIR/generator-print-verbose-2.rs:23:9
|
LL | let a = Cell::new(2);
| - has type `Cell<i32>` which is not `Sync`
LL | let a = NotSync;
| - has type `NotSync` which is not `Sync`
LL | yield;
| ^^^^^ yield occurs here, with `a` maybe used later
LL | });
| - `a` is later dropped here
note: required by a bound in `assert_sync`
--> $DIR/generator-print-verbose-2.rs:12:23
--> $DIR/generator-print-verbose-2.rs:17:23
|
LL | fn assert_sync<T: Sync>(_: T) {}
| ^^^^ required by this bound in `assert_sync`
error: generator cannot be sent between threads safely
--> $DIR/generator-print-verbose-2.rs:27:5
|
LL | assert_send(|| {
| ^^^^^^^^^^^ generator is not `Send`
|
= help: within `[main::{closure#1} upvar_tys=() [main::{closure#1}]]`, the trait `Send` is not implemented for `NotSend`
note: generator is not `Send` as this value is used across a yield
--> $DIR/generator-print-verbose-2.rs:30:9
|
LL | let a = NotSend;
| - has type `NotSend` which is not `Send`
LL | yield;
| ^^^^^ yield occurs here, with `a` maybe used later
note: required by a bound in `assert_send`
--> $DIR/generator-print-verbose-2.rs:18:23
|
LL | fn assert_send<T: Send>(_: T) {}
| ^^^^ required by this bound in `assert_send`
error: aborting due to 2 previous errors
For more information about this error, try `rustc --explain E0277`.

View File

@ -1,58 +1,60 @@
error[E0277]: `Cell<i32>` cannot be shared between threads safely
--> $DIR/generator-print-verbose-2.rs:22:17
|
LL | assert_send(|| {
| _____-----------_^
| | |
| | required by a bound introduced by this call
LL | |
LL | | drop(&a);
LL | | yield;
LL | | });
| |_____^ `Cell<i32>` cannot be shared between threads safely
|
= help: the trait `Sync` is not implemented for `Cell<i32>`
= note: if you want to do aliasing and mutation between multiple threads, use `std::sync::RwLock` or `std::sync::atomic::AtomicI32` instead
= note: required for `&'_#4r Cell<i32>` to implement `Send`
note: required because it's used within this generator
--> $DIR/generator-print-verbose-2.rs:22:17
|
LL | assert_send(|| {
| ^^
note: required by a bound in `assert_send`
--> $DIR/generator-print-verbose-2.rs:13:23
|
LL | fn assert_send<T: Send>(_: T) {}
| ^^^^ required by this bound in `assert_send`
error: generator cannot be shared between threads safely
--> $DIR/generator-print-verbose-2.rs:15:17
--> $DIR/generator-print-verbose-2.rs:20:17
|
LL | assert_sync(|| {
| _________________^
LL | |
LL | | let a = Cell::new(2);
LL | | let a = NotSync;
LL | | yield;
LL | | drop(a);
LL | | });
| |_____^ generator is not `Sync`
|
= help: within `[main::{closure#0} upvar_tys=() {Cell<i32>, ()}]`, the trait `Sync` is not implemented for `Cell<i32>`
= note: if you want to do aliasing and mutation between multiple threads, use `std::sync::RwLock` or `std::sync::atomic::AtomicI32` instead
= help: within `[main::{closure#0} upvar_tys=() {NotSync, ()}]`, the trait `Sync` is not implemented for `NotSync`
note: generator is not `Sync` as this value is used across a yield
--> $DIR/generator-print-verbose-2.rs:18:9
--> $DIR/generator-print-verbose-2.rs:23:9
|
LL | let a = Cell::new(2);
| - has type `Cell<i32>` which is not `Sync`
LL | let a = NotSync;
| - has type `NotSync` which is not `Sync`
LL | yield;
| ^^^^^ yield occurs here, with `a` maybe used later
LL | drop(a);
LL | });
| - `a` is later dropped here
note: required by a bound in `assert_sync`
--> $DIR/generator-print-verbose-2.rs:12:23
--> $DIR/generator-print-verbose-2.rs:17:23
|
LL | fn assert_sync<T: Sync>(_: T) {}
| ^^^^ required by this bound in `assert_sync`
error: generator cannot be sent between threads safely
--> $DIR/generator-print-verbose-2.rs:27:17
|
LL | assert_send(|| {
| _________________^
LL | |
LL | | let a = NotSend;
LL | | yield;
LL | | drop(a);
LL | | });
| |_____^ generator is not `Send`
|
= help: within `[main::{closure#1} upvar_tys=() {NotSend, ()}]`, the trait `Send` is not implemented for `NotSend`
note: generator is not `Send` as this value is used across a yield
--> $DIR/generator-print-verbose-2.rs:30:9
|
LL | let a = NotSend;
| - has type `NotSend` which is not `Send`
LL | yield;
| ^^^^^ yield occurs here, with `a` maybe used later
LL | drop(a);
LL | });
| - `a` is later dropped here
note: required by a bound in `assert_send`
--> $DIR/generator-print-verbose-2.rs:18:23
|
LL | fn assert_send<T: Send>(_: T) {}
| ^^^^ required by this bound in `assert_send`
error: aborting due to 2 previous errors
For more information about this error, try `rustc --explain E0277`.

View File

@ -5,8 +5,13 @@
// Same as test/ui/generator/not-send-sync.rs
#![feature(generators)]
#![feature(negative_impls)]
use std::cell::Cell;
struct NotSend;
struct NotSync;
impl !Send for NotSend {}
impl !Sync for NotSync {}
fn main() {
fn assert_sync<T: Sync>(_: T) {}
@ -14,14 +19,15 @@ fn main() {
assert_sync(|| {
//~^ ERROR: generator cannot be shared between threads safely
let a = Cell::new(2);
let a = NotSync;
yield;
drop(a);
});
let a = Cell::new(2);
assert_send(|| {
//~^ ERROR: E0277
drop(&a);
//~^ ERROR: generator cannot be sent between threads safely
let a = NotSend;
yield;
drop(a);
});
}

View File

@ -4,5 +4,11 @@ error: type parameter `T` is part of concrete type but not used in parameter lis
LL | async {}
| ^^^^^^^^
error: aborting due to previous error
error: type parameter `T` is part of concrete type but not used in parameter list for the `impl Trait` type alias
--> $DIR/issue-55872-2.rs:17:9
|
LL | async {}
| ^^^^^^^^
error: aborting due to 2 previous errors

View File

@ -16,6 +16,7 @@ impl<S> Bar for S {
fn foo<T>() -> Self::E {
async {}
//~^ ERROR type parameter `T` is part of concrete type but not used in parameter list for the `impl Trait` type alias
//[drop_tracking_mir]~^^ ERROR type parameter `T` is part of concrete type but not used in parameter list for the `impl Trait` type alias
}
}

View File

@ -8,13 +8,13 @@ LL | Foo(bar())
| ---------- returning here with type `Foo<impl Quux>`
...
LL | fn bar() -> impl Quux {
| --------- returning this opaque type `Foo<impl Quux>`
| --------- returning this type `Foo<impl Quux>`
error[E0720]: cannot resolve opaque type
--> $DIR/infinite-impl-trait-issue-38064.rs:14:13
|
LL | fn foo() -> impl Quux {
| --------- returning this opaque type `Bar<impl Quux>`
| --------- returning this type `Bar<impl Quux>`
...
LL | fn bar() -> impl Quux {
| ^^^^^^^^^ recursive opaque type

View File

@ -112,16 +112,8 @@ LL | (substs_change::<&T>(),)
error[E0720]: cannot resolve opaque type
--> $DIR/recursive-impl-trait-type-indirect.rs:76:24
|
LL | fn generator_hold() -> impl Sized {
| ^^^^^^^^^^ recursive opaque type
LL |
LL | / move || {
LL | | let x = generator_hold();
| | - generator captures itself here
LL | | yield;
LL | | x;
LL | | }
| |_____- returning here with type `[generator@$DIR/recursive-impl-trait-type-indirect.rs:78:5: 78:12]`
LL | fn generator_hold() -> impl Sized {
| ^^^^^^^^^^ recursive opaque type
error[E0720]: cannot resolve opaque type
--> $DIR/recursive-impl-trait-type-indirect.rs:90:26

View File

@ -1,14 +1,16 @@
error: `No` held across a suspend point, but should not be
--> $DIR/dedup.rs:19:13
--> $DIR/dedup.rs:19:9
|
LL | wheeee(&No {}).await;
| ^^^^^ ------ the value is held across this suspend point
LL | let no = No {};
| ^^
LL | wheeee(&no).await;
| ------ the value is held across this suspend point
|
help: consider using a block (`{ ... }`) to shrink the value's scope, ending before the suspend point
--> $DIR/dedup.rs:19:13
--> $DIR/dedup.rs:19:9
|
LL | wheeee(&No {}).await;
| ^^^^^
LL | let no = No {};
| ^^
note: the lint level is defined here
--> $DIR/dedup.rs:6:9
|

View File

@ -1,14 +1,16 @@
error: `No` held across a suspend point, but should not be
--> $DIR/dedup.rs:19:13
--> $DIR/dedup.rs:19:9
|
LL | wheeee(&No {}).await;
| ^^^^^ ------ the value is held across this suspend point
LL | let no = No {};
| ^^
LL | wheeee(&no).await;
| ------ the value is held across this suspend point
|
help: consider using a block (`{ ... }`) to shrink the value's scope, ending before the suspend point
--> $DIR/dedup.rs:19:13
--> $DIR/dedup.rs:19:9
|
LL | wheeee(&No {}).await;
| ^^^^^
LL | let no = No {};
| ^^
note: the lint level is defined here
--> $DIR/dedup.rs:6:9
|

View File

@ -1,19 +1,33 @@
error: `No` held across a suspend point, but should not be
--> $DIR/dedup.rs:19:13
--> $DIR/dedup.rs:19:9
|
LL | wheeee(&No {}).await;
| ^^^^^ ------ the value is held across this suspend point
LL | let no = No {};
| ^^
LL | wheeee(&no).await;
| ------ the value is held across this suspend point
|
help: consider using a block (`{ ... }`) to shrink the value's scope, ending before the suspend point
--> $DIR/dedup.rs:19:13
--> $DIR/dedup.rs:19:9
|
LL | wheeee(&No {}).await;
| ^^^^^
LL | let no = No {};
| ^^
note: the lint level is defined here
--> $DIR/dedup.rs:6:9
|
LL | #![deny(must_not_suspend)]
| ^^^^^^^^^^^^^^^^
error: aborting due to previous error
error: `No` held across a suspend point, but should not be
--> $DIR/dedup.rs:20:13
|
LL | wheeee(&no).await;
| ^^ ------ the value is held across this suspend point
|
help: consider using a block (`{ ... }`) to shrink the value's scope, ending before the suspend point
--> $DIR/dedup.rs:20:13
|
LL | wheeee(&no).await;
| ^^
error: aborting due to 2 previous errors

View File

@ -16,7 +16,9 @@ async fn wheeee<T>(t: T) {
}
async fn yes() {
wheeee(&No {}).await; //~ ERROR `No` held across
let no = No {}; //~ ERROR `No` held across
wheeee(&no).await; //[no_drop_tracking]~ ERROR `No` held across
drop(no);
}
fn main() {

View File

@ -1,22 +1,22 @@
error: `Umm` held across a suspend point, but should not be
--> $DIR/ref.rs:22:26
error: reference to `Umm` held across a suspend point, but should not be
--> $DIR/ref.rs:22:13
|
LL | let guard = &mut self.u;
| ^^^^^^
| ^^^^^
LL |
LL | other().await;
| ------ the value is held across this suspend point
|
note: You gotta use Umm's, ya know?
--> $DIR/ref.rs:22:26
--> $DIR/ref.rs:22:13
|
LL | let guard = &mut self.u;
| ^^^^^^
| ^^^^^
help: consider using a block (`{ ... }`) to shrink the value's scope, ending before the suspend point
--> $DIR/ref.rs:22:26
--> $DIR/ref.rs:22:13
|
LL | let guard = &mut self.u;
| ^^^^^^
| ^^^^^
note: the lint level is defined here
--> $DIR/ref.rs:7:9
|

View File

@ -23,6 +23,7 @@ impl Bar {
other().await;
let _g = &*guard;
*guard = Umm { i: 2 }
}
}

View File

@ -25,6 +25,9 @@ pub async fn uhoh() {
let _guard2 = r#dyn(); //~ ERROR boxed `Wow` trait object held across
other().await;
drop(_guard1);
drop(_guard2);
}
fn main() {

View File

@ -1,5 +1,5 @@
error: `Umm` held across a suspend point, but should not be
--> $DIR/unit.rs:23:9
--> $DIR/unit.rs:22:9
|
LL | let _guard = bar();
| ^^^^^^
@ -7,12 +7,12 @@ LL | other().await;
| ------ the value is held across this suspend point
|
note: You gotta use Umm's, ya know?
--> $DIR/unit.rs:23:9
--> $DIR/unit.rs:22:9
|
LL | let _guard = bar();
| ^^^^^^
help: consider using a block (`{ ... }`) to shrink the value's scope, ending before the suspend point
--> $DIR/unit.rs:23:9
--> $DIR/unit.rs:22:9
|
LL | let _guard = bar();
| ^^^^^^

View File

@ -1,5 +1,5 @@
error: `Umm` held across a suspend point, but should not be
--> $DIR/unit.rs:23:9
--> $DIR/unit.rs:22:9
|
LL | let _guard = bar();
| ^^^^^^
@ -7,12 +7,12 @@ LL | other().await;
| ------ the value is held across this suspend point
|
note: You gotta use Umm's, ya know?
--> $DIR/unit.rs:23:9
--> $DIR/unit.rs:22:9
|
LL | let _guard = bar();
| ^^^^^^
help: consider using a block (`{ ... }`) to shrink the value's scope, ending before the suspend point
--> $DIR/unit.rs:23:9
--> $DIR/unit.rs:22:9
|
LL | let _guard = bar();
| ^^^^^^

View File

@ -1,5 +1,5 @@
error: `Umm` held across a suspend point, but should not be
--> $DIR/unit.rs:23:9
--> $DIR/unit.rs:22:9
|
LL | let _guard = bar();
| ^^^^^^
@ -7,12 +7,12 @@ LL | other().await;
| ------ the value is held across this suspend point
|
note: You gotta use Umm's, ya know?
--> $DIR/unit.rs:23:9
--> $DIR/unit.rs:22:9
|
LL | let _guard = bar();
| ^^^^^^
help: consider using a block (`{ ... }`) to shrink the value's scope, ending before the suspend point
--> $DIR/unit.rs:23:9
--> $DIR/unit.rs:22:9
|
LL | let _guard = bar();
| ^^^^^^

View File

@ -10,7 +10,6 @@ struct Umm {
i: i64
}
fn bar() -> Umm {
Umm {
i: 1
@ -22,6 +21,7 @@ async fn other() {}
pub async fn uhoh() {
let _guard = bar(); //~ ERROR `Umm` held across
other().await;
drop(_guard);
}
fn main() {

View File

@ -23,6 +23,7 @@ async fn other() {}
pub async fn uhoh() {
let _guard = bar(); //~ WARNING `Umm` held across
other().await;
drop(_guard);
}
fn main() {