mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-22 14:55:26 +00:00
Test the 3 generator handling versions for generator/async tests.
This commit is contained in:
parent
a20078f044
commit
9259da51ed
106
tests/ui/async-await/async-await-let-else.drop_tracking.stderr
Normal file
106
tests/ui/async-await/async-await-let-else.drop_tracking.stderr
Normal file
@ -0,0 +1,106 @@
|
||||
error: future cannot be sent between threads safely
|
||||
--> $DIR/async-await-let-else.rs:48:13
|
||||
|
|
||||
LL | is_send(foo(Some(true)));
|
||||
| ^^^^^^^^^^^^^^^ future returned by `foo` 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-await-let-else.rs:11:14
|
||||
|
|
||||
LL | let r = Rc::new(());
|
||||
| - has type `Rc<()>` which is not `Send`
|
||||
LL | bar().await
|
||||
| ^^^^^^ await occurs here, with `r` maybe used later
|
||||
LL | };
|
||||
| - `r` is later dropped here
|
||||
note: required by a bound in `is_send`
|
||||
--> $DIR/async-await-let-else.rs:19:15
|
||||
|
|
||||
LL | fn is_send<T: Send>(_: T) {}
|
||||
| ^^^^ required by this bound in `is_send`
|
||||
|
||||
error[E0277]: `Rc<()>` cannot be sent between threads safely
|
||||
--> $DIR/async-await-let-else.rs:50:13
|
||||
|
|
||||
LL | async fn foo2(x: Option<bool>) {
|
||||
| - within this `impl Future<Output = ()>`
|
||||
...
|
||||
LL | is_send(foo2(Some(true)));
|
||||
| ------- ^^^^^^^^^^^^^^^^ `Rc<()>` cannot be sent between threads safely
|
||||
| |
|
||||
| required by a bound introduced by this call
|
||||
|
|
||||
= help: within `impl Future<Output = ()>`, the trait `Send` is not implemented for `Rc<()>`
|
||||
note: required because it's used within this `async fn` body
|
||||
--> $DIR/async-await-let-else.rs:27:29
|
||||
|
|
||||
LL | async fn bar2<T>(_: T) -> ! {
|
||||
| _____________________________^
|
||||
LL | | panic!()
|
||||
LL | | }
|
||||
| |_^
|
||||
= note: required because it captures the following types: `ResumeTy`, `Option<bool>`, `impl Future<Output = !>`, `()`
|
||||
note: required because it's used within this `async fn` body
|
||||
--> $DIR/async-await-let-else.rs:21:32
|
||||
|
|
||||
LL | async fn foo2(x: Option<bool>) {
|
||||
| ________________________________^
|
||||
LL | | let Some(_) = x else {
|
||||
LL | | bar2(Rc::new(())).await
|
||||
LL | | };
|
||||
LL | | }
|
||||
| |_^
|
||||
note: required by a bound in `is_send`
|
||||
--> $DIR/async-await-let-else.rs:19:15
|
||||
|
|
||||
LL | fn is_send<T: Send>(_: T) {}
|
||||
| ^^^^ required by this bound in `is_send`
|
||||
|
||||
error: future cannot be sent between threads safely
|
||||
--> $DIR/async-await-let-else.rs:52:13
|
||||
|
|
||||
LL | is_send(foo3(Some(true)));
|
||||
| ^^^^^^^^^^^^^^^^ future returned by `foo3` 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-await-let-else.rs:33:28
|
||||
|
|
||||
LL | (Rc::new(()), bar().await);
|
||||
| ----------- ^^^^^^ - `Rc::new(())` is later dropped here
|
||||
| | |
|
||||
| | await occurs here, with `Rc::new(())` maybe used later
|
||||
| has type `Rc<()>` which is not `Send`
|
||||
note: required by a bound in `is_send`
|
||||
--> $DIR/async-await-let-else.rs:19:15
|
||||
|
|
||||
LL | fn is_send<T: Send>(_: T) {}
|
||||
| ^^^^ required by this bound in `is_send`
|
||||
|
||||
error: future cannot be sent between threads safely
|
||||
--> $DIR/async-await-let-else.rs:54:13
|
||||
|
|
||||
LL | is_send(foo4(Some(true)));
|
||||
| ^^^^^^^^^^^^^^^^ future returned by `foo4` 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-await-let-else.rs:41:14
|
||||
|
|
||||
LL | let r = Rc::new(());
|
||||
| - has type `Rc<()>` which is not `Send`
|
||||
LL | bar().await;
|
||||
| ^^^^^^ await occurs here, with `r` maybe used later
|
||||
...
|
||||
LL | };
|
||||
| - `r` is later dropped here
|
||||
note: required by a bound in `is_send`
|
||||
--> $DIR/async-await-let-else.rs:19:15
|
||||
|
|
||||
LL | fn is_send<T: Send>(_: T) {}
|
||||
| ^^^^ required by this bound in `is_send`
|
||||
|
||||
error: aborting due to 4 previous errors
|
||||
|
||||
For more information about this error, try `rustc --explain E0277`.
|
@ -0,0 +1,90 @@
|
||||
error: future cannot be sent between threads safely
|
||||
--> $DIR/async-await-let-else.rs:48:13
|
||||
|
|
||||
LL | is_send(foo(Some(true)));
|
||||
| ^^^^^^^^^^^^^^^ future returned by `foo` 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-await-let-else.rs:11:14
|
||||
|
|
||||
LL | let r = Rc::new(());
|
||||
| - has type `Rc<()>` which is not `Send`
|
||||
LL | bar().await
|
||||
| ^^^^^^ await occurs here, with `r` maybe used later
|
||||
LL | };
|
||||
| - `r` is later dropped here
|
||||
note: required by a bound in `is_send`
|
||||
--> $DIR/async-await-let-else.rs:19:15
|
||||
|
|
||||
LL | fn is_send<T: Send>(_: T) {}
|
||||
| ^^^^ required by this bound in `is_send`
|
||||
|
||||
error: future cannot be sent between threads safely
|
||||
--> $DIR/async-await-let-else.rs:50:13
|
||||
|
|
||||
LL | is_send(foo2(Some(true)));
|
||||
| ^^^^^^^^^^^^^^^^ future returned by `foo2` 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-await-let-else.rs:23:26
|
||||
|
|
||||
LL | bar2(Rc::new(())).await
|
||||
| ----------- ^^^^^^ await occurs here, with `Rc::new(())` maybe used later
|
||||
| |
|
||||
| has type `Rc<()>` which is not `Send`
|
||||
LL | };
|
||||
| - `Rc::new(())` is later dropped here
|
||||
note: required by a bound in `is_send`
|
||||
--> $DIR/async-await-let-else.rs:19:15
|
||||
|
|
||||
LL | fn is_send<T: Send>(_: T) {}
|
||||
| ^^^^ required by this bound in `is_send`
|
||||
|
||||
error: future cannot be sent between threads safely
|
||||
--> $DIR/async-await-let-else.rs:52:13
|
||||
|
|
||||
LL | is_send(foo3(Some(true)));
|
||||
| ^^^^^^^^^^^^^^^^ future returned by `foo3` 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-await-let-else.rs:33:28
|
||||
|
|
||||
LL | (Rc::new(()), bar().await);
|
||||
| ----------- ^^^^^^ - `Rc::new(())` is later dropped here
|
||||
| | |
|
||||
| | await occurs here, with `Rc::new(())` maybe used later
|
||||
| has type `Rc<()>` which is not `Send`
|
||||
note: required by a bound in `is_send`
|
||||
--> $DIR/async-await-let-else.rs:19:15
|
||||
|
|
||||
LL | fn is_send<T: Send>(_: T) {}
|
||||
| ^^^^ required by this bound in `is_send`
|
||||
|
||||
error: future cannot be sent between threads safely
|
||||
--> $DIR/async-await-let-else.rs:54:13
|
||||
|
|
||||
LL | is_send(foo4(Some(true)));
|
||||
| ^^^^^^^^^^^^^^^^ future returned by `foo4` 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-await-let-else.rs:41:14
|
||||
|
|
||||
LL | let r = Rc::new(());
|
||||
| - has type `Rc<()>` which is not `Send`
|
||||
LL | bar().await;
|
||||
| ^^^^^^ await occurs here, with `r` maybe used later
|
||||
...
|
||||
LL | };
|
||||
| - `r` is later dropped here
|
||||
note: required by a bound in `is_send`
|
||||
--> $DIR/async-await-let-else.rs:19:15
|
||||
|
|
||||
LL | fn is_send<T: Send>(_: T) {}
|
||||
| ^^^^ required by this bound in `is_send`
|
||||
|
||||
error: aborting due to 4 previous errors
|
||||
|
@ -0,0 +1,90 @@
|
||||
error: future cannot be sent between threads safely
|
||||
--> $DIR/async-await-let-else.rs:48:13
|
||||
|
|
||||
LL | is_send(foo(Some(true)));
|
||||
| ^^^^^^^^^^^^^^^ future returned by `foo` 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-await-let-else.rs:11:14
|
||||
|
|
||||
LL | let r = Rc::new(());
|
||||
| - has type `Rc<()>` which is not `Send`
|
||||
LL | bar().await
|
||||
| ^^^^^^ await occurs here, with `r` maybe used later
|
||||
LL | };
|
||||
| - `r` is later dropped here
|
||||
note: required by a bound in `is_send`
|
||||
--> $DIR/async-await-let-else.rs:19:15
|
||||
|
|
||||
LL | fn is_send<T: Send>(_: T) {}
|
||||
| ^^^^ required by this bound in `is_send`
|
||||
|
||||
error: future cannot be sent between threads safely
|
||||
--> $DIR/async-await-let-else.rs:50:13
|
||||
|
|
||||
LL | is_send(foo2(Some(true)));
|
||||
| ^^^^^^^^^^^^^^^^ future returned by `foo2` 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-await-let-else.rs:23:26
|
||||
|
|
||||
LL | bar2(Rc::new(())).await
|
||||
| ----------- ^^^^^^ await occurs here, with `Rc::new(())` maybe used later
|
||||
| |
|
||||
| has type `Rc<()>` which is not `Send`
|
||||
LL | };
|
||||
| - `Rc::new(())` is later dropped here
|
||||
note: required by a bound in `is_send`
|
||||
--> $DIR/async-await-let-else.rs:19:15
|
||||
|
|
||||
LL | fn is_send<T: Send>(_: T) {}
|
||||
| ^^^^ required by this bound in `is_send`
|
||||
|
||||
error: future cannot be sent between threads safely
|
||||
--> $DIR/async-await-let-else.rs:52:13
|
||||
|
|
||||
LL | is_send(foo3(Some(true)));
|
||||
| ^^^^^^^^^^^^^^^^ future returned by `foo3` 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-await-let-else.rs:33:28
|
||||
|
|
||||
LL | (Rc::new(()), bar().await);
|
||||
| ----------- ^^^^^^ - `Rc::new(())` is later dropped here
|
||||
| | |
|
||||
| | await occurs here, with `Rc::new(())` maybe used later
|
||||
| has type `Rc<()>` which is not `Send`
|
||||
note: required by a bound in `is_send`
|
||||
--> $DIR/async-await-let-else.rs:19:15
|
||||
|
|
||||
LL | fn is_send<T: Send>(_: T) {}
|
||||
| ^^^^ required by this bound in `is_send`
|
||||
|
||||
error: future cannot be sent between threads safely
|
||||
--> $DIR/async-await-let-else.rs:54:13
|
||||
|
|
||||
LL | is_send(foo4(Some(true)));
|
||||
| ^^^^^^^^^^^^^^^^ future returned by `foo4` 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-await-let-else.rs:41:14
|
||||
|
|
||||
LL | let r = Rc::new(());
|
||||
| - has type `Rc<()>` which is not `Send`
|
||||
LL | bar().await;
|
||||
| ^^^^^^ await occurs here, with `r` maybe used later
|
||||
...
|
||||
LL | };
|
||||
| - `r` is later dropped here
|
||||
note: required by a bound in `is_send`
|
||||
--> $DIR/async-await-let-else.rs:19:15
|
||||
|
|
||||
LL | fn is_send<T: Send>(_: T) {}
|
||||
| ^^^^ required by this bound in `is_send`
|
||||
|
||||
error: aborting due to 4 previous errors
|
||||
|
@ -1,7 +1,7 @@
|
||||
// edition:2021
|
||||
// revisions: drop-tracking no-drop-tracking
|
||||
// [drop-tracking] compile-flags: -Zdrop-tracking=yes
|
||||
// [no-drop-tracking] compile-flags: -Zdrop-tracking=no
|
||||
// revisions: no_drop_tracking drop_tracking drop_tracking_mir
|
||||
// [drop_tracking] compile-flags: -Zdrop-tracking
|
||||
// [drop_tracking_mir] compile-flags: -Zdrop-tracking-mir
|
||||
|
||||
use std::rc::Rc;
|
||||
|
||||
|
25
tests/ui/async-await/async-error-span.drop_tracking.stderr
Normal file
25
tests/ui/async-await/async-error-span.drop_tracking.stderr
Normal file
@ -0,0 +1,25 @@
|
||||
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`.
|
@ -0,0 +1,25 @@
|
||||
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`.
|
@ -0,0 +1,25 @@
|
||||
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`.
|
@ -1,3 +1,6 @@
|
||||
// revisions: no_drop_tracking drop_tracking drop_tracking_mir
|
||||
// [drop_tracking] compile-flags: -Zdrop-tracking
|
||||
// [drop_tracking_mir] compile-flags: -Zdrop-tracking-mir
|
||||
// edition:2018
|
||||
|
||||
// Regression test for issue #62382.
|
||||
|
@ -1,5 +1,5 @@
|
||||
error[E0277]: `()` is not a future
|
||||
--> $DIR/async-error-span.rs:7:20
|
||||
--> $DIR/async-error-span.rs:10:20
|
||||
|
|
||||
LL | fn get_future() -> impl Future<Output = ()> {
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^ `()` is not a future
|
||||
@ -8,13 +8,13 @@ LL | fn get_future() -> impl Future<Output = ()> {
|
||||
= 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:13:9
|
||||
--> $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:14:17
|
||||
--> $DIR/async-error-span.rs:17:17
|
||||
|
|
||||
LL | get_future().await;
|
||||
| ^^^^^^
|
||||
|
49
tests/ui/async-await/async-fn-nonsend.drop_tracking.stderr
Normal file
49
tests/ui/async-await/async-fn-nonsend.drop_tracking.stderr
Normal file
@ -0,0 +1,49 @@
|
||||
error: future cannot be sent between threads safely
|
||||
--> $DIR/async-fn-nonsend.rs:72:17
|
||||
|
|
||||
LL | assert_send(non_send_temporary_in_match());
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ future returned by `non_send_temporary_in_match` 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:36:25
|
||||
|
|
||||
LL | match Some(non_send()) {
|
||||
| ---------------- has type `Option<impl Debug>` which is not `Send`
|
||||
LL | Some(_) => fut().await,
|
||||
| ^^^^^^ await occurs here, with `Some(non_send())` maybe used later
|
||||
...
|
||||
LL | }
|
||||
| - `Some(non_send())` 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:74:17
|
||||
|
|
||||
LL | assert_send(non_sync_with_method_call());
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^ future returned by `non_sync_with_method_call` 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:49:14
|
||||
|
|
||||
LL | let f: &mut std::fmt::Formatter = &mut get_formatter();
|
||||
| --------------- has type `Formatter<'_>` which is not `Send`
|
||||
...
|
||||
LL | fut().await;
|
||||
| ^^^^^^ await occurs here, with `get_formatter()` maybe used later
|
||||
LL | }
|
||||
LL | }
|
||||
| - `get_formatter()` is later dropped here
|
||||
note: required by a bound in `assert_send`
|
||||
--> $DIR/async-fn-nonsend.rs:67:24
|
||||
|
|
||||
LL | fn assert_send(_: impl Send) {}
|
||||
| ^^^^ required by this bound in `assert_send`
|
||||
|
||||
error: aborting due to 2 previous errors
|
||||
|
120
tests/ui/async-await/async-fn-nonsend.drop_tracking_mir.stderr
Normal file
120
tests/ui/async-await/async-fn-nonsend.drop_tracking_mir.stderr
Normal file
@ -0,0 +1,120 @@
|
||||
error: future cannot be sent between threads safely
|
||||
--> $DIR/async-fn-nonsend.rs:70:17
|
||||
|
|
||||
LL | assert_send(local_dropped_before_await());
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ future returned by `local_dropped_before_await` is not `Send`
|
||||
|
|
||||
= help: within `impl Future<Output = ()>`, the trait `Send` is not implemented for `Rc<()>`
|
||||
note: future is not `Send` as this value is used across an await
|
||||
--> $DIR/async-fn-nonsend.rs:27:10
|
||||
|
|
||||
LL | let x = non_send();
|
||||
| - has type `impl Debug` which is not `Send`
|
||||
LL | drop(x);
|
||||
LL | fut().await;
|
||||
| ^^^^^^ await occurs here, with `x` maybe used later
|
||||
LL | }
|
||||
| - `x` is later dropped here
|
||||
note: required by a bound in `assert_send`
|
||||
--> $DIR/async-fn-nonsend.rs:67:24
|
||||
|
|
||||
LL | fn assert_send(_: impl Send) {}
|
||||
| ^^^^ required by this bound in `assert_send`
|
||||
|
||||
error: future cannot be sent between threads safely
|
||||
--> $DIR/async-fn-nonsend.rs:72:17
|
||||
|
|
||||
LL | assert_send(non_send_temporary_in_match());
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ future returned by `non_send_temporary_in_match` 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:36:25
|
||||
|
|
||||
LL | match Some(non_send()) {
|
||||
| ---------- has type `impl Debug` which is not `Send`
|
||||
LL | Some(_) => fut().await,
|
||||
| ^^^^^^ await occurs here, with `non_send()` maybe used later
|
||||
...
|
||||
LL | }
|
||||
| - `non_send()` is later dropped here
|
||||
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:74:17
|
||||
|
|
||||
LL | assert_send(non_sync_with_method_call());
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^ future returned by `non_sync_with_method_call` 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:49:14
|
||||
|
|
||||
LL | let f: &mut std::fmt::Formatter = &mut get_formatter();
|
||||
| --------------- has type `Formatter<'_>` which is not `Send`
|
||||
...
|
||||
LL | fut().await;
|
||||
| ^^^^^^ await occurs here, with `get_formatter()` maybe used later
|
||||
LL | }
|
||||
LL | }
|
||||
| - `get_formatter()` is later dropped here
|
||||
note: required by a bound in `assert_send`
|
||||
--> $DIR/async-fn-nonsend.rs:67:24
|
||||
|
|
||||
LL | fn assert_send(_: impl Send) {}
|
||||
| ^^^^ required by this bound in `assert_send`
|
||||
|
||||
error: future cannot be sent between threads safely
|
||||
--> $DIR/async-fn-nonsend.rs:76:17
|
||||
|
|
||||
LL | assert_send(non_sync_with_method_call_panic());
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ future returned by `non_sync_with_method_call_panic` is not `Send`
|
||||
|
|
||||
= help: within `impl Future<Output = ()>`, the trait `Send` is not implemented for `dyn std::fmt::Write`
|
||||
note: future is not `Send` as this value is used across an await
|
||||
--> $DIR/async-fn-nonsend.rs:56:14
|
||||
|
|
||||
LL | let f: &mut std::fmt::Formatter = panic!();
|
||||
| - has type `&mut Formatter<'_>` which is not `Send`
|
||||
LL | if non_sync().fmt(f).unwrap() == () {
|
||||
LL | fut().await;
|
||||
| ^^^^^^ await occurs here, with `f` maybe used later
|
||||
LL | }
|
||||
LL | }
|
||||
| - `f` is later dropped here
|
||||
note: required by a bound in `assert_send`
|
||||
--> $DIR/async-fn-nonsend.rs:67:24
|
||||
|
|
||||
LL | fn assert_send(_: impl Send) {}
|
||||
| ^^^^ required by this bound in `assert_send`
|
||||
|
||||
error: future cannot be sent between threads safely
|
||||
--> $DIR/async-fn-nonsend.rs:78:17
|
||||
|
|
||||
LL | assert_send(non_sync_with_method_call_infinite_loop());
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ future returned by `non_sync_with_method_call_infinite_loop` is not `Send`
|
||||
|
|
||||
= help: within `impl Future<Output = ()>`, the trait `Send` is not implemented for `dyn std::fmt::Write`
|
||||
note: future is not `Send` as this value is used across an await
|
||||
--> $DIR/async-fn-nonsend.rs:63:14
|
||||
|
|
||||
LL | let f: &mut std::fmt::Formatter = loop {};
|
||||
| - has type `&mut Formatter<'_>` which is not `Send`
|
||||
LL | if non_sync().fmt(f).unwrap() == () {
|
||||
LL | fut().await;
|
||||
| ^^^^^^ await occurs here, with `f` maybe used later
|
||||
LL | }
|
||||
LL | }
|
||||
| - `f` is later dropped here
|
||||
note: required by a bound in `assert_send`
|
||||
--> $DIR/async-fn-nonsend.rs:67:24
|
||||
|
|
||||
LL | fn assert_send(_: impl Send) {}
|
||||
| ^^^^ required by this bound in `assert_send`
|
||||
|
||||
error: aborting due to 5 previous errors
|
||||
|
120
tests/ui/async-await/async-fn-nonsend.no_drop_tracking.stderr
Normal file
120
tests/ui/async-await/async-fn-nonsend.no_drop_tracking.stderr
Normal file
@ -0,0 +1,120 @@
|
||||
error: future cannot be sent between threads safely
|
||||
--> $DIR/async-fn-nonsend.rs:70:17
|
||||
|
|
||||
LL | assert_send(local_dropped_before_await());
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ future returned by `local_dropped_before_await` is not `Send`
|
||||
|
|
||||
= help: within `impl Future<Output = ()>`, the trait `Send` is not implemented for `Rc<()>`
|
||||
note: future is not `Send` as this value is used across an await
|
||||
--> $DIR/async-fn-nonsend.rs:27:10
|
||||
|
|
||||
LL | let x = non_send();
|
||||
| - has type `impl Debug` which is not `Send`
|
||||
LL | drop(x);
|
||||
LL | fut().await;
|
||||
| ^^^^^^ await occurs here, with `x` maybe used later
|
||||
LL | }
|
||||
| - `x` is later dropped here
|
||||
note: required by a bound in `assert_send`
|
||||
--> $DIR/async-fn-nonsend.rs:67:24
|
||||
|
|
||||
LL | fn assert_send(_: impl Send) {}
|
||||
| ^^^^ required by this bound in `assert_send`
|
||||
|
||||
error: future cannot be sent between threads safely
|
||||
--> $DIR/async-fn-nonsend.rs:72:17
|
||||
|
|
||||
LL | assert_send(non_send_temporary_in_match());
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ future returned by `non_send_temporary_in_match` 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:36:25
|
||||
|
|
||||
LL | match Some(non_send()) {
|
||||
| ---------- has type `impl Debug` which is not `Send`
|
||||
LL | Some(_) => fut().await,
|
||||
| ^^^^^^ await occurs here, with `non_send()` maybe used later
|
||||
...
|
||||
LL | }
|
||||
| - `non_send()` is later dropped here
|
||||
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:74:17
|
||||
|
|
||||
LL | assert_send(non_sync_with_method_call());
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^ future returned by `non_sync_with_method_call` 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:49:14
|
||||
|
|
||||
LL | let f: &mut std::fmt::Formatter = &mut get_formatter();
|
||||
| --------------- has type `Formatter<'_>` which is not `Send`
|
||||
...
|
||||
LL | fut().await;
|
||||
| ^^^^^^ await occurs here, with `get_formatter()` maybe used later
|
||||
LL | }
|
||||
LL | }
|
||||
| - `get_formatter()` is later dropped here
|
||||
note: required by a bound in `assert_send`
|
||||
--> $DIR/async-fn-nonsend.rs:67:24
|
||||
|
|
||||
LL | fn assert_send(_: impl Send) {}
|
||||
| ^^^^ required by this bound in `assert_send`
|
||||
|
||||
error: future cannot be sent between threads safely
|
||||
--> $DIR/async-fn-nonsend.rs:76:17
|
||||
|
|
||||
LL | assert_send(non_sync_with_method_call_panic());
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ future returned by `non_sync_with_method_call_panic` is not `Send`
|
||||
|
|
||||
= help: within `impl Future<Output = ()>`, the trait `Send` is not implemented for `dyn std::fmt::Write`
|
||||
note: future is not `Send` as this value is used across an await
|
||||
--> $DIR/async-fn-nonsend.rs:56:14
|
||||
|
|
||||
LL | let f: &mut std::fmt::Formatter = panic!();
|
||||
| - has type `&mut Formatter<'_>` which is not `Send`
|
||||
LL | if non_sync().fmt(f).unwrap() == () {
|
||||
LL | fut().await;
|
||||
| ^^^^^^ await occurs here, with `f` maybe used later
|
||||
LL | }
|
||||
LL | }
|
||||
| - `f` is later dropped here
|
||||
note: required by a bound in `assert_send`
|
||||
--> $DIR/async-fn-nonsend.rs:67:24
|
||||
|
|
||||
LL | fn assert_send(_: impl Send) {}
|
||||
| ^^^^ required by this bound in `assert_send`
|
||||
|
||||
error: future cannot be sent between threads safely
|
||||
--> $DIR/async-fn-nonsend.rs:78:17
|
||||
|
|
||||
LL | assert_send(non_sync_with_method_call_infinite_loop());
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ future returned by `non_sync_with_method_call_infinite_loop` is not `Send`
|
||||
|
|
||||
= help: within `impl Future<Output = ()>`, the trait `Send` is not implemented for `dyn std::fmt::Write`
|
||||
note: future is not `Send` as this value is used across an await
|
||||
--> $DIR/async-fn-nonsend.rs:63:14
|
||||
|
|
||||
LL | let f: &mut std::fmt::Formatter = loop {};
|
||||
| - has type `&mut Formatter<'_>` which is not `Send`
|
||||
LL | if non_sync().fmt(f).unwrap() == () {
|
||||
LL | fut().await;
|
||||
| ^^^^^^ await occurs here, with `f` maybe used later
|
||||
LL | }
|
||||
LL | }
|
||||
| - `f` is later dropped here
|
||||
note: required by a bound in `assert_send`
|
||||
--> $DIR/async-fn-nonsend.rs:67:24
|
||||
|
|
||||
LL | fn assert_send(_: impl Send) {}
|
||||
| ^^^^ required by this bound in `assert_send`
|
||||
|
||||
error: aborting due to 5 previous errors
|
||||
|
@ -1,5 +1,8 @@
|
||||
// revisions: no_drop_tracking drop_tracking drop_tracking_mir
|
||||
// [drop_tracking] compile-flags: -Zdrop-tracking
|
||||
// [drop_tracking_mir] compile-flags: -Zdrop-tracking-mir
|
||||
// edition:2018
|
||||
// compile-flags: --crate-type lib -Zdrop-tracking
|
||||
// compile-flags: --crate-type lib
|
||||
|
||||
use std::{cell::RefCell, fmt::Debug, rc::Rc};
|
||||
|
||||
@ -65,10 +68,13 @@ fn assert_send(_: impl Send) {}
|
||||
|
||||
pub fn pass_assert() {
|
||||
assert_send(local_dropped_before_await());
|
||||
//[no_drop_tracking,drop_tracking_mir]~^ ERROR future cannot be sent between threads safely
|
||||
assert_send(non_send_temporary_in_match());
|
||||
//~^ ERROR future cannot be sent between threads safely
|
||||
assert_send(non_sync_with_method_call());
|
||||
//~^ ERROR future cannot be sent between threads safely
|
||||
assert_send(non_sync_with_method_call_panic());
|
||||
//[no_drop_tracking,drop_tracking_mir]~^ ERROR future cannot be sent between threads safely
|
||||
assert_send(non_sync_with_method_call_infinite_loop());
|
||||
//[no_drop_tracking,drop_tracking_mir]~^ ERROR future cannot be sent between threads safely
|
||||
}
|
||||
|
@ -1,12 +1,12 @@
|
||||
error: future cannot be sent between threads safely
|
||||
--> $DIR/async-fn-nonsend.rs:68:17
|
||||
--> $DIR/async-fn-nonsend.rs:72:17
|
||||
|
|
||||
LL | assert_send(non_send_temporary_in_match());
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ future returned by `non_send_temporary_in_match` 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:33:25
|
||||
--> $DIR/async-fn-nonsend.rs:36:25
|
||||
|
|
||||
LL | match Some(non_send()) {
|
||||
| ---------------- has type `Option<impl Debug>` which is not `Send`
|
||||
@ -16,20 +16,20 @@ LL | Some(_) => fut().await,
|
||||
LL | }
|
||||
| - `Some(non_send())` is later dropped here
|
||||
note: required by a bound in `assert_send`
|
||||
--> $DIR/async-fn-nonsend.rs:64:24
|
||||
--> $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:70:17
|
||||
--> $DIR/async-fn-nonsend.rs:74:17
|
||||
|
|
||||
LL | assert_send(non_sync_with_method_call());
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^ future returned by `non_sync_with_method_call` 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:46:14
|
||||
--> $DIR/async-fn-nonsend.rs:49:14
|
||||
|
|
||||
LL | let f: &mut std::fmt::Formatter = &mut get_formatter();
|
||||
| --------------- has type `Formatter<'_>` which is not `Send`
|
||||
@ -40,7 +40,7 @@ LL | }
|
||||
LL | }
|
||||
| - `get_formatter()` is later dropped here
|
||||
note: required by a bound in `assert_send`
|
||||
--> $DIR/async-fn-nonsend.rs:64:24
|
||||
--> $DIR/async-fn-nonsend.rs:67:24
|
||||
|
|
||||
LL | fn assert_send(_: impl Send) {}
|
||||
| ^^^^ required by this bound in `assert_send`
|
||||
|
@ -1,6 +1,8 @@
|
||||
// revisions: no_drop_tracking drop_tracking drop_tracking_mir
|
||||
// [drop_tracking] compile-flags: -Zdrop-tracking
|
||||
// [drop_tracking_mir] compile-flags: -Zdrop-tracking-mir
|
||||
// build-pass
|
||||
// edition:2018
|
||||
// compile-flags: -Zdrop-tracking=y
|
||||
|
||||
fn main() {
|
||||
let _ = foo();
|
||||
|
@ -1,5 +1,7 @@
|
||||
// revisions: no_drop_tracking drop_tracking drop_tracking_mir
|
||||
// [drop_tracking] compile-flags: -Zdrop-tracking
|
||||
// [drop_tracking_mir] compile-flags: -Zdrop-tracking-mir
|
||||
// edition:2021
|
||||
// compile-flags: -Zdrop-tracking
|
||||
// build-pass
|
||||
|
||||
struct A;
|
||||
|
@ -1,12 +1,12 @@
|
||||
error: future cannot be sent between threads safely
|
||||
--> $DIR/drop-track-field-assign-nonsend.rs:43:17
|
||||
--> $DIR/drop-track-field-assign-nonsend.rs:45:17
|
||||
|
|
||||
LL | assert_send(agent.handle());
|
||||
| ^^^^^^^^^^^^^^ future returned by `handle` is not `Send`
|
||||
|
|
||||
= help: within `impl Future<Output = ()>`, the trait `Send` is not implemented for `Rc<String>`
|
||||
note: future is not `Send` as this value is used across an await
|
||||
--> $DIR/drop-track-field-assign-nonsend.rs:21:38
|
||||
--> $DIR/drop-track-field-assign-nonsend.rs:23:38
|
||||
|
|
||||
LL | let mut info = self.info_result.clone();
|
||||
| -------- has type `InfoResult` which is not `Send`
|
||||
@ -16,7 +16,7 @@ LL | let _ = send_element(element).await;
|
||||
LL | }
|
||||
| - `mut info` is later dropped here
|
||||
note: required by a bound in `assert_send`
|
||||
--> $DIR/drop-track-field-assign-nonsend.rs:38:19
|
||||
--> $DIR/drop-track-field-assign-nonsend.rs:40:19
|
||||
|
|
||||
LL | fn assert_send<T: Send>(_: T) {}
|
||||
| ^^^^ required by this bound in `assert_send`
|
@ -0,0 +1,25 @@
|
||||
error: future cannot be sent between threads safely
|
||||
--> $DIR/drop-track-field-assign-nonsend.rs:45:17
|
||||
|
|
||||
LL | assert_send(agent.handle());
|
||||
| ^^^^^^^^^^^^^^ future returned by `handle` is not `Send`
|
||||
|
|
||||
= help: within `impl Future<Output = ()>`, the trait `Send` is not implemented for `Rc<String>`
|
||||
note: future is not `Send` as this value is used across an await
|
||||
--> $DIR/drop-track-field-assign-nonsend.rs:23:38
|
||||
|
|
||||
LL | let mut info = self.info_result.clone();
|
||||
| -------- has type `InfoResult` which is not `Send`
|
||||
...
|
||||
LL | let _ = send_element(element).await;
|
||||
| ^^^^^^ await occurs here, with `mut info` maybe used later
|
||||
LL | }
|
||||
| - `mut info` is later dropped here
|
||||
note: required by a bound in `assert_send`
|
||||
--> $DIR/drop-track-field-assign-nonsend.rs:40:19
|
||||
|
|
||||
LL | fn assert_send<T: Send>(_: T) {}
|
||||
| ^^^^ required by this bound in `assert_send`
|
||||
|
||||
error: aborting due to previous error
|
||||
|
@ -0,0 +1,25 @@
|
||||
error: future cannot be sent between threads safely
|
||||
--> $DIR/drop-track-field-assign-nonsend.rs:45:17
|
||||
|
|
||||
LL | assert_send(agent.handle());
|
||||
| ^^^^^^^^^^^^^^ future returned by `handle` is not `Send`
|
||||
|
|
||||
= help: within `impl Future<Output = ()>`, the trait `Send` is not implemented for `Rc<String>`
|
||||
note: future is not `Send` as this value is used across an await
|
||||
--> $DIR/drop-track-field-assign-nonsend.rs:23:38
|
||||
|
|
||||
LL | let mut info = self.info_result.clone();
|
||||
| -------- has type `InfoResult` which is not `Send`
|
||||
...
|
||||
LL | let _ = send_element(element).await;
|
||||
| ^^^^^^ await occurs here, with `mut info` maybe used later
|
||||
LL | }
|
||||
| - `mut info` is later dropped here
|
||||
note: required by a bound in `assert_send`
|
||||
--> $DIR/drop-track-field-assign-nonsend.rs:40:19
|
||||
|
|
||||
LL | fn assert_send<T: Send>(_: T) {}
|
||||
| ^^^^ required by this bound in `assert_send`
|
||||
|
||||
error: aborting due to previous error
|
||||
|
@ -1,6 +1,8 @@
|
||||
// revisions: no_drop_tracking drop_tracking drop_tracking_mir
|
||||
// [drop_tracking] compile-flags: -Zdrop-tracking
|
||||
// [drop_tracking_mir] compile-flags: -Zdrop-tracking-mir
|
||||
// Derived from an ICE found in tokio-xmpp during a crater run.
|
||||
// edition:2021
|
||||
// compile-flags: -Zdrop-tracking
|
||||
|
||||
#![allow(dead_code)]
|
||||
|
||||
|
@ -1,6 +1,8 @@
|
||||
// revisions: no_drop_tracking drop_tracking drop_tracking_mir
|
||||
// [drop_tracking] compile-flags: -Zdrop-tracking
|
||||
// [drop_tracking_mir] compile-flags: -Zdrop-tracking-mir
|
||||
// Derived from an ICE found in tokio-xmpp during a crater run.
|
||||
// edition:2021
|
||||
// compile-flags: -Zdrop-tracking
|
||||
// build-pass
|
||||
|
||||
#![allow(dead_code)]
|
||||
|
@ -0,0 +1,25 @@
|
||||
error: future cannot be sent between threads safely
|
||||
--> $DIR/field-assign-nonsend.rs:45:17
|
||||
|
|
||||
LL | assert_send(agent.handle());
|
||||
| ^^^^^^^^^^^^^^ future returned by `handle` is not `Send`
|
||||
|
|
||||
= help: within `impl Future<Output = ()>`, the trait `Send` is not implemented for `Rc<String>`
|
||||
note: future is not `Send` as this value is used across an await
|
||||
--> $DIR/field-assign-nonsend.rs:23:38
|
||||
|
|
||||
LL | let mut info = self.info_result.clone();
|
||||
| -------- has type `InfoResult` which is not `Send`
|
||||
...
|
||||
LL | let _ = send_element(element).await;
|
||||
| ^^^^^^ await occurs here, with `mut info` maybe used later
|
||||
LL | }
|
||||
| - `mut info` is later dropped here
|
||||
note: required by a bound in `assert_send`
|
||||
--> $DIR/field-assign-nonsend.rs:40:19
|
||||
|
|
||||
LL | fn assert_send<T: Send>(_: T) {}
|
||||
| ^^^^ required by this bound in `assert_send`
|
||||
|
||||
error: aborting due to previous error
|
||||
|
@ -0,0 +1,25 @@
|
||||
error: future cannot be sent between threads safely
|
||||
--> $DIR/field-assign-nonsend.rs:45:17
|
||||
|
|
||||
LL | assert_send(agent.handle());
|
||||
| ^^^^^^^^^^^^^^ future returned by `handle` is not `Send`
|
||||
|
|
||||
= help: within `impl Future<Output = ()>`, the trait `Send` is not implemented for `Rc<String>`
|
||||
note: future is not `Send` as this value is used across an await
|
||||
--> $DIR/field-assign-nonsend.rs:23:38
|
||||
|
|
||||
LL | let mut info = self.info_result.clone();
|
||||
| -------- has type `InfoResult` which is not `Send`
|
||||
...
|
||||
LL | let _ = send_element(element).await;
|
||||
| ^^^^^^ await occurs here, with `mut info` maybe used later
|
||||
LL | }
|
||||
| - `mut info` is later dropped here
|
||||
note: required by a bound in `assert_send`
|
||||
--> $DIR/field-assign-nonsend.rs:40:19
|
||||
|
|
||||
LL | fn assert_send<T: Send>(_: T) {}
|
||||
| ^^^^ required by this bound in `assert_send`
|
||||
|
||||
error: aborting due to previous error
|
||||
|
@ -0,0 +1,25 @@
|
||||
error: future cannot be sent between threads safely
|
||||
--> $DIR/field-assign-nonsend.rs:45:17
|
||||
|
|
||||
LL | assert_send(agent.handle());
|
||||
| ^^^^^^^^^^^^^^ future returned by `handle` is not `Send`
|
||||
|
|
||||
= help: within `impl Future<Output = ()>`, the trait `Send` is not implemented for `Rc<String>`
|
||||
note: future is not `Send` as this value is used across an await
|
||||
--> $DIR/field-assign-nonsend.rs:23:38
|
||||
|
|
||||
LL | let mut info = self.info_result.clone();
|
||||
| -------- has type `InfoResult` which is not `Send`
|
||||
...
|
||||
LL | let _ = send_element(element).await;
|
||||
| ^^^^^^ await occurs here, with `mut info` maybe used later
|
||||
LL | }
|
||||
| - `mut info` is later dropped here
|
||||
note: required by a bound in `assert_send`
|
||||
--> $DIR/field-assign-nonsend.rs:40:19
|
||||
|
|
||||
LL | fn assert_send<T: Send>(_: T) {}
|
||||
| ^^^^ required by this bound in `assert_send`
|
||||
|
||||
error: aborting due to previous error
|
||||
|
47
tests/ui/async-await/field-assign-nonsend.rs
Normal file
47
tests/ui/async-await/field-assign-nonsend.rs
Normal file
@ -0,0 +1,47 @@
|
||||
// revisions: no_drop_tracking drop_tracking drop_tracking_mir
|
||||
// [drop_tracking] compile-flags: -Zdrop-tracking
|
||||
// [drop_tracking_mir] compile-flags: -Zdrop-tracking-mir
|
||||
// Derived from an ICE found in tokio-xmpp during a crater run.
|
||||
// edition:2021
|
||||
|
||||
#![allow(dead_code)]
|
||||
|
||||
#[derive(Clone)]
|
||||
struct InfoResult {
|
||||
node: Option<std::rc::Rc<String>>
|
||||
}
|
||||
|
||||
struct Agent {
|
||||
info_result: InfoResult
|
||||
}
|
||||
|
||||
impl Agent {
|
||||
async fn handle(&mut self) {
|
||||
let mut info = self.info_result.clone();
|
||||
info.node = None;
|
||||
let element = parse_info(info);
|
||||
let _ = send_element(element).await;
|
||||
}
|
||||
}
|
||||
|
||||
struct Element {
|
||||
}
|
||||
|
||||
async fn send_element(_: Element) {}
|
||||
|
||||
fn parse(_: &[u8]) -> Result<(), ()> {
|
||||
Ok(())
|
||||
}
|
||||
|
||||
fn parse_info(_: InfoResult) -> Element {
|
||||
Element { }
|
||||
}
|
||||
|
||||
fn assert_send<T: Send>(_: T) {}
|
||||
|
||||
fn main() {
|
||||
let agent = Agent { info_result: InfoResult { node: None } };
|
||||
// FIXME: It would be nice for this to work. See #94067.
|
||||
assert_send(agent.handle());
|
||||
//~^ cannot be sent between threads safely
|
||||
}
|
46
tests/ui/async-await/field-assign.rs
Normal file
46
tests/ui/async-await/field-assign.rs
Normal file
@ -0,0 +1,46 @@
|
||||
// revisions: no_drop_tracking drop_tracking drop_tracking_mir
|
||||
// [drop_tracking] compile-flags: -Zdrop-tracking
|
||||
// [drop_tracking_mir] compile-flags: -Zdrop-tracking-mir
|
||||
// Derived from an ICE found in tokio-xmpp during a crater run.
|
||||
// edition:2021
|
||||
// build-pass
|
||||
|
||||
#![allow(dead_code)]
|
||||
|
||||
#[derive(Clone)]
|
||||
struct InfoResult {
|
||||
node: Option<String>
|
||||
}
|
||||
|
||||
struct Agent {
|
||||
info_result: InfoResult
|
||||
}
|
||||
|
||||
impl Agent {
|
||||
async fn handle(&mut self) {
|
||||
let mut info = self.info_result.clone();
|
||||
info.node = Some("bar".into());
|
||||
let element = parse_info(info);
|
||||
let _ = send_element(element).await;
|
||||
}
|
||||
}
|
||||
|
||||
struct Element {
|
||||
}
|
||||
|
||||
async fn send_element(_: Element) {}
|
||||
|
||||
fn parse(_: &[u8]) -> Result<(), ()> {
|
||||
Ok(())
|
||||
}
|
||||
|
||||
fn parse_info(_: InfoResult) -> Element {
|
||||
Element { }
|
||||
}
|
||||
|
||||
fn main() {
|
||||
let mut agent = Agent {
|
||||
info_result: InfoResult { node: None }
|
||||
};
|
||||
let _ = agent.handle();
|
||||
}
|
24
tests/ui/async-await/issue-64130-1-sync.drop_tracking.stderr
Normal file
24
tests/ui/async-await/issue-64130-1-sync.drop_tracking.stderr
Normal file
@ -0,0 +1,24 @@
|
||||
error: future cannot be shared between threads safely
|
||||
--> $DIR/issue-64130-1-sync.rs:24:13
|
||||
|
|
||||
LL | is_sync(bar());
|
||||
| ^^^^^ future returned by `bar` is not `Sync`
|
||||
|
|
||||
= help: within `impl Future<Output = ()>`, the trait `Sync` is not implemented for `Foo`
|
||||
note: future is not `Sync` as this value is used across an await
|
||||
--> $DIR/issue-64130-1-sync.rs:18:10
|
||||
|
|
||||
LL | let x = Foo;
|
||||
| - has type `Foo` which is not `Sync`
|
||||
LL | baz().await;
|
||||
| ^^^^^^ await occurs here, with `x` maybe used later
|
||||
LL | }
|
||||
| - `x` is later dropped here
|
||||
note: required by a bound in `is_sync`
|
||||
--> $DIR/issue-64130-1-sync.rs:14:15
|
||||
|
|
||||
LL | fn is_sync<T: Sync>(t: T) { }
|
||||
| ^^^^ required by this bound in `is_sync`
|
||||
|
||||
error: aborting due to previous error
|
||||
|
@ -0,0 +1,24 @@
|
||||
error: future cannot be shared between threads safely
|
||||
--> $DIR/issue-64130-1-sync.rs:24:13
|
||||
|
|
||||
LL | is_sync(bar());
|
||||
| ^^^^^ future returned by `bar` is not `Sync`
|
||||
|
|
||||
= help: within `impl Future<Output = ()>`, the trait `Sync` is not implemented for `Foo`
|
||||
note: future is not `Sync` as this value is used across an await
|
||||
--> $DIR/issue-64130-1-sync.rs:18:10
|
||||
|
|
||||
LL | let x = Foo;
|
||||
| - has type `Foo` which is not `Sync`
|
||||
LL | baz().await;
|
||||
| ^^^^^^ await occurs here, with `x` maybe used later
|
||||
LL | }
|
||||
| - `x` is later dropped here
|
||||
note: required by a bound in `is_sync`
|
||||
--> $DIR/issue-64130-1-sync.rs:14:15
|
||||
|
|
||||
LL | fn is_sync<T: Sync>(t: T) { }
|
||||
| ^^^^ required by this bound in `is_sync`
|
||||
|
||||
error: aborting due to previous error
|
||||
|
@ -0,0 +1,24 @@
|
||||
error: future cannot be shared between threads safely
|
||||
--> $DIR/issue-64130-1-sync.rs:24:13
|
||||
|
|
||||
LL | is_sync(bar());
|
||||
| ^^^^^ future returned by `bar` is not `Sync`
|
||||
|
|
||||
= help: within `impl Future<Output = ()>`, the trait `Sync` is not implemented for `Foo`
|
||||
note: future is not `Sync` as this value is used across an await
|
||||
--> $DIR/issue-64130-1-sync.rs:18:10
|
||||
|
|
||||
LL | let x = Foo;
|
||||
| - has type `Foo` which is not `Sync`
|
||||
LL | baz().await;
|
||||
| ^^^^^^ await occurs here, with `x` maybe used later
|
||||
LL | }
|
||||
| - `x` is later dropped here
|
||||
note: required by a bound in `is_sync`
|
||||
--> $DIR/issue-64130-1-sync.rs:14:15
|
||||
|
|
||||
LL | fn is_sync<T: Sync>(t: T) { }
|
||||
| ^^^^ required by this bound in `is_sync`
|
||||
|
||||
error: aborting due to previous error
|
||||
|
@ -1,3 +1,6 @@
|
||||
// revisions: no_drop_tracking drop_tracking drop_tracking_mir
|
||||
// [drop_tracking] compile-flags: -Zdrop-tracking
|
||||
// [drop_tracking_mir] compile-flags: -Zdrop-tracking-mir
|
||||
#![feature(negative_impls)]
|
||||
// edition:2018
|
||||
|
||||
|
@ -1,12 +1,12 @@
|
||||
error: future cannot be shared between threads safely
|
||||
--> $DIR/issue-64130-1-sync.rs:21:13
|
||||
--> $DIR/issue-64130-1-sync.rs:24:13
|
||||
|
|
||||
LL | is_sync(bar());
|
||||
| ^^^^^ future returned by `bar` is not `Sync`
|
||||
|
|
||||
= help: within `impl Future<Output = ()>`, the trait `Sync` is not implemented for `Foo`
|
||||
note: future is not `Sync` as this value is used across an await
|
||||
--> $DIR/issue-64130-1-sync.rs:15:10
|
||||
--> $DIR/issue-64130-1-sync.rs:18:10
|
||||
|
|
||||
LL | let x = Foo;
|
||||
| - has type `Foo` which is not `Sync`
|
||||
@ -15,7 +15,7 @@ LL | baz().await;
|
||||
LL | }
|
||||
| - `x` is later dropped here
|
||||
note: required by a bound in `is_sync`
|
||||
--> $DIR/issue-64130-1-sync.rs:11:15
|
||||
--> $DIR/issue-64130-1-sync.rs:14:15
|
||||
|
|
||||
LL | fn is_sync<T: Sync>(t: T) { }
|
||||
| ^^^^ required by this bound in `is_sync`
|
||||
|
24
tests/ui/async-await/issue-64130-2-send.drop_tracking.stderr
Normal file
24
tests/ui/async-await/issue-64130-2-send.drop_tracking.stderr
Normal file
@ -0,0 +1,24 @@
|
||||
error: future cannot be sent between threads safely
|
||||
--> $DIR/issue-64130-2-send.rs:24:13
|
||||
|
|
||||
LL | is_send(bar());
|
||||
| ^^^^^ future returned by `bar` is not `Send`
|
||||
|
|
||||
= help: within `impl Future<Output = ()>`, the trait `Send` is not implemented for `Foo`
|
||||
note: future is not `Send` as this value is used across an await
|
||||
--> $DIR/issue-64130-2-send.rs:18:10
|
||||
|
|
||||
LL | let x = Foo;
|
||||
| - has type `Foo` which is not `Send`
|
||||
LL | baz().await;
|
||||
| ^^^^^^ await occurs here, with `x` maybe used later
|
||||
LL | }
|
||||
| - `x` is later dropped here
|
||||
note: required by a bound in `is_send`
|
||||
--> $DIR/issue-64130-2-send.rs:14:15
|
||||
|
|
||||
LL | fn is_send<T: Send>(t: T) { }
|
||||
| ^^^^ required by this bound in `is_send`
|
||||
|
||||
error: aborting due to previous error
|
||||
|
@ -0,0 +1,24 @@
|
||||
error: future cannot be sent between threads safely
|
||||
--> $DIR/issue-64130-2-send.rs:24:13
|
||||
|
|
||||
LL | is_send(bar());
|
||||
| ^^^^^ future returned by `bar` is not `Send`
|
||||
|
|
||||
= help: within `impl Future<Output = ()>`, the trait `Send` is not implemented for `Foo`
|
||||
note: future is not `Send` as this value is used across an await
|
||||
--> $DIR/issue-64130-2-send.rs:18:10
|
||||
|
|
||||
LL | let x = Foo;
|
||||
| - has type `Foo` which is not `Send`
|
||||
LL | baz().await;
|
||||
| ^^^^^^ await occurs here, with `x` maybe used later
|
||||
LL | }
|
||||
| - `x` is later dropped here
|
||||
note: required by a bound in `is_send`
|
||||
--> $DIR/issue-64130-2-send.rs:14:15
|
||||
|
|
||||
LL | fn is_send<T: Send>(t: T) { }
|
||||
| ^^^^ required by this bound in `is_send`
|
||||
|
||||
error: aborting due to previous error
|
||||
|
@ -0,0 +1,24 @@
|
||||
error: future cannot be sent between threads safely
|
||||
--> $DIR/issue-64130-2-send.rs:24:13
|
||||
|
|
||||
LL | is_send(bar());
|
||||
| ^^^^^ future returned by `bar` is not `Send`
|
||||
|
|
||||
= help: within `impl Future<Output = ()>`, the trait `Send` is not implemented for `Foo`
|
||||
note: future is not `Send` as this value is used across an await
|
||||
--> $DIR/issue-64130-2-send.rs:18:10
|
||||
|
|
||||
LL | let x = Foo;
|
||||
| - has type `Foo` which is not `Send`
|
||||
LL | baz().await;
|
||||
| ^^^^^^ await occurs here, with `x` maybe used later
|
||||
LL | }
|
||||
| - `x` is later dropped here
|
||||
note: required by a bound in `is_send`
|
||||
--> $DIR/issue-64130-2-send.rs:14:15
|
||||
|
|
||||
LL | fn is_send<T: Send>(t: T) { }
|
||||
| ^^^^ required by this bound in `is_send`
|
||||
|
||||
error: aborting due to previous error
|
||||
|
@ -1,3 +1,6 @@
|
||||
// revisions: no_drop_tracking drop_tracking drop_tracking_mir
|
||||
// [drop_tracking] compile-flags: -Zdrop-tracking
|
||||
// [drop_tracking_mir] compile-flags: -Zdrop-tracking-mir
|
||||
#![feature(negative_impls)]
|
||||
// edition:2018
|
||||
|
||||
|
@ -1,12 +1,12 @@
|
||||
error: future cannot be sent between threads safely
|
||||
--> $DIR/issue-64130-2-send.rs:21:13
|
||||
--> $DIR/issue-64130-2-send.rs:24:13
|
||||
|
|
||||
LL | is_send(bar());
|
||||
| ^^^^^ future returned by `bar` is not `Send`
|
||||
|
|
||||
= help: within `impl Future<Output = ()>`, the trait `Send` is not implemented for `Foo`
|
||||
note: future is not `Send` as this value is used across an await
|
||||
--> $DIR/issue-64130-2-send.rs:15:10
|
||||
--> $DIR/issue-64130-2-send.rs:18:10
|
||||
|
|
||||
LL | let x = Foo;
|
||||
| - has type `Foo` which is not `Send`
|
||||
@ -15,7 +15,7 @@ LL | baz().await;
|
||||
LL | }
|
||||
| - `x` is later dropped here
|
||||
note: required by a bound in `is_send`
|
||||
--> $DIR/issue-64130-2-send.rs:11:15
|
||||
--> $DIR/issue-64130-2-send.rs:14:15
|
||||
|
|
||||
LL | fn is_send<T: Send>(t: T) { }
|
||||
| ^^^^ required by this bound in `is_send`
|
||||
|
@ -0,0 +1,27 @@
|
||||
error[E0277]: the trait bound `Foo: Qux` is not satisfied in `impl Future<Output = ()>`
|
||||
--> $DIR/issue-64130-3-other.rs:27:12
|
||||
|
|
||||
LL | async fn bar() {
|
||||
| - within this `impl Future<Output = ()>`
|
||||
...
|
||||
LL | is_qux(bar());
|
||||
| ^^^^^ within `impl Future<Output = ()>`, the trait `Qux` is not implemented for `Foo`
|
||||
|
|
||||
note: future does not implement `Qux` as this value is used across an await
|
||||
--> $DIR/issue-64130-3-other.rs:21:10
|
||||
|
|
||||
LL | let x = Foo;
|
||||
| - has type `Foo` which does not implement `Qux`
|
||||
LL | baz().await;
|
||||
| ^^^^^^ await occurs here, with `x` maybe used later
|
||||
LL | }
|
||||
| - `x` is later dropped here
|
||||
note: required by a bound in `is_qux`
|
||||
--> $DIR/issue-64130-3-other.rs:17:14
|
||||
|
|
||||
LL | fn is_qux<T: Qux>(t: T) {}
|
||||
| ^^^ required by this bound in `is_qux`
|
||||
|
||||
error: aborting due to previous error
|
||||
|
||||
For more information about this error, try `rustc --explain E0277`.
|
@ -0,0 +1,27 @@
|
||||
error[E0277]: the trait bound `Foo: Qux` is not satisfied in `impl Future<Output = ()>`
|
||||
--> $DIR/issue-64130-3-other.rs:27:12
|
||||
|
|
||||
LL | async fn bar() {
|
||||
| - within this `impl Future<Output = ()>`
|
||||
...
|
||||
LL | is_qux(bar());
|
||||
| ^^^^^ within `impl Future<Output = ()>`, the trait `Qux` is not implemented for `Foo`
|
||||
|
|
||||
note: future does not implement `Qux` as this value is used across an await
|
||||
--> $DIR/issue-64130-3-other.rs:21:10
|
||||
|
|
||||
LL | let x = Foo;
|
||||
| - has type `Foo` which does not implement `Qux`
|
||||
LL | baz().await;
|
||||
| ^^^^^^ await occurs here, with `x` maybe used later
|
||||
LL | }
|
||||
| - `x` is later dropped here
|
||||
note: required by a bound in `is_qux`
|
||||
--> $DIR/issue-64130-3-other.rs:17:14
|
||||
|
|
||||
LL | fn is_qux<T: Qux>(t: T) {}
|
||||
| ^^^ required by this bound in `is_qux`
|
||||
|
||||
error: aborting due to previous error
|
||||
|
||||
For more information about this error, try `rustc --explain E0277`.
|
@ -0,0 +1,27 @@
|
||||
error[E0277]: the trait bound `Foo: Qux` is not satisfied in `impl Future<Output = ()>`
|
||||
--> $DIR/issue-64130-3-other.rs:27:12
|
||||
|
|
||||
LL | async fn bar() {
|
||||
| - within this `impl Future<Output = ()>`
|
||||
...
|
||||
LL | is_qux(bar());
|
||||
| ^^^^^ within `impl Future<Output = ()>`, the trait `Qux` is not implemented for `Foo`
|
||||
|
|
||||
note: future does not implement `Qux` as this value is used across an await
|
||||
--> $DIR/issue-64130-3-other.rs:21:10
|
||||
|
|
||||
LL | let x = Foo;
|
||||
| - has type `Foo` which does not implement `Qux`
|
||||
LL | baz().await;
|
||||
| ^^^^^^ await occurs here, with `x` maybe used later
|
||||
LL | }
|
||||
| - `x` is later dropped here
|
||||
note: required by a bound in `is_qux`
|
||||
--> $DIR/issue-64130-3-other.rs:17:14
|
||||
|
|
||||
LL | fn is_qux<T: Qux>(t: T) {}
|
||||
| ^^^ required by this bound in `is_qux`
|
||||
|
||||
error: aborting due to previous error
|
||||
|
||||
For more information about this error, try `rustc --explain E0277`.
|
@ -1,3 +1,6 @@
|
||||
// revisions: no_drop_tracking drop_tracking drop_tracking_mir
|
||||
// [drop_tracking] compile-flags: -Zdrop-tracking
|
||||
// [drop_tracking_mir] compile-flags: -Zdrop-tracking-mir
|
||||
#![feature(auto_traits)]
|
||||
#![feature(negative_impls)]
|
||||
// edition:2018
|
||||
|
@ -1,5 +1,5 @@
|
||||
error[E0277]: the trait bound `Foo: Qux` is not satisfied in `impl Future<Output = ()>`
|
||||
--> $DIR/issue-64130-3-other.rs:24:12
|
||||
--> $DIR/issue-64130-3-other.rs:27:12
|
||||
|
|
||||
LL | async fn bar() {
|
||||
| - within this `impl Future<Output = ()>`
|
||||
@ -8,7 +8,7 @@ LL | is_qux(bar());
|
||||
| ^^^^^ within `impl Future<Output = ()>`, the trait `Qux` is not implemented for `Foo`
|
||||
|
|
||||
note: future does not implement `Qux` as this value is used across an await
|
||||
--> $DIR/issue-64130-3-other.rs:18:10
|
||||
--> $DIR/issue-64130-3-other.rs:21:10
|
||||
|
|
||||
LL | let x = Foo;
|
||||
| - has type `Foo` which does not implement `Qux`
|
||||
@ -17,7 +17,7 @@ LL | baz().await;
|
||||
LL | }
|
||||
| - `x` is later dropped here
|
||||
note: required by a bound in `is_qux`
|
||||
--> $DIR/issue-64130-3-other.rs:14:14
|
||||
--> $DIR/issue-64130-3-other.rs:17:14
|
||||
|
|
||||
LL | fn is_qux<T: Qux>(t: T) {}
|
||||
| ^^^ required by this bound in `is_qux`
|
||||
|
@ -1,12 +1,12 @@
|
||||
error: future cannot be sent between threads safely
|
||||
--> $DIR/issue-64130-4-async-move.rs:19:17
|
||||
--> $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:25:31
|
||||
--> $DIR/issue-64130-4-async-move.rs:27:31
|
||||
|
|
||||
LL | match client.status() {
|
||||
| ------ has type `&Client` which is not `Send`
|
||||
@ -17,7 +17,7 @@ LL | let _x = get().await;
|
||||
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:23:15
|
||||
--> $DIR/issue-64130-4-async-move.rs:25:15
|
||||
|
|
||||
LL | match client.status() {
|
||||
| ^^^^^^^^^^^^^^^
|
||||
|
@ -0,0 +1,26 @@
|
||||
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
|
||||
|
@ -1,12 +1,12 @@
|
||||
error: future cannot be sent between threads safely
|
||||
--> $DIR/issue-64130-4-async-move.rs:19:17
|
||||
--> $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:25:31
|
||||
--> $DIR/issue-64130-4-async-move.rs:27:31
|
||||
|
|
||||
LL | match client.status() {
|
||||
| ------ has type `&Client` which is not `Send`
|
||||
@ -17,7 +17,7 @@ LL | let _x = get().await;
|
||||
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:23:15
|
||||
--> $DIR/issue-64130-4-async-move.rs:25:15
|
||||
|
|
||||
LL | match client.status() {
|
||||
| ^^^^^^^^^^^^^^^
|
||||
|
@ -1,8 +1,9 @@
|
||||
// edition:2018
|
||||
// revisions: no_drop_tracking drop_tracking
|
||||
// revisions: no_drop_tracking drop_tracking drop_tracking_mir
|
||||
// [drop_tracking] compile-flags: -Zdrop-tracking
|
||||
// [drop_tracking_mir] compile-flags: -Zdrop-tracking-mir
|
||||
// [drop_tracking] check-pass
|
||||
// [drop_tracking] compile-flags: -Zdrop-tracking=yes
|
||||
// [no_drop_tracking] compile-flags: -Zdrop-tracking=no
|
||||
|
||||
use std::any::Any;
|
||||
use std::future::Future;
|
||||
|
||||
@ -18,6 +19,7 @@ async fn get() {}
|
||||
|
||||
pub fn foo() -> impl Future + Send {
|
||||
//[no_drop_tracking]~^ ERROR future cannot be sent between threads safely
|
||||
//[drop_tracking_mir]~^^ ERROR future cannot be sent between threads safely
|
||||
let client = Client(Box::new(true));
|
||||
async move {
|
||||
match client.status() {
|
||||
|
@ -1,5 +1,5 @@
|
||||
error: future cannot be sent between threads safely
|
||||
--> $DIR/issue-67252-unnamed-future.rs:18:11
|
||||
--> $DIR/issue-67252-unnamed-future.rs:21:11
|
||||
|
|
||||
LL | spawn(async {
|
||||
| ___________^
|
||||
@ -8,9 +8,9 @@ LL | | AFuture.await;
|
||||
LL | | });
|
||||
| |_____^ future created by async block is not `Send`
|
||||
|
|
||||
= help: within `[async block@$DIR/issue-67252-unnamed-future.rs:18:11: 21:6]`, the trait `Send` is not implemented for `*mut ()`
|
||||
= help: within `[async block@$DIR/issue-67252-unnamed-future.rs:21:11: 24:6]`, the trait `Send` is not implemented for `*mut ()`
|
||||
note: future is not `Send` as this value is used across an await
|
||||
--> $DIR/issue-67252-unnamed-future.rs:20:16
|
||||
--> $DIR/issue-67252-unnamed-future.rs:23:16
|
||||
|
|
||||
LL | let _a = std::ptr::null_mut::<()>(); // `*mut ()` is not `Send`
|
||||
| -- has type `*mut ()` which is not `Send`
|
||||
@ -19,7 +19,7 @@ LL | AFuture.await;
|
||||
LL | });
|
||||
| - `_a` is later dropped here
|
||||
note: required by a bound in `spawn`
|
||||
--> $DIR/issue-67252-unnamed-future.rs:6:13
|
||||
--> $DIR/issue-67252-unnamed-future.rs:9:13
|
||||
|
|
||||
LL | fn spawn<T: Send>(_: T) {}
|
||||
| ^^^^ required by this bound in `spawn`
|
@ -0,0 +1,28 @@
|
||||
error: future cannot be sent between threads safely
|
||||
--> $DIR/issue-67252-unnamed-future.rs:21:11
|
||||
|
|
||||
LL | spawn(async {
|
||||
| ___________^
|
||||
LL | | let _a = std::ptr::null_mut::<()>(); // `*mut ()` is not `Send`
|
||||
LL | | AFuture.await;
|
||||
LL | | });
|
||||
| |_____^ future created by async block is not `Send`
|
||||
|
|
||||
= help: within `[async block@$DIR/issue-67252-unnamed-future.rs:21:11: 24:6]`, the trait `Send` is not implemented for `*mut ()`
|
||||
note: future is not `Send` as this value is used across an await
|
||||
--> $DIR/issue-67252-unnamed-future.rs:23:16
|
||||
|
|
||||
LL | let _a = std::ptr::null_mut::<()>(); // `*mut ()` is not `Send`
|
||||
| -- has type `*mut ()` which is not `Send`
|
||||
LL | AFuture.await;
|
||||
| ^^^^^^ await occurs here, with `_a` maybe used later
|
||||
LL | });
|
||||
| - `_a` is later dropped here
|
||||
note: required by a bound in `spawn`
|
||||
--> $DIR/issue-67252-unnamed-future.rs:9:13
|
||||
|
|
||||
LL | fn spawn<T: Send>(_: T) {}
|
||||
| ^^^^ required by this bound in `spawn`
|
||||
|
||||
error: aborting due to previous error
|
||||
|
@ -0,0 +1,28 @@
|
||||
error: future cannot be sent between threads safely
|
||||
--> $DIR/issue-67252-unnamed-future.rs:21:11
|
||||
|
|
||||
LL | spawn(async {
|
||||
| ___________^
|
||||
LL | | let _a = std::ptr::null_mut::<()>(); // `*mut ()` is not `Send`
|
||||
LL | | AFuture.await;
|
||||
LL | | });
|
||||
| |_____^ future created by async block is not `Send`
|
||||
|
|
||||
= help: within `[async block@$DIR/issue-67252-unnamed-future.rs:21:11: 24:6]`, the trait `Send` is not implemented for `*mut ()`
|
||||
note: future is not `Send` as this value is used across an await
|
||||
--> $DIR/issue-67252-unnamed-future.rs:23:16
|
||||
|
|
||||
LL | let _a = std::ptr::null_mut::<()>(); // `*mut ()` is not `Send`
|
||||
| -- has type `*mut ()` which is not `Send`
|
||||
LL | AFuture.await;
|
||||
| ^^^^^^ await occurs here, with `_a` maybe used later
|
||||
LL | });
|
||||
| - `_a` is later dropped here
|
||||
note: required by a bound in `spawn`
|
||||
--> $DIR/issue-67252-unnamed-future.rs:9:13
|
||||
|
|
||||
LL | fn spawn<T: Send>(_: T) {}
|
||||
| ^^^^ required by this bound in `spawn`
|
||||
|
||||
error: aborting due to previous error
|
||||
|
@ -1,3 +1,6 @@
|
||||
// revisions: no_drop_tracking drop_tracking drop_tracking_mir
|
||||
// [drop_tracking] compile-flags: -Zdrop-tracking
|
||||
// [drop_tracking_mir] compile-flags: -Zdrop-tracking-mir
|
||||
// edition:2018
|
||||
use std::future::Future;
|
||||
use std::pin::Pin;
|
||||
|
82
tests/ui/async-await/issue-68112.drop_tracking_mir.stderr
Normal file
82
tests/ui/async-await/issue-68112.drop_tracking_mir.stderr
Normal file
@ -0,0 +1,82 @@
|
||||
error: future cannot be sent between threads safely
|
||||
--> $DIR/issue-68112.rs:37:18
|
||||
|
|
||||
LL | require_send(send_fut);
|
||||
| ^^^^^^^^ future created by async block is not `Send`
|
||||
|
|
||||
= help: the trait `Sync` is not implemented for `RefCell<i32>`
|
||||
= note: if you want to do aliasing and mutation between multiple threads, use `std::sync::RwLock` instead
|
||||
note: future is not `Send` as it awaits another future which is not `Send`
|
||||
--> $DIR/issue-68112.rs:34:17
|
||||
|
|
||||
LL | let _ = non_send_fut.await;
|
||||
| ^^^^^^^^^^^^ await occurs here on type `impl Future<Output = Arc<RefCell<i32>>>`, which is not `Send`
|
||||
note: required by a bound in `require_send`
|
||||
--> $DIR/issue-68112.rs:14:25
|
||||
|
|
||||
LL | fn require_send(_: impl Send) {}
|
||||
| ^^^^ required by this bound in `require_send`
|
||||
|
||||
error: future cannot be sent between threads safely
|
||||
--> $DIR/issue-68112.rs:46:18
|
||||
|
|
||||
LL | require_send(send_fut);
|
||||
| ^^^^^^^^ future created by async block is not `Send`
|
||||
|
|
||||
= help: the trait `Sync` is not implemented for `RefCell<i32>`
|
||||
= note: if you want to do aliasing and mutation between multiple threads, use `std::sync::RwLock` instead
|
||||
note: future is not `Send` as it awaits another future which is not `Send`
|
||||
--> $DIR/issue-68112.rs:43:17
|
||||
|
|
||||
LL | let _ = make_non_send_future1().await;
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^ await occurs here on type `impl Future<Output = Arc<RefCell<i32>>>`, which is not `Send`
|
||||
note: required by a bound in `require_send`
|
||||
--> $DIR/issue-68112.rs:14:25
|
||||
|
|
||||
LL | fn require_send(_: impl Send) {}
|
||||
| ^^^^ required by this bound in `require_send`
|
||||
|
||||
error[E0277]: `RefCell<i32>` cannot be shared between threads safely
|
||||
--> $DIR/issue-68112.rs:65:18
|
||||
|
|
||||
LL | require_send(send_fut);
|
||||
| ------------ ^^^^^^^^ `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>`
|
||||
= note: if you want to do aliasing and mutation between multiple threads, use `std::sync::RwLock` instead
|
||||
= note: required for `Arc<RefCell<i32>>` to implement `Send`
|
||||
note: required because it's used within this `async fn` body
|
||||
--> $DIR/issue-68112.rs:50:31
|
||||
|
|
||||
LL | async fn ready2<T>(t: T) -> T {
|
||||
| _______________________________^
|
||||
LL | | t
|
||||
LL | | }
|
||||
| |_^
|
||||
note: required because it appears within the type `impl Future<Output = Arc<RefCell<i32>>>`
|
||||
--> $DIR/issue-68112.rs:53:31
|
||||
|
|
||||
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's used within this `async` block
|
||||
--> $DIR/issue-68112.rs:60:20
|
||||
|
|
||||
LL | let send_fut = async {
|
||||
| ____________________^
|
||||
LL | | let non_send_fut = make_non_send_future2();
|
||||
LL | | let _ = non_send_fut.await;
|
||||
LL | | ready(0).await;
|
||||
LL | | };
|
||||
| |_____^
|
||||
note: required by a bound in `require_send`
|
||||
--> $DIR/issue-68112.rs:14:25
|
||||
|
|
||||
LL | fn require_send(_: impl Send) {}
|
||||
| ^^^^ required by this bound in `require_send`
|
||||
|
||||
error: aborting due to 3 previous errors
|
||||
|
||||
For more information about this error, try `rustc --explain E0277`.
|
@ -1,7 +1,7 @@
|
||||
// edition:2018
|
||||
// revisions: no_drop_tracking drop_tracking
|
||||
// [drop_tracking] compile-flags: -Zdrop-tracking=yes
|
||||
// [no_drop_tracking] compile-flags: -Zdrop-tracking=no
|
||||
// revisions: no_drop_tracking drop_tracking drop_tracking_mir
|
||||
// [drop_tracking] compile-flags: -Zdrop-tracking
|
||||
// [drop_tracking_mir] compile-flags: -Zdrop-tracking-mir
|
||||
|
||||
use std::{
|
||||
cell::RefCell,
|
||||
|
18
tests/ui/async-await/issue-70818.drop_tracking.stderr
Normal file
18
tests/ui/async-await/issue-70818.drop_tracking.stderr
Normal file
@ -0,0 +1,18 @@
|
||||
error: future cannot be sent between threads safely
|
||||
--> $DIR/issue-70818.rs:7:38
|
||||
|
|
||||
LL | fn foo<T: Send, U>(ty: T, ty1: U) -> impl Future<Output = (T, U)> + Send {
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ future created by async block is not `Send`
|
||||
|
|
||||
note: captured value is not `Send`
|
||||
--> $DIR/issue-70818.rs:9:18
|
||||
|
|
||||
LL | async { (ty, ty1) }
|
||||
| ^^^ has type `U` which is not `Send`
|
||||
help: consider restricting type parameter `U`
|
||||
|
|
||||
LL | fn foo<T: Send, U: std::marker::Send>(ty: T, ty1: U) -> impl Future<Output = (T, U)> + Send {
|
||||
| +++++++++++++++++++
|
||||
|
||||
error: aborting due to previous error
|
||||
|
18
tests/ui/async-await/issue-70818.drop_tracking_mir.stderr
Normal file
18
tests/ui/async-await/issue-70818.drop_tracking_mir.stderr
Normal file
@ -0,0 +1,18 @@
|
||||
error: future cannot be sent between threads safely
|
||||
--> $DIR/issue-70818.rs:7:38
|
||||
|
|
||||
LL | fn foo<T: Send, U>(ty: T, ty1: U) -> impl Future<Output = (T, U)> + Send {
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ future created by async block is not `Send`
|
||||
|
|
||||
note: captured value is not `Send`
|
||||
--> $DIR/issue-70818.rs:9:18
|
||||
|
|
||||
LL | async { (ty, ty1) }
|
||||
| ^^^ has type `U` which is not `Send`
|
||||
help: consider restricting type parameter `U`
|
||||
|
|
||||
LL | fn foo<T: Send, U: std::marker::Send>(ty: T, ty1: U) -> impl Future<Output = (T, U)> + Send {
|
||||
| +++++++++++++++++++
|
||||
|
||||
error: aborting due to previous error
|
||||
|
18
tests/ui/async-await/issue-70818.no_drop_tracking.stderr
Normal file
18
tests/ui/async-await/issue-70818.no_drop_tracking.stderr
Normal file
@ -0,0 +1,18 @@
|
||||
error: future cannot be sent between threads safely
|
||||
--> $DIR/issue-70818.rs:7:38
|
||||
|
|
||||
LL | fn foo<T: Send, U>(ty: T, ty1: U) -> impl Future<Output = (T, U)> + Send {
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ future created by async block is not `Send`
|
||||
|
|
||||
note: captured value is not `Send`
|
||||
--> $DIR/issue-70818.rs:9:18
|
||||
|
|
||||
LL | async { (ty, ty1) }
|
||||
| ^^^ has type `U` which is not `Send`
|
||||
help: consider restricting type parameter `U`
|
||||
|
|
||||
LL | fn foo<T: Send, U: std::marker::Send>(ty: T, ty1: U) -> impl Future<Output = (T, U)> + Send {
|
||||
| +++++++++++++++++++
|
||||
|
||||
error: aborting due to previous error
|
||||
|
@ -1,3 +1,6 @@
|
||||
// revisions: no_drop_tracking drop_tracking drop_tracking_mir
|
||||
// [drop_tracking] compile-flags: -Zdrop-tracking
|
||||
// [drop_tracking_mir] compile-flags: -Zdrop-tracking-mir
|
||||
// edition:2018
|
||||
|
||||
use std::future::Future;
|
||||
|
@ -1,11 +1,11 @@
|
||||
error: future cannot be sent between threads safely
|
||||
--> $DIR/issue-70818.rs:4:38
|
||||
--> $DIR/issue-70818.rs:7:38
|
||||
|
|
||||
LL | fn foo<T: Send, U>(ty: T, ty1: U) -> impl Future<Output = (T, U)> + Send {
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ future created by async block is not `Send`
|
||||
|
|
||||
note: captured value is not `Send`
|
||||
--> $DIR/issue-70818.rs:6:18
|
||||
--> $DIR/issue-70818.rs:9:18
|
||||
|
|
||||
LL | async { (ty, ty1) }
|
||||
| ^^^ has type `U` which is not `Send`
|
||||
|
@ -7,7 +7,7 @@ LL | fn foo(tx: std::sync::mpsc::Sender<i32>) -> impl Future + Send {
|
||||
= help: the trait `Sync` is not implemented for `Sender<i32>`
|
||||
= note: required for `&Sender<i32>` to implement `Send`
|
||||
note: required because it's used within this closure
|
||||
--> $DIR/issue-70935-complex-spans.rs:17:13
|
||||
--> $DIR/issue-70935-complex-spans.rs:18:13
|
||||
|
|
||||
LL | baz(|| async{
|
||||
| ^^
|
||||
@ -20,7 +20,7 @@ LL | | }
|
||||
| |_^
|
||||
= note: required because it captures the following types: `ResumeTy`, `impl Future<Output = ()>`, `()`
|
||||
note: required because it's used within this `async` block
|
||||
--> $DIR/issue-70935-complex-spans.rs:16:5
|
||||
--> $DIR/issue-70935-complex-spans.rs:17:5
|
||||
|
|
||||
LL | / async move {
|
||||
LL | | baz(|| async{
|
||||
|
@ -0,0 +1,21 @@
|
||||
error: future cannot be sent between threads safely
|
||||
--> $DIR/issue-70935-complex-spans.rs:13:45
|
||||
|
|
||||
LL | fn foo(tx: std::sync::mpsc::Sender<i32>) -> impl Future + Send {
|
||||
| ^^^^^^^^^^^^^^^^^^ future created by async block is not `Send`
|
||||
|
|
||||
= help: the trait `Sync` is not implemented for `Sender<i32>`
|
||||
note: future is not `Send` as this value is used across an await
|
||||
--> $DIR/issue-70935-complex-spans.rs:20:11
|
||||
|
|
||||
LL | baz(|| async{
|
||||
| _____________-
|
||||
LL | | foo(tx.clone());
|
||||
LL | | }).await;
|
||||
| | - ^^^^^^- the value is later dropped here
|
||||
| | | |
|
||||
| |_________| await occurs here, with the value maybe used later
|
||||
| has type `[closure@$DIR/issue-70935-complex-spans.rs:18:13: 18:15]` which is not `Send`
|
||||
|
||||
error: aborting due to previous error
|
||||
|
@ -6,7 +6,7 @@ LL | fn foo(tx: std::sync::mpsc::Sender<i32>) -> impl Future + Send {
|
||||
|
|
||||
= help: the trait `Sync` is not implemented for `Sender<i32>`
|
||||
note: future is not `Send` as this value is used across an await
|
||||
--> $DIR/issue-70935-complex-spans.rs:19:11
|
||||
--> $DIR/issue-70935-complex-spans.rs:20:11
|
||||
|
|
||||
LL | baz(|| async{
|
||||
| _____________-
|
||||
@ -15,7 +15,7 @@ LL | | }).await;
|
||||
| | - ^^^^^^- the value is later dropped here
|
||||
| | | |
|
||||
| |_________| await occurs here, with the value maybe used later
|
||||
| has type `[closure@$DIR/issue-70935-complex-spans.rs:17:13: 17:15]` which is not `Send`
|
||||
| has type `[closure@$DIR/issue-70935-complex-spans.rs:18:13: 18:15]` which is not `Send`
|
||||
|
||||
error: aborting due to previous error
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
// edition:2018
|
||||
// revisions: no_drop_tracking drop_tracking
|
||||
// [no_drop_tracking]compile-flags:-Zdrop-tracking=no
|
||||
// [drop_tracking]compile-flags:-Zdrop-tracking
|
||||
// revisions: no_drop_tracking drop_tracking drop_tracking_mir
|
||||
// [drop_tracking] compile-flags: -Zdrop-tracking
|
||||
// [drop_tracking_mir] compile-flags: -Zdrop-tracking-mir
|
||||
// #70935: Check if we do not emit snippet
|
||||
// with newlines which lead complex diagnostics.
|
||||
|
||||
@ -13,6 +13,7 @@ async fn baz<T>(_c: impl FnMut() -> T) where T: Future<Output=()> {
|
||||
fn foo(tx: std::sync::mpsc::Sender<i32>) -> impl Future + Send {
|
||||
//[no_drop_tracking]~^ ERROR future cannot be sent between threads safely
|
||||
//[drop_tracking]~^^ ERROR `Sender<i32>` cannot be shared between threads
|
||||
//[drop_tracking_mir]~^^^ ERROR future cannot be sent between threads safely
|
||||
async move {
|
||||
baz(|| async{
|
||||
foo(tx.clone());
|
||||
|
@ -0,0 +1,11 @@
|
||||
error[E0070]: invalid left-hand side of assignment
|
||||
--> $DIR/issue-73741-type-err-drop-tracking.rs:11:7
|
||||
|
|
||||
LL | 1 = 2;
|
||||
| - ^
|
||||
| |
|
||||
| cannot assign to this expression
|
||||
|
||||
error: aborting due to previous error
|
||||
|
||||
For more information about this error, try `rustc --explain E0070`.
|
@ -0,0 +1,11 @@
|
||||
error[E0070]: invalid left-hand side of assignment
|
||||
--> $DIR/issue-73741-type-err-drop-tracking.rs:11:7
|
||||
|
|
||||
LL | 1 = 2;
|
||||
| - ^
|
||||
| |
|
||||
| cannot assign to this expression
|
||||
|
||||
error: aborting due to previous error
|
||||
|
||||
For more information about this error, try `rustc --explain E0070`.
|
@ -0,0 +1,11 @@
|
||||
error[E0070]: invalid left-hand side of assignment
|
||||
--> $DIR/issue-73741-type-err-drop-tracking.rs:11:7
|
||||
|
|
||||
LL | 1 = 2;
|
||||
| - ^
|
||||
| |
|
||||
| cannot assign to this expression
|
||||
|
||||
error: aborting due to previous error
|
||||
|
||||
For more information about this error, try `rustc --explain E0070`.
|
@ -1,5 +1,8 @@
|
||||
// edition:2018
|
||||
// compile-flags: -Zdrop-tracking
|
||||
// revisions: no_drop_tracking drop_tracking drop_tracking_mir
|
||||
// [drop_tracking] compile-flags: -Zdrop-tracking
|
||||
// [drop_tracking_mir] compile-flags: -Zdrop-tracking-mir
|
||||
//
|
||||
// Regression test for issue #73741
|
||||
// Ensures that we don't emit spurious errors when
|
||||
// a type error ocurrs in an `async fn`
|
||||
|
@ -1,5 +1,5 @@
|
||||
error[E0070]: invalid left-hand side of assignment
|
||||
--> $DIR/issue-73741-type-err-drop-tracking.rs:8:7
|
||||
--> $DIR/issue-73741-type-err-drop-tracking.rs:11:7
|
||||
|
|
||||
LL | 1 = 2;
|
||||
| - ^
|
||||
|
@ -1,5 +1,5 @@
|
||||
error: future cannot be sent between threads safely
|
||||
--> $DIR/issue-86507.rs:17:13
|
||||
--> $DIR/issue-86507.rs:20:13
|
||||
|
|
||||
LL | / Box::pin(
|
||||
LL | | async move {
|
||||
@ -9,11 +9,11 @@ LL | | )
|
||||
| |_____________^ future created by async block is not `Send`
|
||||
|
|
||||
note: captured value is not `Send` because `&` references cannot be sent unless their referent is `Sync`
|
||||
--> $DIR/issue-86507.rs:19:29
|
||||
--> $DIR/issue-86507.rs:22:29
|
||||
|
|
||||
LL | let x = x;
|
||||
| ^ has type `&T` which is not `Send`, because `T` is not `Sync`
|
||||
= note: required for the cast from `[async block@$DIR/issue-86507.rs:18:17: 20:18]` to the object type `dyn Future<Output = ()> + Send`
|
||||
= note: required for the cast from `[async block@$DIR/issue-86507.rs:21:17: 23:18]` to the object type `dyn Future<Output = ()> + Send`
|
||||
help: consider further restricting this bound
|
||||
|
|
||||
LL | fn bar<'me, 'async_trait, T: Send + std::marker::Sync>(x: &'me T)
|
23
tests/ui/async-await/issue-86507.drop_tracking_mir.stderr
Normal file
23
tests/ui/async-await/issue-86507.drop_tracking_mir.stderr
Normal file
@ -0,0 +1,23 @@
|
||||
error: future cannot be sent between threads safely
|
||||
--> $DIR/issue-86507.rs:20:13
|
||||
|
|
||||
LL | / Box::pin(
|
||||
LL | | async move {
|
||||
LL | | let x = x;
|
||||
LL | | }
|
||||
LL | | )
|
||||
| |_____________^ future created by async block is not `Send`
|
||||
|
|
||||
note: captured value is not `Send` because `&` references cannot be sent unless their referent is `Sync`
|
||||
--> $DIR/issue-86507.rs:22:29
|
||||
|
|
||||
LL | let x = x;
|
||||
| ^ has type `&T` which is not `Send`, because `T` is not `Sync`
|
||||
= note: required for the cast from `[async block@$DIR/issue-86507.rs:21:17: 23:18]` to the object type `dyn Future<Output = ()> + Send`
|
||||
help: consider further restricting this bound
|
||||
|
|
||||
LL | fn bar<'me, 'async_trait, T: Send + std::marker::Sync>(x: &'me T)
|
||||
| +++++++++++++++++++
|
||||
|
||||
error: aborting due to previous error
|
||||
|
23
tests/ui/async-await/issue-86507.no_drop_tracking.stderr
Normal file
23
tests/ui/async-await/issue-86507.no_drop_tracking.stderr
Normal file
@ -0,0 +1,23 @@
|
||||
error: future cannot be sent between threads safely
|
||||
--> $DIR/issue-86507.rs:20:13
|
||||
|
|
||||
LL | / Box::pin(
|
||||
LL | | async move {
|
||||
LL | | let x = x;
|
||||
LL | | }
|
||||
LL | | )
|
||||
| |_____________^ future created by async block is not `Send`
|
||||
|
|
||||
note: captured value is not `Send` because `&` references cannot be sent unless their referent is `Sync`
|
||||
--> $DIR/issue-86507.rs:22:29
|
||||
|
|
||||
LL | let x = x;
|
||||
| ^ has type `&T` which is not `Send`, because `T` is not `Sync`
|
||||
= note: required for the cast from `[async block@$DIR/issue-86507.rs:21:17: 23:18]` to the object type `dyn Future<Output = ()> + Send`
|
||||
help: consider further restricting this bound
|
||||
|
|
||||
LL | fn bar<'me, 'async_trait, T: Send + std::marker::Sync>(x: &'me T)
|
||||
| +++++++++++++++++++
|
||||
|
||||
error: aborting due to previous error
|
||||
|
@ -1,3 +1,6 @@
|
||||
// revisions: no_drop_tracking drop_tracking drop_tracking_mir
|
||||
// [drop_tracking] compile-flags: -Zdrop-tracking
|
||||
// [drop_tracking_mir] compile-flags: -Zdrop-tracking-mir
|
||||
// edition:2018
|
||||
|
||||
use ::core::pin::Pin;
|
||||
|
@ -1,6 +1,8 @@
|
||||
// revisions: no_drop_tracking drop_tracking drop_tracking_mir
|
||||
// [drop_tracking] compile-flags: -Zdrop-tracking
|
||||
// [drop_tracking_mir] compile-flags: -Zdrop-tracking-mir
|
||||
// edition:2021
|
||||
// build-pass
|
||||
// compile-flags: -Zdrop-tracking
|
||||
|
||||
fn main() {
|
||||
let _ = async {
|
||||
|
@ -1,3 +1,6 @@
|
||||
// revisions: no_drop_tracking drop_tracking drop_tracking_mir
|
||||
// [drop_tracking] compile-flags: -Zdrop-tracking
|
||||
// [drop_tracking_mir] compile-flags: -Zdrop-tracking-mir
|
||||
// edition:2018
|
||||
|
||||
use std::sync::{Arc, Mutex};
|
||||
|
@ -0,0 +1,33 @@
|
||||
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
|
||||
|
@ -4,13 +4,14 @@ error: future cannot be sent between threads safely
|
||||
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: 19:6]`, the trait `Send` is not implemented for `*const u8`
|
||||
= 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:18:35
|
||||
--> $DIR/issue-65436-raw-ptr-not-send.rs:19:35
|
||||
|
|
||||
LL | bar(Foo(std::ptr::null())).await;
|
||||
| ---------------- ^^^^^^- `std::ptr::null()` is later dropped here
|
||||
@ -18,7 +19,7 @@ LL | bar(Foo(std::ptr::null())).await;
|
||||
| | 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:18:13
|
||||
--> $DIR/issue-65436-raw-ptr-not-send.rs:19:13
|
||||
|
|
||||
LL | bar(Foo(std::ptr::null())).await;
|
||||
| ^^^^^^^^^^^^^^^^^^^^^
|
||||
|
@ -1,8 +1,8 @@
|
||||
// edition:2018
|
||||
// revisions: no_drop_tracking drop_tracking
|
||||
// revisions: no_drop_tracking drop_tracking drop_tracking_mir
|
||||
// [drop_tracking] compile-flags: -Zdrop-tracking
|
||||
// [drop_tracking_mir] compile-flags: -Zdrop-tracking-mir
|
||||
// [drop_tracking] check-pass
|
||||
// [drop_tracking] compile-flags: -Zdrop-tracking=yes
|
||||
// [no_drop_tracking] compile-flags: -Zdrop-tracking=no
|
||||
|
||||
struct Foo(*const u8);
|
||||
|
||||
@ -15,6 +15,7 @@ fn assert_send<T: Send>(_: T) {}
|
||||
fn main() {
|
||||
assert_send(async {
|
||||
//[no_drop_tracking]~^ ERROR future cannot be sent between threads safely
|
||||
//[drop_tracking_mir]~^^ ERROR future cannot be sent between threads safely
|
||||
bar(Foo(std::ptr::null())).await;
|
||||
})
|
||||
}
|
||||
|
@ -1,6 +1,10 @@
|
||||
// build-pass
|
||||
// edition:2018
|
||||
|
||||
// revisions: no_drop_tracking drop_tracking drop_tracking_mir
|
||||
// [drop_tracking] compile-flags: -Zdrop-tracking
|
||||
// [drop_tracking_mir] compile-flags: -Zdrop-tracking-mir
|
||||
|
||||
static mut A: [i32; 5] = [1, 2, 3, 4, 5];
|
||||
|
||||
fn is_send_sync<T: Send + Sync>(_: T) {}
|
||||
|
@ -6,7 +6,7 @@ LL | g(issue_67893::run())
|
||||
|
|
||||
= help: within `impl Future<Output = ()>`, the trait `Send` is not implemented for `MutexGuard<'_, ()>`
|
||||
note: future is not `Send` as this value is used across an await
|
||||
--> $DIR/auxiliary/issue_67893.rs:9:26
|
||||
--> $DIR/auxiliary/issue_67893.rs:12:26
|
||||
|
|
||||
LL | f(*x.lock().unwrap()).await;
|
||||
| ----------------- ^^^^^^- `x.lock().unwrap()` is later dropped here
|
||||
|
@ -0,0 +1,21 @@
|
||||
error[E0733]: recursion in an `async fn` requires boxing
|
||||
--> $DIR/mutually-recursive-async-impl-trait-type.rs:9:18
|
||||
|
|
||||
LL | async fn rec_1() {
|
||||
| ^ recursive `async fn`
|
||||
|
|
||||
= note: a recursive `async fn` must be rewritten to return a boxed `dyn Future`
|
||||
= note: consider using the `async_recursion` crate: https://crates.io/crates/async_recursion
|
||||
|
||||
error[E0733]: recursion in an `async fn` requires boxing
|
||||
--> $DIR/mutually-recursive-async-impl-trait-type.rs:13:18
|
||||
|
|
||||
LL | async fn rec_2() {
|
||||
| ^ recursive `async fn`
|
||||
|
|
||||
= note: a recursive `async fn` must be rewritten to return a boxed `dyn Future`
|
||||
= note: consider using the `async_recursion` crate: https://crates.io/crates/async_recursion
|
||||
|
||||
error: aborting due to 2 previous errors
|
||||
|
||||
For more information about this error, try `rustc --explain E0733`.
|
@ -0,0 +1,21 @@
|
||||
error[E0733]: recursion in an `async fn` requires boxing
|
||||
--> $DIR/mutually-recursive-async-impl-trait-type.rs:9:18
|
||||
|
|
||||
LL | async fn rec_1() {
|
||||
| ^ recursive `async fn`
|
||||
|
|
||||
= note: a recursive `async fn` must be rewritten to return a boxed `dyn Future`
|
||||
= note: consider using the `async_recursion` crate: https://crates.io/crates/async_recursion
|
||||
|
||||
error[E0733]: recursion in an `async fn` requires boxing
|
||||
--> $DIR/mutually-recursive-async-impl-trait-type.rs:13:18
|
||||
|
|
||||
LL | async fn rec_2() {
|
||||
| ^ recursive `async fn`
|
||||
|
|
||||
= note: a recursive `async fn` must be rewritten to return a boxed `dyn Future`
|
||||
= note: consider using the `async_recursion` crate: https://crates.io/crates/async_recursion
|
||||
|
||||
error: aborting due to 2 previous errors
|
||||
|
||||
For more information about this error, try `rustc --explain E0733`.
|
@ -0,0 +1,21 @@
|
||||
error[E0733]: recursion in an `async fn` requires boxing
|
||||
--> $DIR/mutually-recursive-async-impl-trait-type.rs:9:18
|
||||
|
|
||||
LL | async fn rec_1() {
|
||||
| ^ recursive `async fn`
|
||||
|
|
||||
= note: a recursive `async fn` must be rewritten to return a boxed `dyn Future`
|
||||
= note: consider using the `async_recursion` crate: https://crates.io/crates/async_recursion
|
||||
|
||||
error[E0733]: recursion in an `async fn` requires boxing
|
||||
--> $DIR/mutually-recursive-async-impl-trait-type.rs:13:18
|
||||
|
|
||||
LL | async fn rec_2() {
|
||||
| ^ recursive `async fn`
|
||||
|
|
||||
= note: a recursive `async fn` must be rewritten to return a boxed `dyn Future`
|
||||
= note: consider using the `async_recursion` crate: https://crates.io/crates/async_recursion
|
||||
|
||||
error: aborting due to 2 previous errors
|
||||
|
||||
For more information about this error, try `rustc --explain E0733`.
|
@ -1,3 +1,7 @@
|
||||
// revisions: no_drop_tracking drop_tracking drop_tracking_mir
|
||||
// [drop_tracking] compile-flags: -Zdrop-tracking
|
||||
// [drop_tracking_mir] compile-flags: -Zdrop-tracking-mir
|
||||
|
||||
// edition:2018
|
||||
// Test that impl trait does not allow creating recursive types that are
|
||||
// otherwise forbidden when using `async` and `await`.
|
||||
|
@ -1,5 +1,5 @@
|
||||
error[E0733]: recursion in an `async fn` requires boxing
|
||||
--> $DIR/mutually-recursive-async-impl-trait-type.rs:5:18
|
||||
--> $DIR/mutually-recursive-async-impl-trait-type.rs:9:18
|
||||
|
|
||||
LL | async fn rec_1() {
|
||||
| ^ recursive `async fn`
|
||||
@ -8,7 +8,7 @@ LL | async fn rec_1() {
|
||||
= note: consider using the `async_recursion` crate: https://crates.io/crates/async_recursion
|
||||
|
||||
error[E0733]: recursion in an `async fn` requires boxing
|
||||
--> $DIR/mutually-recursive-async-impl-trait-type.rs:9:18
|
||||
--> $DIR/mutually-recursive-async-impl-trait-type.rs:13:18
|
||||
|
|
||||
LL | async fn rec_2() {
|
||||
| ^ recursive `async fn`
|
||||
|
@ -1,6 +1,8 @@
|
||||
// revisions: no_drop_tracking drop_tracking drop_tracking_mir
|
||||
// [drop_tracking] compile-flags: -Zdrop-tracking
|
||||
// [drop_tracking_mir] compile-flags: -Zdrop-tracking-mir
|
||||
// build-pass
|
||||
// edition:2018
|
||||
// compile-flags: -Zdrop-tracking=y
|
||||
|
||||
#![feature(generators)]
|
||||
|
||||
|
@ -0,0 +1,12 @@
|
||||
error[E0733]: recursion in an `async fn` requires boxing
|
||||
--> $DIR/recursive-async-impl-trait-type.rs:8:40
|
||||
|
|
||||
LL | async fn recursive_async_function() -> () {
|
||||
| ^^ recursive `async fn`
|
||||
|
|
||||
= note: a recursive `async fn` must be rewritten to return a boxed `dyn Future`
|
||||
= note: consider using the `async_recursion` crate: https://crates.io/crates/async_recursion
|
||||
|
||||
error: aborting due to previous error
|
||||
|
||||
For more information about this error, try `rustc --explain E0733`.
|
@ -0,0 +1,12 @@
|
||||
error[E0733]: recursion in an `async fn` requires boxing
|
||||
--> $DIR/recursive-async-impl-trait-type.rs:8:40
|
||||
|
|
||||
LL | async fn recursive_async_function() -> () {
|
||||
| ^^ recursive `async fn`
|
||||
|
|
||||
= note: a recursive `async fn` must be rewritten to return a boxed `dyn Future`
|
||||
= note: consider using the `async_recursion` crate: https://crates.io/crates/async_recursion
|
||||
|
||||
error: aborting due to previous error
|
||||
|
||||
For more information about this error, try `rustc --explain E0733`.
|
@ -0,0 +1,12 @@
|
||||
error[E0733]: recursion in an `async fn` requires boxing
|
||||
--> $DIR/recursive-async-impl-trait-type.rs:8:40
|
||||
|
|
||||
LL | async fn recursive_async_function() -> () {
|
||||
| ^^ recursive `async fn`
|
||||
|
|
||||
= note: a recursive `async fn` must be rewritten to return a boxed `dyn Future`
|
||||
= note: consider using the `async_recursion` crate: https://crates.io/crates/async_recursion
|
||||
|
||||
error: aborting due to previous error
|
||||
|
||||
For more information about this error, try `rustc --explain E0733`.
|
@ -1,3 +1,6 @@
|
||||
// revisions: no_drop_tracking drop_tracking drop_tracking_mir
|
||||
// [drop_tracking] compile-flags: -Zdrop-tracking
|
||||
// [drop_tracking_mir] compile-flags: -Zdrop-tracking-mir
|
||||
// edition:2018
|
||||
// Test that impl trait does not allow creating recursive types that are
|
||||
// otherwise forbidden when using `async` and `await`.
|
||||
|
@ -1,5 +1,5 @@
|
||||
error[E0733]: recursion in an `async fn` requires boxing
|
||||
--> $DIR/recursive-async-impl-trait-type.rs:5:40
|
||||
--> $DIR/recursive-async-impl-trait-type.rs:8:40
|
||||
|
|
||||
LL | async fn recursive_async_function() -> () {
|
||||
| ^^ recursive `async fn`
|
||||
|
@ -0,0 +1,39 @@
|
||||
error[E0698]: type inside `async fn` body must be known in this context
|
||||
--> $DIR/unresolved_type_param.rs:13:5
|
||||
|
|
||||
LL | bar().await;
|
||||
| ^^^ cannot infer type for type parameter `T` declared on the function `bar`
|
||||
|
|
||||
note: the type is part of the `async fn` body because of this `await`
|
||||
--> $DIR/unresolved_type_param.rs:13:10
|
||||
|
|
||||
LL | bar().await;
|
||||
| ^^^^^^
|
||||
|
||||
error[E0698]: type inside `async fn` body must be known in this context
|
||||
--> $DIR/unresolved_type_param.rs:13:5
|
||||
|
|
||||
LL | bar().await;
|
||||
| ^^^ cannot infer type for type parameter `T` declared on the function `bar`
|
||||
|
|
||||
note: the type is part of the `async fn` body because of this `await`
|
||||
--> $DIR/unresolved_type_param.rs:13:10
|
||||
|
|
||||
LL | bar().await;
|
||||
| ^^^^^^
|
||||
|
||||
error[E0698]: type inside `async fn` body must be known in this context
|
||||
--> $DIR/unresolved_type_param.rs:13:5
|
||||
|
|
||||
LL | bar().await;
|
||||
| ^^^ cannot infer type for type parameter `T` declared on the function `bar`
|
||||
|
|
||||
note: the type is part of the `async fn` body because of this `await`
|
||||
--> $DIR/unresolved_type_param.rs:13:10
|
||||
|
|
||||
LL | bar().await;
|
||||
| ^^^^^^
|
||||
|
||||
error: aborting due to 3 previous errors
|
||||
|
||||
For more information about this error, try `rustc --explain E0698`.
|
@ -0,0 +1,39 @@
|
||||
error[E0698]: type inside `async fn` body must be known in this context
|
||||
--> $DIR/unresolved_type_param.rs:13:5
|
||||
|
|
||||
LL | bar().await;
|
||||
| ^^^ cannot infer type for type parameter `T` declared on the function `bar`
|
||||
|
|
||||
note: the type is part of the `async fn` body because of this `await`
|
||||
--> $DIR/unresolved_type_param.rs:13:10
|
||||
|
|
||||
LL | bar().await;
|
||||
| ^^^^^^
|
||||
|
||||
error[E0698]: type inside `async fn` body must be known in this context
|
||||
--> $DIR/unresolved_type_param.rs:13:5
|
||||
|
|
||||
LL | bar().await;
|
||||
| ^^^ cannot infer type for type parameter `T` declared on the function `bar`
|
||||
|
|
||||
note: the type is part of the `async fn` body because of this `await`
|
||||
--> $DIR/unresolved_type_param.rs:13:10
|
||||
|
|
||||
LL | bar().await;
|
||||
| ^^^^^^
|
||||
|
||||
error[E0698]: type inside `async fn` body must be known in this context
|
||||
--> $DIR/unresolved_type_param.rs:13:5
|
||||
|
|
||||
LL | bar().await;
|
||||
| ^^^ cannot infer type for type parameter `T` declared on the function `bar`
|
||||
|
|
||||
note: the type is part of the `async fn` body because of this `await`
|
||||
--> $DIR/unresolved_type_param.rs:13:10
|
||||
|
|
||||
LL | bar().await;
|
||||
| ^^^^^^
|
||||
|
||||
error: aborting due to 3 previous errors
|
||||
|
||||
For more information about this error, try `rustc --explain E0698`.
|
@ -0,0 +1,39 @@
|
||||
error[E0698]: type inside `async fn` body must be known in this context
|
||||
--> $DIR/unresolved_type_param.rs:13:5
|
||||
|
|
||||
LL | bar().await;
|
||||
| ^^^ cannot infer type for type parameter `T` declared on the function `bar`
|
||||
|
|
||||
note: the type is part of the `async fn` body because of this `await`
|
||||
--> $DIR/unresolved_type_param.rs:13:10
|
||||
|
|
||||
LL | bar().await;
|
||||
| ^^^^^^
|
||||
|
||||
error[E0698]: type inside `async fn` body must be known in this context
|
||||
--> $DIR/unresolved_type_param.rs:13:5
|
||||
|
|
||||
LL | bar().await;
|
||||
| ^^^ cannot infer type for type parameter `T` declared on the function `bar`
|
||||
|
|
||||
note: the type is part of the `async fn` body because of this `await`
|
||||
--> $DIR/unresolved_type_param.rs:13:10
|
||||
|
|
||||
LL | bar().await;
|
||||
| ^^^^^^
|
||||
|
||||
error[E0698]: type inside `async fn` body must be known in this context
|
||||
--> $DIR/unresolved_type_param.rs:13:5
|
||||
|
|
||||
LL | bar().await;
|
||||
| ^^^ cannot infer type for type parameter `T` declared on the function `bar`
|
||||
|
|
||||
note: the type is part of the `async fn` body because of this `await`
|
||||
--> $DIR/unresolved_type_param.rs:13:10
|
||||
|
|
||||
LL | bar().await;
|
||||
| ^^^^^^
|
||||
|
||||
error: aborting due to 3 previous errors
|
||||
|
||||
For more information about this error, try `rustc --explain E0698`.
|
@ -1,3 +1,6 @@
|
||||
// revisions: no_drop_tracking drop_tracking drop_tracking_mir
|
||||
// [drop_tracking] compile-flags: -Zdrop-tracking
|
||||
// [drop_tracking_mir] compile-flags: -Zdrop-tracking-mir
|
||||
// Provoke an unresolved type error (T).
|
||||
// Error message should pinpoint the type parameter T as needing to be bound
|
||||
// (rather than give a general error message)
|
||||
|
@ -1,35 +1,35 @@
|
||||
error[E0698]: type inside `async fn` body must be known in this context
|
||||
--> $DIR/unresolved_type_param.rs:10:5
|
||||
--> $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:10:10
|
||||
--> $DIR/unresolved_type_param.rs:13:10
|
||||
|
|
||||
LL | bar().await;
|
||||
| ^^^^^^
|
||||
|
||||
error[E0698]: type inside `async fn` body must be known in this context
|
||||
--> $DIR/unresolved_type_param.rs:10:5
|
||||
--> $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:10:10
|
||||
--> $DIR/unresolved_type_param.rs:13:10
|
||||
|
|
||||
LL | bar().await;
|
||||
| ^^^^^^
|
||||
|
||||
error[E0698]: type inside `async fn` body must be known in this context
|
||||
--> $DIR/unresolved_type_param.rs:10:5
|
||||
--> $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:10:10
|
||||
--> $DIR/unresolved_type_param.rs:13:10
|
||||
|
|
||||
LL | bar().await;
|
||||
| ^^^^^^
|
||||
|
@ -1,3 +1,6 @@
|
||||
// revisions: no_drop_tracking drop_tracking drop_tracking_mir
|
||||
// [drop_tracking] compile-flags: -Zdrop-tracking
|
||||
// [drop_tracking_mir] compile-flags: -Zdrop-tracking-mir
|
||||
// run-pass
|
||||
// Regression test for broken MIR error (#61442)
|
||||
// Due to the two possible evaluation orders for
|
||||
|
47
tests/ui/generator/auto-trait-regions.drop_tracking.stderr
Normal file
47
tests/ui/generator/auto-trait-regions.drop_tracking.stderr
Normal file
@ -0,0 +1,47 @@
|
||||
error[E0716]: temporary value dropped while borrowed
|
||||
--> $DIR/auto-trait-regions.rs:48:24
|
||||
|
|
||||
LL | let a = A(&mut true, &mut true, No);
|
||||
| ^^^^ - temporary value is freed at the end of this statement
|
||||
| |
|
||||
| creates a temporary value which is freed while still in use
|
||||
...
|
||||
LL | assert_foo(a);
|
||||
| - borrow later used here
|
||||
|
|
||||
= note: consider using a `let` binding to create a longer lived value
|
||||
|
||||
error[E0716]: temporary value dropped while borrowed
|
||||
--> $DIR/auto-trait-regions.rs:48:35
|
||||
|
|
||||
LL | let a = A(&mut true, &mut true, No);
|
||||
| ^^^^ - temporary value is freed at the end of this statement
|
||||
| |
|
||||
| creates a temporary value which is freed while still in use
|
||||
...
|
||||
LL | assert_foo(a);
|
||||
| - borrow later used here
|
||||
|
|
||||
= note: consider using a `let` binding to create a longer lived value
|
||||
|
||||
error: implementation of `Foo` is not general enough
|
||||
--> $DIR/auto-trait-regions.rs:34:5
|
||||
|
|
||||
LL | assert_foo(gen);
|
||||
| ^^^^^^^^^^^^^^^ implementation of `Foo` is not general enough
|
||||
|
|
||||
= note: `&'0 OnlyFooIfStaticRef` must implement `Foo`, for any lifetime `'0`...
|
||||
= note: ...but `Foo` is actually implemented for the type `&'static OnlyFooIfStaticRef`
|
||||
|
||||
error: implementation of `Foo` is not general enough
|
||||
--> $DIR/auto-trait-regions.rs:54:5
|
||||
|
|
||||
LL | assert_foo(gen);
|
||||
| ^^^^^^^^^^^^^^^ implementation of `Foo` is not general enough
|
||||
|
|
||||
= note: `Foo` would have to be implemented for the type `A<'0, '1>`, for any two lifetimes `'0` and `'1`...
|
||||
= note: ...but `Foo` is actually implemented for the type `A<'_, '2>`, for some specific lifetime `'2`
|
||||
|
||||
error: aborting due to 4 previous errors
|
||||
|
||||
For more information about this error, try `rustc --explain E0716`.
|
@ -0,0 +1,47 @@
|
||||
error[E0716]: temporary value dropped while borrowed
|
||||
--> $DIR/auto-trait-regions.rs:48:24
|
||||
|
|
||||
LL | let a = A(&mut true, &mut true, No);
|
||||
| ^^^^ - temporary value is freed at the end of this statement
|
||||
| |
|
||||
| creates a temporary value which is freed while still in use
|
||||
...
|
||||
LL | assert_foo(a);
|
||||
| - borrow later used here
|
||||
|
|
||||
= note: consider using a `let` binding to create a longer lived value
|
||||
|
||||
error[E0716]: temporary value dropped while borrowed
|
||||
--> $DIR/auto-trait-regions.rs:48:35
|
||||
|
|
||||
LL | let a = A(&mut true, &mut true, No);
|
||||
| ^^^^ - temporary value is freed at the end of this statement
|
||||
| |
|
||||
| creates a temporary value which is freed while still in use
|
||||
...
|
||||
LL | assert_foo(a);
|
||||
| - borrow later used here
|
||||
|
|
||||
= note: consider using a `let` binding to create a longer lived value
|
||||
|
||||
error: implementation of `Foo` is not general enough
|
||||
--> $DIR/auto-trait-regions.rs:34:5
|
||||
|
|
||||
LL | assert_foo(gen);
|
||||
| ^^^^^^^^^^^^^^^ implementation of `Foo` is not general enough
|
||||
|
|
||||
= note: `&'0 OnlyFooIfStaticRef` must implement `Foo`, for any lifetime `'0`...
|
||||
= note: ...but `Foo` is actually implemented for the type `&'static OnlyFooIfStaticRef`
|
||||
|
||||
error: implementation of `Foo` is not general enough
|
||||
--> $DIR/auto-trait-regions.rs:54:5
|
||||
|
|
||||
LL | assert_foo(gen);
|
||||
| ^^^^^^^^^^^^^^^ implementation of `Foo` is not general enough
|
||||
|
|
||||
= note: `Foo` would have to be implemented for the type `A<'0, '1>`, for any two lifetimes `'0` and `'1`...
|
||||
= note: ...but `Foo` is actually implemented for the type `A<'_, '2>`, for some specific lifetime `'2`
|
||||
|
||||
error: aborting due to 4 previous errors
|
||||
|
||||
For more information about this error, try `rustc --explain E0716`.
|
@ -0,0 +1,47 @@
|
||||
error[E0716]: temporary value dropped while borrowed
|
||||
--> $DIR/auto-trait-regions.rs:48:24
|
||||
|
|
||||
LL | let a = A(&mut true, &mut true, No);
|
||||
| ^^^^ - temporary value is freed at the end of this statement
|
||||
| |
|
||||
| creates a temporary value which is freed while still in use
|
||||
...
|
||||
LL | assert_foo(a);
|
||||
| - borrow later used here
|
||||
|
|
||||
= note: consider using a `let` binding to create a longer lived value
|
||||
|
||||
error[E0716]: temporary value dropped while borrowed
|
||||
--> $DIR/auto-trait-regions.rs:48:35
|
||||
|
|
||||
LL | let a = A(&mut true, &mut true, No);
|
||||
| ^^^^ - temporary value is freed at the end of this statement
|
||||
| |
|
||||
| creates a temporary value which is freed while still in use
|
||||
...
|
||||
LL | assert_foo(a);
|
||||
| - borrow later used here
|
||||
|
|
||||
= note: consider using a `let` binding to create a longer lived value
|
||||
|
||||
error: implementation of `Foo` is not general enough
|
||||
--> $DIR/auto-trait-regions.rs:34:5
|
||||
|
|
||||
LL | assert_foo(gen);
|
||||
| ^^^^^^^^^^^^^^^ implementation of `Foo` is not general enough
|
||||
|
|
||||
= note: `&'0 OnlyFooIfStaticRef` must implement `Foo`, for any lifetime `'0`...
|
||||
= note: ...but `Foo` is actually implemented for the type `&'static OnlyFooIfStaticRef`
|
||||
|
||||
error: implementation of `Foo` is not general enough
|
||||
--> $DIR/auto-trait-regions.rs:54:5
|
||||
|
|
||||
LL | assert_foo(gen);
|
||||
| ^^^^^^^^^^^^^^^ implementation of `Foo` is not general enough
|
||||
|
|
||||
= note: `Foo` would have to be implemented for the type `A<'0, '1>`, for any two lifetimes `'0` and `'1`...
|
||||
= note: ...but `Foo` is actually implemented for the type `A<'_, '2>`, for some specific lifetime `'2`
|
||||
|
||||
error: aborting due to 4 previous errors
|
||||
|
||||
For more information about this error, try `rustc --explain E0716`.
|
@ -1,3 +1,6 @@
|
||||
// revisions: no_drop_tracking drop_tracking drop_tracking_mir
|
||||
// [drop_tracking] compile-flags: -Zdrop-tracking
|
||||
// [drop_tracking_mir] compile-flags: -Zdrop-tracking-mir
|
||||
#![feature(generators)]
|
||||
#![feature(auto_traits)]
|
||||
#![feature(negative_impls)]
|
||||
|
@ -1,5 +1,5 @@
|
||||
error[E0716]: temporary value dropped while borrowed
|
||||
--> $DIR/auto-trait-regions.rs:45:24
|
||||
--> $DIR/auto-trait-regions.rs:48:24
|
||||
|
|
||||
LL | let a = A(&mut true, &mut true, No);
|
||||
| ^^^^ - temporary value is freed at the end of this statement
|
||||
@ -12,7 +12,7 @@ LL | assert_foo(a);
|
||||
= note: consider using a `let` binding to create a longer lived value
|
||||
|
||||
error[E0716]: temporary value dropped while borrowed
|
||||
--> $DIR/auto-trait-regions.rs:45:35
|
||||
--> $DIR/auto-trait-regions.rs:48:35
|
||||
|
|
||||
LL | let a = A(&mut true, &mut true, No);
|
||||
| ^^^^ - temporary value is freed at the end of this statement
|
||||
@ -25,7 +25,7 @@ LL | assert_foo(a);
|
||||
= note: consider using a `let` binding to create a longer lived value
|
||||
|
||||
error: implementation of `Foo` is not general enough
|
||||
--> $DIR/auto-trait-regions.rs:31:5
|
||||
--> $DIR/auto-trait-regions.rs:34:5
|
||||
|
|
||||
LL | assert_foo(gen);
|
||||
| ^^^^^^^^^^^^^^^ implementation of `Foo` is not general enough
|
||||
@ -34,7 +34,7 @@ LL | assert_foo(gen);
|
||||
= note: ...but `Foo` is actually implemented for the type `&'static OnlyFooIfStaticRef`
|
||||
|
||||
error: implementation of `Foo` is not general enough
|
||||
--> $DIR/auto-trait-regions.rs:51:5
|
||||
--> $DIR/auto-trait-regions.rs:54:5
|
||||
|
|
||||
LL | assert_foo(gen);
|
||||
| ^^^^^^^^^^^^^^^ implementation of `Foo` is not general enough
|
||||
|
31
tests/ui/generator/borrowing.drop_tracking.stderr
Normal file
31
tests/ui/generator/borrowing.drop_tracking.stderr
Normal file
@ -0,0 +1,31 @@
|
||||
error[E0597]: `a` does not live long enough
|
||||
--> $DIR/borrowing.rs:13:33
|
||||
|
|
||||
LL | let _b = {
|
||||
| -- borrow later stored here
|
||||
LL | let a = 3;
|
||||
LL | Pin::new(&mut || yield &a).resume(())
|
||||
| -- ^ borrowed value does not live long enough
|
||||
| |
|
||||
| value captured here by generator
|
||||
LL |
|
||||
LL | };
|
||||
| - `a` dropped here while still borrowed
|
||||
|
||||
error[E0597]: `a` does not live long enough
|
||||
--> $DIR/borrowing.rs:20:20
|
||||
|
|
||||
LL | let _b = {
|
||||
| -- borrow later stored here
|
||||
LL | let a = 3;
|
||||
LL | || {
|
||||
| -- value captured here by generator
|
||||
LL | yield &a
|
||||
| ^ borrowed value does not live long enough
|
||||
...
|
||||
LL | };
|
||||
| - `a` dropped here while still borrowed
|
||||
|
||||
error: aborting due to 2 previous errors
|
||||
|
||||
For more information about this error, try `rustc --explain E0597`.
|
31
tests/ui/generator/borrowing.drop_tracking_mir.stderr
Normal file
31
tests/ui/generator/borrowing.drop_tracking_mir.stderr
Normal file
@ -0,0 +1,31 @@
|
||||
error[E0597]: `a` does not live long enough
|
||||
--> $DIR/borrowing.rs:13:33
|
||||
|
|
||||
LL | let _b = {
|
||||
| -- borrow later stored here
|
||||
LL | let a = 3;
|
||||
LL | Pin::new(&mut || yield &a).resume(())
|
||||
| -- ^ borrowed value does not live long enough
|
||||
| |
|
||||
| value captured here by generator
|
||||
LL |
|
||||
LL | };
|
||||
| - `a` dropped here while still borrowed
|
||||
|
||||
error[E0597]: `a` does not live long enough
|
||||
--> $DIR/borrowing.rs:20:20
|
||||
|
|
||||
LL | let _b = {
|
||||
| -- borrow later stored here
|
||||
LL | let a = 3;
|
||||
LL | || {
|
||||
| -- value captured here by generator
|
||||
LL | yield &a
|
||||
| ^ borrowed value does not live long enough
|
||||
...
|
||||
LL | };
|
||||
| - `a` dropped here while still borrowed
|
||||
|
||||
error: aborting due to 2 previous errors
|
||||
|
||||
For more information about this error, try `rustc --explain E0597`.
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user