1
Fork 0

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` | - has type `Rc<()>` which is not `Send`
LL | bar().await LL | bar().await
| ^^^^^^ await occurs here, with `r` maybe used later | ^^^^^^ await occurs here, with `r` maybe used later
LL | };
| - `r` is later dropped here
note: required by a bound in `is_send` note: required by a bound in `is_send`
--> $DIR/async-await-let-else.rs:19:15 --> $DIR/async-await-let-else.rs:19:15
| |
LL | fn is_send<T: Send>(_: T) {} LL | fn is_send<T: Send>(_: T) {}
| ^^^^ required by this bound in `is_send` | ^^^^ 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 --> $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))); 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<()>` = 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 note: required because it's used within this `async fn` body
--> $DIR/async-await-let-else.rs:23:26 --> $DIR/async-await-let-else.rs:27:29
| |
LL | bar2(Rc::new(())).await LL | async fn bar2<T>(_: T) -> ! {
| ----------- ^^^^^^ await occurs here, with `Rc::new(())` maybe used later | _____________________________^
| | LL | | panic!()
| has type `Rc<()>` which is not `Send` LL | | }
LL | }; | |_^
| - `Rc::new(())` is later dropped here = 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` note: required by a bound in `is_send`
--> $DIR/async-await-let-else.rs:19:15 --> $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 --> $DIR/async-await-let-else.rs:33:28
| |
LL | (Rc::new(()), bar().await); 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` | has type `Rc<()>` which is not `Send`
note: required by a bound in `is_send` note: required by a bound in `is_send`
--> $DIR/async-await-let-else.rs:19:15 --> $DIR/async-await-let-else.rs:19:15
@ -77,9 +89,6 @@ LL | let r = Rc::new(());
| - has type `Rc<()>` which is not `Send` | - has type `Rc<()>` which is not `Send`
LL | bar().await; LL | bar().await;
| ^^^^^^ await occurs here, with `r` maybe used later | ^^^^^^ await occurs here, with `r` maybe used later
...
LL | };
| - `r` is later dropped here
note: required by a bound in `is_send` note: required by a bound in `is_send`
--> $DIR/async-await-let-else.rs:19:15 --> $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 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 | ^ cannot infer type
| |
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`
--> $DIR/async-error-span.rs:17:17 --> $DIR/async-error-span.rs:19:17
| |
LL | get_future().await; 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 `()` = help: the trait `Future` is not implemented for `()`
= note: () must be a future or must implement `IntoFuture` to be awaited = 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 --> $DIR/async-error-span.rs:16:9
| |
LL | let a; LL | let a;
| ^ cannot infer type | ^
| |
note: the type is part of the `async fn` body because of this `await` help: consider giving `a` an explicit type
--> $DIR/async-error-span.rs:17:17
| |
LL | get_future().await; LL | let a: /* Type */;
| ^^^^^^ | ++++++++++++
error: aborting due to 2 previous errors 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`. For more information about an error, try `rustc --explain E0277`.

View file

@ -14,7 +14,7 @@ LL | let a;
| ^ cannot infer type | ^ cannot infer type
| |
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`
--> $DIR/async-error-span.rs:17:17 --> $DIR/async-error-span.rs:19:17
| |
LL | get_future().await; LL | get_future().await;
| ^^^^^^ | ^^^^^^

View file

@ -13,7 +13,9 @@ fn get_future() -> impl Future<Output = ()> {
} }
async fn foo() { 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; 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 error: future cannot be sent between threads safely
--> $DIR/async-fn-nonsend.rs:72:17 --> $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 --> $DIR/async-fn-nonsend.rs:36:25
| |
LL | match Some(non_send()) { 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, LL | Some(_) => fut().await,
| ^^^^^^ await occurs here, with `non_send()` maybe used later | ^^^^^^ await occurs here, with `Some(non_send())` maybe used later
...
LL | }
| - `non_send()` is later dropped here
note: required by a bound in `assert_send` note: required by a bound in `assert_send`
--> $DIR/async-fn-nonsend.rs:67:24 --> $DIR/async-fn-nonsend.rs:67:24
| |
@ -59,62 +33,11 @@ LL | let f: &mut std::fmt::Formatter = &mut get_formatter();
... ...
LL | fut().await; LL | fut().await;
| ^^^^^^ await occurs here, with `get_formatter()` maybe used later | ^^^^^^ 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` note: required by a bound in `assert_send`
--> $DIR/async-fn-nonsend.rs:67:24 --> $DIR/async-fn-nonsend.rs:67:24
| |
LL | fn assert_send(_: impl Send) {} LL | fn assert_send(_: impl Send) {}
| ^^^^ required by this bound in `assert_send` | ^^^^ required by this bound in `assert_send`
error: future cannot be sent between threads safely error: aborting due to 2 previous errors
--> $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

View file

@ -68,13 +68,13 @@ fn assert_send(_: impl Send) {}
pub fn pass_assert() { pub fn pass_assert() {
assert_send(local_dropped_before_await()); 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()); assert_send(non_send_temporary_in_match());
//~^ ERROR future cannot be sent between threads safely //~^ ERROR future cannot be sent between threads safely
assert_send(non_sync_with_method_call()); assert_send(non_sync_with_method_call());
//~^ ERROR future cannot be sent between threads safely //~^ ERROR future cannot be sent between threads safely
assert_send(non_sync_with_method_call_panic()); 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()); 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; LL | let _ = send_element(element).await;
| ^^^^^^ await occurs here, with `mut info` maybe used later | ^^^^^^ await occurs here, with `mut info` maybe used later
LL | }
| - `mut info` is later dropped here
note: required by a bound in `assert_send` note: required by a bound in `assert_send`
--> $DIR/drop-track-field-assign-nonsend.rs:40:19 --> $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; LL | let _ = send_element(element).await;
| ^^^^^^ await occurs here, with `mut info` maybe used later | ^^^^^^ await occurs here, with `mut info` maybe used later
LL | }
| - `mut info` is later dropped here
note: required by a bound in `assert_send` note: required by a bound in `assert_send`
--> $DIR/field-assign-nonsend.rs:40:19 --> $DIR/field-assign-nonsend.rs:40:19
| |

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -17,7 +17,7 @@ impl !Qux for Foo {}
fn is_qux<T: Qux>(t: T) {} fn is_qux<T: Qux>(t: T) {}
async fn bar() { async fn bar() {
let x = Foo; let x = Box::new(Foo);
baz().await; 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 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 { LL | pub fn foo() -> impl Future + Send {
| ^^^^^^^^^^^^^^^^^^ future created by async block is not `Send` | ^^^^^^^^^^^^^^^^^^ future created by async block is not `Send`

View file

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

View file

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

View file

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

View file

@ -19,8 +19,9 @@ impl Future for AFuture{
async fn foo() { async fn foo() {
spawn(async { //~ ERROR future cannot be sent between threads safely 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; AFuture.await;
drop(a);
}); });
} }

View file

@ -1,8 +1,8 @@
error: future cannot be sent between threads safely 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); 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>` = 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 = 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` | ^^^^ required by this bound in `require_send`
error: future cannot be sent between threads safely 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); 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>` = 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 = 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` | ^^^^ required by this bound in `require_send`
error[E0277]: `RefCell<i32>` cannot be shared between threads safely 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); LL | require_send(send_fut);
| ------------ ^^^^^^^^ `RefCell<i32>` cannot be shared between threads safely | ^^^^^^^^^^^^ `RefCell<i32>` cannot be shared between threads safely
| |
| required by a bound introduced by this call
| |
= help: the trait `Sync` is not implemented for `RefCell<i32>` = 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 = 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>>> { 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 note: required because it's used within this `async` block
--> $DIR/issue-68112.rs:60:20 --> $DIR/issue-68112.rs:60:20
| |

View file

@ -14,7 +14,7 @@ use std::{
fn require_send(_: impl Send) {} fn require_send(_: impl Send) {}
struct Ready<T>(Option<T>); struct Ready<T>(Option<T>);
impl<T> Future for Ready<T> { impl<T: Unpin> Future for Ready<T> {
type Output = T; type Output = T;
fn poll(mut self: Pin<&mut Self>, _cx: &mut Context<'_>) -> Poll<T> { fn poll(mut self: Pin<&mut Self>, _cx: &mut Context<'_>) -> Poll<T> {
Poll::Ready(self.0.take().unwrap()) 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>` = help: the trait `Sync` is not implemented for `Sender<i32>`
= note: required for `&Sender<i32>` to implement `Send` = note: required for `&Sender<i32>` to implement `Send`
note: required because it's used within this closure 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{ LL | baz(|| async{
| ^^ | ^^
@ -20,7 +20,7 @@ LL | | }
| |_^ | |_^
= note: required because it captures the following types: `ResumeTy`, `impl Future<Output = ()>`, `()` = note: required because it captures the following types: `ResumeTy`, `impl Future<Output = ()>`, `()`
note: required because it's used within this `async` block 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 | / async move {
LL | | baz(|| async{ 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 --> $DIR/issue-70935-complex-spans.rs:13:45
| |
LL | fn foo(tx: std::sync::mpsc::Sender<i32>) -> impl Future + Send { 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>` = help: the trait `Sync` is not implemented for `Sender<i32>`
note: future is not `Send` as this value is used across an await = note: required for `&Sender<i32>` to implement `Send`
--> $DIR/issue-70935-complex-spans.rs:20:11 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 | | foo(tx.clone());
LL | | }).await; LL | | }).await;
| | - ^^^^^^- the value is later dropped here LL | | }
| | | | | |_____^
| |_________| 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`
error: aborting due to previous error 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>` = help: the trait `Sync` is not implemented for `Sender<i32>`
note: future is not `Send` as this value is used across an await 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{ LL | baz(|| async{
| _____________- | _____________-
@ -15,7 +15,7 @@ LL | | }).await;
| | - ^^^^^^- the value is later dropped here | | - ^^^^^^- the value is later dropped here
| | | | | | | |
| |_________| await occurs here, with the value maybe used later | |_________| 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 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 { fn foo(tx: std::sync::mpsc::Sender<i32>) -> impl Future + Send {
//[no_drop_tracking]~^ ERROR future cannot be sent between threads safely //[no_drop_tracking]~^ ERROR future cannot be sent between threads safely
//[drop_tracking]~^^ ERROR `Sender<i32>` cannot be shared between threads //[drop_tracking,drop_tracking_mir]~^^ ERROR `Sender<i32>` cannot be shared between threads
//[drop_tracking_mir]~^^^ ERROR future cannot be sent between threads safely
async move { async move {
baz(|| async{ baz(|| async{
foo(tx.clone()); 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 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 | assert_send(async {
| _________________^ | _________________^
LL | | LL | |
LL | |
LL | | bar(Foo(std::ptr::null())).await; LL | | bar(Foo(std::ptr::null())).await;
LL | | }) LL | | })
| |_____^ future created by async block is not `Send` | |_____^ 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 note: future is not `Send` as this value is used across an await
--> $DIR/issue-65436-raw-ptr-not-send.rs:19:35 --> $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; LL | bar(Foo(std::ptr::null())).await;
| ^^^^^^^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^^^^^^^^
note: required by a bound in `assert_send` 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) {} LL | fn assert_send<T: Send>(_: T) {}
| ^^^^ required by this bound in `assert_send` | ^^^^ required by this bound in `assert_send`

View file

@ -3,6 +3,7 @@
// [drop_tracking] compile-flags: -Zdrop-tracking // [drop_tracking] compile-flags: -Zdrop-tracking
// [drop_tracking_mir] compile-flags: -Zdrop-tracking-mir // [drop_tracking_mir] compile-flags: -Zdrop-tracking-mir
// [drop_tracking] check-pass // [drop_tracking] check-pass
// [drop_tracking_mir] check-pass
struct Foo(*const u8); struct Foo(*const u8);
@ -15,7 +16,6 @@ fn assert_send<T: Send>(_: T) {}
fn main() { fn main() {
assert_send(async { assert_send(async {
//[no_drop_tracking]~^ ERROR future cannot be sent between threads safely //[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; 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 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; LL | bar().await;
| ^^^ cannot infer type for type parameter `T` declared on the function `bar` | ^^^ 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` 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; LL | bar().await;
| ^^^^^^ | ^^^^^^
error[E0698]: type inside `async fn` body must be known in this context 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; LL | bar().await;
| ^^^ cannot infer type for type parameter `T` declared on the function `bar` | ^^^ 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` 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; LL | bar().await;
| ^^^^^^ | ^^^^^^
error[E0698]: type inside `async fn` body must be known in this context 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; LL | bar().await;
| ^^^ cannot infer type for type parameter `T` declared on the function `bar` | ^^^ 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` 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; LL | bar().await;
| ^^^^^^ | ^^^^^^

View file

@ -1,39 +1,14 @@
error[E0698]: type inside `async fn` body must be known in this context error[E0282]: type annotations needed
--> $DIR/unresolved_type_param.rs:13:5 --> $DIR/unresolved_type_param.rs:12:5
| |
LL | bar().await; 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` help: consider specifying the generic argument
--> $DIR/unresolved_type_param.rs:13:10
| |
LL | bar().await; LL | bar::<T>().await;
| ^^^^^^ | +++++
error[E0698]: type inside `async fn` body must be known in this context error: aborting due to previous error
--> $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[E0698]: type inside `async fn` body must be known in this context For more information about this error, try `rustc --explain E0282`.
--> $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`.

View file

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

View file

@ -1,91 +1,8 @@
error: generator cannot be sent between threads safely 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); LL | assert_send(g);
| ^ generator is not `Send` | ^^^^^^^^^^^ 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`
... ...
LL | / type_combinations!( LL | / type_combinations!(
LL | | // OK LL | | // OK
@ -105,8 +22,6 @@ LL | let g = move || match drop($name::Client { ..$name::Client::d
... ...
LL | _ => yield, LL | _ => yield,
| ^^^^^ yield occurs here, with `$name::Client::default()` maybe used later | ^^^^^ yield occurs here, with `$name::Client::default()` maybe used later
LL | };
| - `$name::Client::default()` is later dropped here
... ...
LL | / type_combinations!( LL | / type_combinations!(
LL | | // OK 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) = 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 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); LL | assert_send(g);
| ^ generator is not `Send` | ^^^^^^^^^^^ 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`
... ...
LL | / type_combinations!( LL | / type_combinations!(
LL | | // OK LL | | // OK
@ -188,8 +62,6 @@ LL | let g = move || match drop($name::Client { ..$name::Client::d
... ...
LL | _ => yield, LL | _ => yield,
| ^^^^^ yield occurs here, with `$name::Client::default()` maybe used later | ^^^^^ yield occurs here, with `$name::Client::default()` maybe used later
LL | };
| - `$name::Client::default()` is later dropped here
... ...
LL | / type_combinations!( LL | / type_combinations!(
LL | | // OK 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) = 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 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); LL | assert_send(g);
| ^ generator is not `Send` | ^^^^^^^^^^^ 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`
... ...
LL | / type_combinations!( LL | / type_combinations!(
LL | | // OK LL | | // OK
@ -271,8 +102,6 @@ LL | let g = move || match drop($name::Client { ..$name::Client::d
... ...
LL | _ => yield, LL | _ => yield,
| ^^^^^ yield occurs here, with `$name::Client::default()` maybe used later | ^^^^^ yield occurs here, with `$name::Client::default()` maybe used later
LL | };
| - `$name::Client::default()` is later dropped here
... ...
LL | / type_combinations!( LL | / type_combinations!(
LL | | // OK LL | | // OK
@ -289,46 +118,5 @@ LL | fn assert_send<T: Send>(_thing: T) {}
| ^^^^ required by this bound in `assert_send` | ^^^^ 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) = 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 error: aborting due to 3 previous errors
--> $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

View file

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

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 error: generator cannot be sent between threads safely
--> $DIR/issue-57017.rs:30:25 --> $DIR/issue-57017.rs:31:25
| |
LL | assert_send(g); LL | assert_send(g);
| ^ generator is not `Send` | ^ generator is not `Send`
@ -15,7 +15,7 @@ LL | | );
| |
= help: the trait `Sync` is not implemented for `copy::unsync::Client` = help: the trait `Sync` is not implemented for `copy::unsync::Client`
note: generator is not `Send` as this value is used across a yield 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()) { LL | let g = move || match drop(&$name::unsync::Client::default()) {
| --------------------------------- has type `&copy::unsync::Client` which is not `Send` | --------------------------------- has type `&copy::unsync::Client` which is not `Send`
@ -33,14 +33,14 @@ LL | | }
LL | | ); LL | | );
| |_____- in this macro invocation | |_____- in this macro invocation
note: required by a bound in `assert_send` 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) {} LL | fn assert_send<T: Send>(_thing: T) {}
| ^^^^ required by this bound in `assert_send` | ^^^^ 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) = 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 error: generator cannot be sent between threads safely
--> $DIR/issue-57017.rs:42:25 --> $DIR/issue-57017.rs:43:25
| |
LL | assert_send(g); LL | assert_send(g);
| ^ generator is not `Send` | ^ generator is not `Send`
@ -54,9 +54,9 @@ LL | | }
LL | | ); LL | | );
| |_____- in this macro invocation | |_____- 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 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()) { LL | let g = move || match drop($name::unsend::Client::default()) {
| -------------------------------- has type `copy::unsend::Client` which is not `Send` | -------------------------------- has type `copy::unsend::Client` which is not `Send`
@ -74,14 +74,14 @@ LL | | }
LL | | ); LL | | );
| |_____- in this macro invocation | |_____- in this macro invocation
note: required by a bound in `assert_send` 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) {} LL | fn assert_send<T: Send>(_thing: T) {}
| ^^^^ required by this bound in `assert_send` | ^^^^ 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) = 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 error: generator cannot be sent between threads safely
--> $DIR/issue-57017.rs:30:25 --> $DIR/issue-57017.rs:31:25
| |
LL | assert_send(g); LL | assert_send(g);
| ^ generator is not `Send` | ^ generator is not `Send`
@ -97,7 +97,7 @@ LL | | );
| |
= help: the trait `Sync` is not implemented for `derived_drop::unsync::Client` = 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 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()) { LL | let g = move || match drop(&$name::unsync::Client::default()) {
| --------------------------------- has type `&derived_drop::unsync::Client` which is not `Send` | --------------------------------- has type `&derived_drop::unsync::Client` which is not `Send`
@ -115,14 +115,14 @@ LL | | }
LL | | ); LL | | );
| |_____- in this macro invocation | |_____- in this macro invocation
note: required by a bound in `assert_send` 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) {} LL | fn assert_send<T: Send>(_thing: T) {}
| ^^^^ required by this bound in `assert_send` | ^^^^ 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) = 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 error: generator cannot be sent between threads safely
--> $DIR/issue-57017.rs:42:25 --> $DIR/issue-57017.rs:43:25
| |
LL | assert_send(g); LL | assert_send(g);
| ^ generator is not `Send` | ^ generator is not `Send`
@ -136,9 +136,9 @@ LL | | }
LL | | ); LL | | );
| |_____- in this macro invocation | |_____- 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 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()) { LL | let g = move || match drop($name::unsend::Client::default()) {
| -------------------------------- has type `derived_drop::unsend::Client` which is not `Send` | -------------------------------- has type `derived_drop::unsend::Client` which is not `Send`
@ -156,14 +156,14 @@ LL | | }
LL | | ); LL | | );
| |_____- in this macro invocation | |_____- in this macro invocation
note: required by a bound in `assert_send` 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) {} LL | fn assert_send<T: Send>(_thing: T) {}
| ^^^^ required by this bound in `assert_send` | ^^^^ 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) = 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 error: generator cannot be sent between threads safely
--> $DIR/issue-57017.rs:30:25 --> $DIR/issue-57017.rs:31:25
| |
LL | assert_send(g); LL | assert_send(g);
| ^ generator is not `Send` | ^ generator is not `Send`
@ -179,7 +179,7 @@ LL | | );
| |
= help: the trait `Sync` is not implemented for `significant_drop::unsync::Client` = 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 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()) { LL | let g = move || match drop(&$name::unsync::Client::default()) {
| --------------------------------- has type `&significant_drop::unsync::Client` which is not `Send` | --------------------------------- has type `&significant_drop::unsync::Client` which is not `Send`
@ -197,14 +197,14 @@ LL | | }
LL | | ); LL | | );
| |_____- in this macro invocation | |_____- in this macro invocation
note: required by a bound in `assert_send` 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) {} LL | fn assert_send<T: Send>(_thing: T) {}
| ^^^^ required by this bound in `assert_send` | ^^^^ 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) = 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 error: generator cannot be sent between threads safely
--> $DIR/issue-57017.rs:42:25 --> $DIR/issue-57017.rs:43:25
| |
LL | assert_send(g); LL | assert_send(g);
| ^ generator is not `Send` | ^ generator is not `Send`
@ -218,9 +218,9 @@ LL | | }
LL | | ); LL | | );
| |_____- in this macro invocation | |_____- 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 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()) { LL | let g = move || match drop($name::unsend::Client::default()) {
| -------------------------------- has type `significant_drop::unsend::Client` which is not `Send` | -------------------------------- has type `significant_drop::unsend::Client` which is not `Send`
@ -238,7 +238,7 @@ LL | | }
LL | | ); LL | | );
| |_____- in this macro invocation | |_____- in this macro invocation
note: required by a bound in `assert_send` 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) {} LL | fn assert_send<T: Send>(_thing: T) {}
| ^^^^ required by this bound in `assert_send` | ^^^^ required by this bound in `assert_send`

View file

@ -2,6 +2,7 @@
// [drop_tracking] compile-flags: -Zdrop-tracking // [drop_tracking] compile-flags: -Zdrop-tracking
// [drop_tracking_mir] compile-flags: -Zdrop-tracking-mir // [drop_tracking_mir] compile-flags: -Zdrop-tracking-mir
// [drop_tracking] build-pass // [drop_tracking] build-pass
// [drop_tracking_mir] build-pass
#![feature(generators, negative_impls)] #![feature(generators, negative_impls)]
@ -28,9 +29,9 @@ macro_rules! type_combinations {
_status => yield, _status => yield,
}; };
assert_send(g); assert_send(g);
//[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,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,drop_tracking_mir]~| 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 // 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, _status => yield,
}; };
assert_send(g); assert_send(g);
//[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,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,drop_tracking_mir]~| 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 error: generator cannot be sent between threads safely
--> $DIR/issue-57478.rs:12:17 --> $DIR/issue-57478.rs:13:17
| |
LL | assert_send(|| { LL | assert_send(|| {
| _________________^ | _________________^
LL | | LL | |
LL | |
LL | | let guard = Foo; LL | | let guard = Foo;
LL | | drop(guard); LL | | drop(guard);
LL | | yield; LL | | yield;
LL | | }) LL | | })
| |_____^ generator is not `Send` | |_____^ 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 note: generator is not `Send` as this value is used across a yield
--> $DIR/issue-57478.rs:17:9 --> $DIR/issue-57478.rs:17:9
| |

View file

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

View file

@ -1,8 +1,8 @@
error: generator cannot be sent between threads safely 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); LL | require_send(send_gen);
| ^^^^^^^^ generator is not `Send` | ^^^^^^^^^^^^ generator is not `Send`
| |
= help: the trait `Sync` is not implemented for `RefCell<i32>` = 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 = 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 |
LL | yield; LL | yield;
| ^^^^^ yield occurs here, with `_non_send_gen` maybe used later | ^^^^^ 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` note: required by a bound in `require_send`
--> $DIR/issue-68112.rs:25:25 --> $DIR/issue-68112.rs:25:25
| |
@ -24,12 +21,10 @@ LL | fn require_send(_: impl Send) {}
| ^^^^ required by this bound in `require_send` | ^^^^ required by this bound in `require_send`
error[E0277]: `RefCell<i32>` cannot be shared between threads safely 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); LL | require_send(send_gen);
| ------------ ^^^^^^^^ `RefCell<i32>` cannot be shared between threads safely | ^^^^^^^^^^^^ `RefCell<i32>` cannot be shared between threads safely
| |
| required by a bound introduced by this call
| |
= help: the trait `Sync` is not implemented for `RefCell<i32>` = 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 = 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>>> { 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 note: required because it's used within this generator
--> $DIR/issue-68112.rs:63:20 --> $DIR/issue-68112.rs:63:20
| |

View file

@ -11,7 +11,7 @@ use std::{
}; };
pub struct Ready<T>(Option<T>); pub struct Ready<T>(Option<T>);
impl<T> Generator<()> for Ready<T> { impl<T: Unpin> Generator<()> for Ready<T> {
type Return = T; type Return = T;
type Yield = (); type Yield = ();
fn resume(mut self: Pin<&mut Self>, _args: ()) -> GeneratorState<(), T> { fn resume(mut self: Pin<&mut Self>, _args: ()) -> GeneratorState<(), T> {
@ -39,7 +39,7 @@ fn test1() {
yield; yield;
//~^ NOTE yield occurs here //~^ NOTE yield occurs here
//~| NOTE value is used across a yield //~| NOTE value is used across a yield
}; //~ NOTE later dropped here }; //[no_drop_tracking,drop_tracking]~ NOTE later dropped here
require_send(send_gen); require_send(send_gen);
//~^ ERROR generator cannot be sent between threads //~^ ERROR generator cannot be sent between threads
//~| NOTE not `Send` //~| NOTE not `Send`
@ -68,7 +68,7 @@ fn test2() {
//~^ ERROR `RefCell<i32>` cannot be shared between threads safely //~^ ERROR `RefCell<i32>` cannot be shared between threads safely
//~| NOTE `RefCell<i32>` cannot be shared between threads safely //~| NOTE `RefCell<i32>` cannot be shared between threads safely
//~| NOTE required for //~| 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 captures the following types
//~| NOTE use `std::sync::RwLock` instead //~| 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 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 | assert_sync(|| {
| _________________^ | _________________^
LL | | LL | |
LL | | let a = Cell::new(2); LL | | let a = NotSync;
LL | | yield; LL | | yield;
LL | | drop(a);
LL | | }); LL | | });
| |_____^ generator is not `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>` = help: within `[generator@$DIR/not-send-sync.rs:17:17: 17:19]`, the trait `Sync` is not implemented for `NotSync`
= note: if you want to do aliasing and mutation between multiple threads, use `std::sync::RwLock` or `std::sync::atomic::AtomicI32` instead
note: generator is not `Sync` as this value is used across a yield 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); LL | let a = NotSync;
| - has type `Cell<i32>` which is not `Sync` | - has type `NotSync` which is not `Sync`
LL | yield; LL | yield;
| ^^^^^ yield occurs here, with `a` maybe used later | ^^^^^ yield occurs here, with `a` maybe used later
LL | drop(a);
LL | }); LL | });
| - `a` is later dropped here | - `a` is later dropped here
note: required by a bound in `assert_sync` 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) {} LL | fn assert_sync<T: Sync>(_: T) {}
| ^^^^ required by this bound in `assert_sync` | ^^^^ 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 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 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 | assert_sync(|| {
| _________________^ | ^^^^^^^^^^^ generator is not `Sync`
LL | |
LL | | let a = Cell::new(2);
LL | | yield;
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>` = help: within `[generator@$DIR/not-send-sync.rs:17:17: 17:19]`, the trait `Sync` is not implemented for `NotSync`
= note: if you want to do aliasing and mutation between multiple threads, use `std::sync::RwLock` or `std::sync::atomic::AtomicI32` instead
note: generator is not `Sync` as this value is used across a yield 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); LL | let a = NotSync;
| - has type `Cell<i32>` which is not `Sync` | - has type `NotSync` which is not `Sync`
LL | yield; LL | yield;
| ^^^^^ yield occurs here, with `a` maybe used later | ^^^^^ yield occurs here, with `a` maybe used later
LL | });
| - `a` is later dropped here
note: required by a bound in `assert_sync` 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) {} LL | fn assert_sync<T: Sync>(_: T) {}
| ^^^^ required by this bound in `assert_sync` | ^^^^ 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 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 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 | assert_sync(|| {
| _________________^ | _________________^
LL | | LL | |
LL | | let a = Cell::new(2); LL | | let a = NotSync;
LL | | yield; LL | | yield;
LL | | drop(a);
LL | | }); LL | | });
| |_____^ generator is not `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>` = help: within `[generator@$DIR/not-send-sync.rs:17:17: 17:19]`, the trait `Sync` is not implemented for `NotSync`
= note: if you want to do aliasing and mutation between multiple threads, use `std::sync::RwLock` or `std::sync::atomic::AtomicI32` instead
note: generator is not `Sync` as this value is used across a yield 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); LL | let a = NotSync;
| - has type `Cell<i32>` which is not `Sync` | - has type `NotSync` which is not `Sync`
LL | yield; LL | yield;
| ^^^^^ yield occurs here, with `a` maybe used later | ^^^^^ yield occurs here, with `a` maybe used later
LL | drop(a);
LL | }); LL | });
| - `a` is later dropped here | - `a` is later dropped here
note: required by a bound in `assert_sync` 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) {} LL | fn assert_sync<T: Sync>(_: T) {}
| ^^^^ required by this bound in `assert_sync` | ^^^^ 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 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] compile-flags: -Zdrop-tracking
// [drop_tracking_mir] compile-flags: -Zdrop-tracking-mir // [drop_tracking_mir] compile-flags: -Zdrop-tracking-mir
#![feature(generators)] #![feature(generators)]
#![feature(negative_impls)]
use std::cell::Cell; struct NotSend;
struct NotSync;
impl !Send for NotSend {}
impl !Sync for NotSync {}
fn main() { fn main() {
fn assert_sync<T: Sync>(_: T) {} fn assert_sync<T: Sync>(_: T) {}
@ -11,14 +16,15 @@ fn main() {
assert_sync(|| { assert_sync(|| {
//~^ ERROR: generator cannot be shared between threads safely //~^ ERROR: generator cannot be shared between threads safely
let a = Cell::new(2); let a = NotSync;
yield; yield;
drop(a);
}); });
let a = Cell::new(2);
assert_send(|| { assert_send(|| {
//~^ ERROR: E0277 //~^ ERROR: generator cannot be sent between threads safely
drop(&a); let a = NotSend;
yield; yield;
drop(a);
}); });
} }

View file

@ -1,91 +1,8 @@
error: generator cannot be sent between threads safely error: generator cannot be sent between threads safely
--> $DIR/parent-expression.rs:27:25 --> $DIR/parent-expression.rs:27:13
| |
LL | assert_send(g); LL | assert_send(g);
| ^ generator is not `Send` | ^^^^^^^^^^^ 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`
... ...
LL | / type_combinations!( LL | / type_combinations!(
LL | | // OK LL | | // OK
@ -105,8 +22,6 @@ LL | let g = move || match drop($name::Client { ..$name::Client::d
... ...
LL | _ => yield, LL | _ => yield,
| ^^^^^ yield occurs here, with `$name::Client::default()` maybe used later | ^^^^^ yield occurs here, with `$name::Client::default()` maybe used later
LL | };
| - `$name::Client::default()` is later dropped here
... ...
LL | / type_combinations!( LL | / type_combinations!(
LL | | // OK 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) = 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 error: generator cannot be sent between threads safely
--> $DIR/parent-expression.rs:40:25 --> $DIR/parent-expression.rs:27:13
| |
LL | assert_send(g); LL | assert_send(g);
| ^ generator is not `Send` | ^^^^^^^^^^^ 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`
... ...
LL | / type_combinations!( LL | / type_combinations!(
LL | | // OK LL | | // OK
@ -188,8 +62,6 @@ LL | let g = move || match drop($name::Client { ..$name::Client::d
... ...
LL | _ => yield, LL | _ => yield,
| ^^^^^ yield occurs here, with `$name::Client::default()` maybe used later | ^^^^^ yield occurs here, with `$name::Client::default()` maybe used later
LL | };
| - `$name::Client::default()` is later dropped here
... ...
LL | / type_combinations!( LL | / type_combinations!(
LL | | // OK 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) = 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 error: generator cannot be sent between threads safely
--> $DIR/parent-expression.rs:40:25 --> $DIR/parent-expression.rs:27:13
| |
LL | assert_send(g); LL | assert_send(g);
| ^ generator is not `Send` | ^^^^^^^^^^^ 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`
... ...
LL | / type_combinations!( LL | / type_combinations!(
LL | | // OK LL | | // OK
@ -271,8 +102,6 @@ LL | let g = move || match drop($name::Client { ..$name::Client::d
... ...
LL | _ => yield, LL | _ => yield,
| ^^^^^ yield occurs here, with `$name::Client::default()` maybe used later | ^^^^^ yield occurs here, with `$name::Client::default()` maybe used later
LL | };
| - `$name::Client::default()` is later dropped here
... ...
LL | / type_combinations!( LL | / type_combinations!(
LL | | // OK LL | | // OK
@ -289,46 +118,5 @@ LL | fn assert_send<T: Send>(_thing: T) {}
| ^^^^ required by this bound in `assert_send` | ^^^^ 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) = 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 error: aborting due to 3 previous errors
--> $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

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

View file

@ -1,17 +1,16 @@
error: generator cannot be sent between threads safely error: generator cannot be sent between threads safely
--> $DIR/partial-drop.rs:16:17 --> $DIR/partial-drop.rs:17:17
| |
LL | assert_send(|| { LL | assert_send(|| {
| _________________^ | _________________^
LL | | LL | |
LL | | // FIXME: it would be nice to make this work.
LL | | let guard = Bar { foo: Foo, x: 42 }; LL | | let guard = Bar { foo: Foo, x: 42 };
LL | | drop(guard.foo); LL | | drop(guard.foo);
LL | | yield; LL | | yield;
LL | | }); LL | | });
| |_____^ generator is not `Send` | |_____^ 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 note: generator is not `Send` as this value is used across a yield
--> $DIR/partial-drop.rs:21:9 --> $DIR/partial-drop.rs:21:9
| |
@ -23,7 +22,7 @@ LL | yield;
LL | }); LL | });
| - `guard` is later dropped here | - `guard` is later dropped here
note: required by a bound in `assert_send` 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) {} LL | fn assert_send<T: Send>(_: T) {}
| ^^^^ required by this bound in `assert_send` | ^^^^ required by this bound in `assert_send`
@ -34,16 +33,16 @@ error: generator cannot be sent between threads safely
LL | assert_send(|| { LL | assert_send(|| {
| _________________^ | _________________^
LL | | LL | |
LL | | // FIXME: it would be nice to make this work.
LL | | let guard = Bar { foo: Foo, x: 42 }; LL | | let guard = Bar { foo: Foo, x: 42 };
... | LL | | let Bar { foo, x } = guard;
LL | | drop(foo);
LL | | yield; LL | | yield;
LL | | }); LL | | });
| |_____^ generator is not `Send` | |_____^ generator is not `Send`
| |
= help: within `[generator@$DIR/partial-drop.rs:24:17: 24:19]`, the trait `Send` is not implemented for `Foo` = 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 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 }; LL | let guard = Bar { foo: Foo, x: 42 };
| ----- has type `Bar` which is not `Send` | ----- has type `Bar` which is not `Send`
@ -53,40 +52,10 @@ LL | yield;
LL | }); LL | });
| - `guard` is later dropped here | - `guard` is later dropped here
note: required by a bound in `assert_send` 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) {} LL | fn assert_send<T: Send>(_: T) {}
| ^^^^ required by this bound in `assert_send` | ^^^^ required by this bound in `assert_send`
error: generator cannot be sent between threads safely error: aborting due to 2 previous errors
--> $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,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 error: generator cannot be sent between threads safely
--> $DIR/partial-drop.rs:16:17 --> $DIR/partial-drop.rs:17:17
| |
LL | assert_send(|| { LL | assert_send(|| {
| _________________^ | _________________^
LL | | LL | |
LL | | // FIXME: it would be nice to make this work.
LL | | let guard = Bar { foo: Foo, x: 42 }; LL | | let guard = Bar { foo: Foo, x: 42 };
LL | | drop(guard.foo); LL | | drop(guard.foo);
LL | | yield; LL | | yield;
LL | | }); LL | | });
| |_____^ generator is not `Send` | |_____^ 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 note: generator is not `Send` as this value is used across a yield
--> $DIR/partial-drop.rs:21:9 --> $DIR/partial-drop.rs:21:9
| |
@ -23,7 +22,7 @@ LL | yield;
LL | }); LL | });
| - `guard` is later dropped here | - `guard` is later dropped here
note: required by a bound in `assert_send` 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) {} LL | fn assert_send<T: Send>(_: T) {}
| ^^^^ required by this bound in `assert_send` | ^^^^ required by this bound in `assert_send`
@ -34,46 +33,16 @@ error: generator cannot be sent between threads safely
LL | assert_send(|| { LL | assert_send(|| {
| _________________^ | _________________^
LL | | LL | |
LL | | // FIXME: it would be nice to make this work.
LL | | let guard = Bar { foo: Foo, x: 42 }; LL | | let guard = Bar { foo: Foo, x: 42 };
... | LL | | let Bar { foo, x } = guard;
LL | | drop(foo);
LL | | yield; LL | | yield;
LL | | }); LL | | });
| |_____^ generator is not `Send` | |_____^ generator is not `Send`
| |
= help: within `[generator@$DIR/partial-drop.rs:24:17: 24:19]`, the trait `Send` is not implemented for `Foo` = 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 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`
...
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; LL | let Bar { foo, x } = guard;
| --- has type `Foo` which is not `Send` | --- has type `Foo` which is not `Send`
@ -83,10 +52,10 @@ LL | yield;
LL | }); LL | });
| - `foo` is later dropped here | - `foo` is later dropped here
note: required by a bound in `assert_send` 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) {} LL | fn assert_send<T: Send>(_: T) {}
| ^^^^ required by this bound in `assert_send` | ^^^^ 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 // revisions: no_drop_tracking drop_tracking drop_tracking_mir
// [drop_tracking] compile-flags: -Zdrop-tracking // [drop_tracking] compile-flags: -Zdrop-tracking
// [drop_tracking_mir] compile-flags: -Zdrop-tracking-mir // [drop_tracking_mir] compile-flags: -Zdrop-tracking-mir
// [drop_tracking_mir] check-pass
#![feature(negative_impls, generators)] #![feature(negative_impls, generators)]
@ -14,26 +15,14 @@ struct Bar {
fn main() { fn main() {
assert_send(|| { assert_send(|| {
//~^ ERROR generator cannot be sent between threads safely //[no_drop_tracking,drop_tracking]~^ ERROR generator cannot be sent between threads safely
// FIXME: it would be nice to make this work.
let guard = Bar { foo: Foo, x: 42 }; let guard = Bar { foo: Foo, x: 42 };
drop(guard.foo); drop(guard.foo);
yield; yield;
}); });
assert_send(|| { assert_send(|| {
//~^ ERROR generator cannot be sent between threads safely //[no_drop_tracking,drop_tracking]~^ 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.
let guard = Bar { foo: Foo, x: 42 }; let guard = Bar { foo: Foo, x: 42 };
let Bar { foo, x } = guard; let Bar { foo, x } = guard;
drop(foo); 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 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); LL | require_send(send_gen);
| ^^^^^^^^ generator is not `Send` | ^^^^^^^^^^^^ generator is not `Send`
| |
= help: the trait `Sync` is not implemented for `RefCell<i32>` = 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 = 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` | ------------- has type `Opaque(DefId(0:34 ~ generator_print_verbose_1[749a]::make_non_send_generator::{opaque#0}), [])` which is not `Send`
LL | yield; LL | yield;
| ^^^^^ yield occurs here, with `_non_send_gen` maybe used later | ^^^^^ 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` note: required by a bound in `require_send`
--> $DIR/generator-print-verbose-1.rs:29:25 --> $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` | ^^^^ required by this bound in `require_send`
error[E0277]: `RefCell<i32>` cannot be shared between threads safely 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); LL | require_send(send_gen);
| ------------ ^^^^^^^^ `RefCell<i32>` cannot be shared between threads safely | ^^^^^^^^^^^^ `RefCell<i32>` cannot be shared between threads safely
| |
| required by a bound introduced by this call
| |
= help: the trait `Sync` is not implemented for `RefCell<i32>` = 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 = 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>>> { 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 note: required because it's used within this generator
--> $DIR/generator-print-verbose-1.rs:55:20 --> $DIR/generator-print-verbose-1.rs:55:20
| |

View file

@ -15,7 +15,7 @@ use std::{
}; };
pub struct Ready<T>(Option<T>); pub struct Ready<T>(Option<T>);
impl<T> Generator<()> for Ready<T> { impl<T: Unpin> Generator<()> for Ready<T> {
type Return = T; type Return = T;
type Yield = (); type Yield = ();
fn resume(mut self: Pin<&mut Self>, _args: ()) -> GeneratorState<(), T> { 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 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 | assert_sync(|| {
| _________________^ | _________________^
LL | | LL | |
LL | | let a = Cell::new(2); LL | | let a = NotSync;
LL | | yield; LL | | yield;
LL | | drop(a);
LL | | }); LL | | });
| |_____^ generator is not `Sync` | |_____^ generator is not `Sync`
| |
= help: within `[main::{closure#0} upvar_tys=() {Cell<i32>, ()}]`, the trait `Sync` is not implemented for `Cell<i32>` = help: within `[main::{closure#0} upvar_tys=() {NotSync, ()}]`, the trait `Sync` is not implemented for `NotSync`
= note: if you want to do aliasing and mutation between multiple threads, use `std::sync::RwLock` or `std::sync::atomic::AtomicI32` instead
note: generator is not `Sync` as this value is used across a yield 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); LL | let a = NotSync;
| - has type `Cell<i32>` which is not `Sync` | - has type `NotSync` which is not `Sync`
LL | yield; LL | yield;
| ^^^^^ yield occurs here, with `a` maybe used later | ^^^^^ yield occurs here, with `a` maybe used later
LL | drop(a);
LL | }); LL | });
| - `a` is later dropped here | - `a` is later dropped here
note: required by a bound in `assert_sync` 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) {} LL | fn assert_sync<T: Sync>(_: T) {}
| ^^^^ required by this bound in `assert_sync` | ^^^^ 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 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 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 | assert_sync(|| {
| _________________^ | ^^^^^^^^^^^ generator is not `Sync`
LL | |
LL | | let a = Cell::new(2);
LL | | yield;
LL | | });
| |_____^ generator is not `Sync`
| |
= help: within `[main::{closure#0} upvar_tys=() {Cell<i32>, ()}]`, the trait `Sync` is not implemented for `Cell<i32>` = help: within `[main::{closure#0} upvar_tys=() [main::{closure#0}]]`, the trait `Sync` is not implemented for `NotSync`
= note: if you want to do aliasing and mutation between multiple threads, use `std::sync::RwLock` or `std::sync::atomic::AtomicI32` instead
note: generator is not `Sync` as this value is used across a yield 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); LL | let a = NotSync;
| - has type `Cell<i32>` which is not `Sync` | - has type `NotSync` which is not `Sync`
LL | yield; LL | yield;
| ^^^^^ yield occurs here, with `a` maybe used later | ^^^^^ yield occurs here, with `a` maybe used later
LL | });
| - `a` is later dropped here
note: required by a bound in `assert_sync` 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) {} LL | fn assert_sync<T: Sync>(_: T) {}
| ^^^^ required by this bound in `assert_sync` | ^^^^ 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 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 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 | assert_sync(|| {
| _________________^ | _________________^
LL | | LL | |
LL | | let a = Cell::new(2); LL | | let a = NotSync;
LL | | yield; LL | | yield;
LL | | drop(a);
LL | | }); LL | | });
| |_____^ generator is not `Sync` | |_____^ generator is not `Sync`
| |
= help: within `[main::{closure#0} upvar_tys=() {Cell<i32>, ()}]`, the trait `Sync` is not implemented for `Cell<i32>` = help: within `[main::{closure#0} upvar_tys=() {NotSync, ()}]`, the trait `Sync` is not implemented for `NotSync`
= note: if you want to do aliasing and mutation between multiple threads, use `std::sync::RwLock` or `std::sync::atomic::AtomicI32` instead
note: generator is not `Sync` as this value is used across a yield 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); LL | let a = NotSync;
| - has type `Cell<i32>` which is not `Sync` | - has type `NotSync` which is not `Sync`
LL | yield; LL | yield;
| ^^^^^ yield occurs here, with `a` maybe used later | ^^^^^ yield occurs here, with `a` maybe used later
LL | drop(a);
LL | }); LL | });
| - `a` is later dropped here | - `a` is later dropped here
note: required by a bound in `assert_sync` 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) {} LL | fn assert_sync<T: Sync>(_: T) {}
| ^^^^ required by this bound in `assert_sync` | ^^^^ 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 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 // Same as test/ui/generator/not-send-sync.rs
#![feature(generators)] #![feature(generators)]
#![feature(negative_impls)]
use std::cell::Cell; struct NotSend;
struct NotSync;
impl !Send for NotSend {}
impl !Sync for NotSync {}
fn main() { fn main() {
fn assert_sync<T: Sync>(_: T) {} fn assert_sync<T: Sync>(_: T) {}
@ -14,14 +19,15 @@ fn main() {
assert_sync(|| { assert_sync(|| {
//~^ ERROR: generator cannot be shared between threads safely //~^ ERROR: generator cannot be shared between threads safely
let a = Cell::new(2); let a = NotSync;
yield; yield;
drop(a);
}); });
let a = Cell::new(2);
assert_send(|| { assert_send(|| {
//~^ ERROR: E0277 //~^ ERROR: generator cannot be sent between threads safely
drop(&a); let a = NotSend;
yield; 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 {} 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 { fn foo<T>() -> Self::E {
async {} async {}
//~^ ERROR type parameter `T` is part of concrete type but not used in parameter list for the `impl Trait` type alias //~^ 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>` | ---------- returning here with type `Foo<impl Quux>`
... ...
LL | fn bar() -> 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 error[E0720]: cannot resolve opaque type
--> $DIR/infinite-impl-trait-issue-38064.rs:14:13 --> $DIR/infinite-impl-trait-issue-38064.rs:14:13
| |
LL | fn foo() -> impl Quux { LL | fn foo() -> impl Quux {
| --------- returning this opaque type `Bar<impl Quux>` | --------- returning this type `Bar<impl Quux>`
... ...
LL | fn bar() -> impl Quux { LL | fn bar() -> impl Quux {
| ^^^^^^^^^ recursive opaque type | ^^^^^^^^^ recursive opaque type

View file

@ -112,16 +112,8 @@ LL | (substs_change::<&T>(),)
error[E0720]: cannot resolve opaque type error[E0720]: cannot resolve opaque type
--> $DIR/recursive-impl-trait-type-indirect.rs:76:24 --> $DIR/recursive-impl-trait-type-indirect.rs:76:24
| |
LL | fn generator_hold() -> impl Sized { LL | fn generator_hold() -> impl Sized {
| ^^^^^^^^^^ recursive opaque type | ^^^^^^^^^^ 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]`
error[E0720]: cannot resolve opaque type error[E0720]: cannot resolve opaque type
--> $DIR/recursive-impl-trait-type-indirect.rs:90:26 --> $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 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; LL | let no = No {};
| ^^^^^ ------ the value is held across this suspend point | ^^
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 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 note: the lint level is defined here
--> $DIR/dedup.rs:6:9 --> $DIR/dedup.rs:6:9
| |

View file

@ -1,14 +1,16 @@
error: `No` held across a suspend point, but should not be 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; LL | let no = No {};
| ^^^^^ ------ the value is held across this suspend point | ^^
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 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 note: the lint level is defined here
--> $DIR/dedup.rs:6:9 --> $DIR/dedup.rs:6:9
| |

View file

@ -1,19 +1,33 @@
error: `No` held across a suspend point, but should not be 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; LL | let no = No {};
| ^^^^^ ------ the value is held across this suspend point | ^^
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 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 note: the lint level is defined here
--> $DIR/dedup.rs:6:9 --> $DIR/dedup.rs:6:9
| |
LL | #![deny(must_not_suspend)] 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() { 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() { fn main() {

View file

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

View file

@ -23,6 +23,7 @@ impl Bar {
other().await; other().await;
let _g = &*guard;
*guard = Umm { i: 2 } *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 let _guard2 = r#dyn(); //~ ERROR boxed `Wow` trait object held across
other().await; other().await;
drop(_guard1);
drop(_guard2);
} }
fn main() { fn main() {

View file

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

View file

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

View file

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

View file

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

View file

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