diff options
Diffstat (limited to '')
162 files changed, 1104 insertions, 2640 deletions
diff --git a/tests/ui/async-await/async-await-let-else.drop-tracking.stderr b/tests/ui/async-await/async-await-let-else.drop-tracking.stderr deleted file mode 100644 index fb83ca90a..000000000 --- a/tests/ui/async-await/async-await-let-else.drop-tracking.stderr +++ /dev/null @@ -1,106 +0,0 @@ -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`. diff --git a/tests/ui/async-await/async-await-let-else.drop_tracking.stderr b/tests/ui/async-await/async-await-let-else.drop_tracking.stderr deleted file mode 100644 index dee90262f..000000000 --- a/tests/ui/async-await/async-await-let-else.drop_tracking.stderr +++ /dev/null @@ -1,106 +0,0 @@ -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:15 - | -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:29 - | -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:15 - | -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`. diff --git a/tests/ui/async-await/async-await-let-else.drop_tracking_mir.stderr b/tests/ui/async-await/async-await-let-else.drop_tracking_mir.stderr deleted file mode 100644 index e3fcceaa3..000000000 --- a/tests/ui/async-await/async-await-let-else.drop_tracking_mir.stderr +++ /dev/null @@ -1,100 +0,0 @@ -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:15 - | -LL | let r = Rc::new(()); - | - has type `Rc<()>` which is not `Send` -LL | bar().await - | ^^^^^ await occurs here, with `r` maybe used later -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: `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:29 - | -LL | (Rc::new(()), bar().await); - | ----------- ^^^^^ 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:15 - | -LL | let r = Rc::new(()); - | - has type `Rc<()>` which is not `Send` -LL | bar().await; - | ^^^^^ await occurs here, with `r` maybe used later -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`. diff --git a/tests/ui/async-await/async-await-let-else.no-drop-tracking.stderr b/tests/ui/async-await/async-await-let-else.no-drop-tracking.stderr deleted file mode 100644 index d3c5e80a3..000000000 --- a/tests/ui/async-await/async-await-let-else.no-drop-tracking.stderr +++ /dev/null @@ -1,90 +0,0 @@ -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 - diff --git a/tests/ui/async-await/async-await-let-else.no_drop_tracking.stderr b/tests/ui/async-await/async-await-let-else.no_drop_tracking.stderr deleted file mode 100644 index ece4e51ec..000000000 --- a/tests/ui/async-await/async-await-let-else.no_drop_tracking.stderr +++ /dev/null @@ -1,90 +0,0 @@ -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:15 - | -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:27 - | -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:29 - | -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:15 - | -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 - diff --git a/tests/ui/async-await/async-await-let-else.rs b/tests/ui/async-await/async-await-let-else.rs index 113d576b5..a3c722605 100644 --- a/tests/ui/async-await/async-await-let-else.rs +++ b/tests/ui/async-await/async-await-let-else.rs @@ -1,7 +1,4 @@ // edition:2021 -// 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; diff --git a/tests/ui/async-await/async-await-let-else.stderr b/tests/ui/async-await/async-await-let-else.stderr new file mode 100644 index 000000000..9a1c17822 --- /dev/null +++ b/tests/ui/async-await/async-await-let-else.stderr @@ -0,0 +1,100 @@ +error: future cannot be sent between threads safely + --> $DIR/async-await-let-else.rs:45: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:8:15 + | +LL | let r = Rc::new(()); + | - has type `Rc<()>` which is not `Send` +LL | bar().await + | ^^^^^ await occurs here, with `r` maybe used later +note: required by a bound in `is_send` + --> $DIR/async-await-let-else.rs:16: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:47: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:24:29 + | +LL | async fn bar2<T>(_: T) -> ! { + | _____________________________^ +LL | | panic!() +LL | | } + | |_^ + = note: required because it captures the following types: `impl Future<Output = !>` +note: required because it's used within this `async fn` body + --> $DIR/async-await-let-else.rs:18: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:16: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:49: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:30:29 + | +LL | (Rc::new(()), bar().await); + | ----------- ^^^^^ 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:16: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:51: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:38:15 + | +LL | let r = Rc::new(()); + | - has type `Rc<()>` which is not `Send` +LL | bar().await; + | ^^^^^ await occurs here, with `r` maybe used later +note: required by a bound in `is_send` + --> $DIR/async-await-let-else.rs:16: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`. diff --git a/tests/ui/async-await/async-block-control-flow-static-semantics.stderr b/tests/ui/async-await/async-block-control-flow-static-semantics.stderr index bbd5a822d..c89671cc4 100644 --- a/tests/ui/async-await/async-block-control-flow-static-semantics.stderr +++ b/tests/ui/async-await/async-block-control-flow-static-semantics.stderr @@ -29,13 +29,13 @@ LL | | LL | | } | |_^ expected `u8`, found `()` -error[E0271]: expected `[async block@$DIR/async-block-control-flow-static-semantics.rs:23:17: 25:6]` to be a future that resolves to `()`, but it resolves to `u8` +error[E0271]: expected `{async block@$DIR/async-block-control-flow-static-semantics.rs:23:17: 25:6}` to be a future that resolves to `()`, but it resolves to `u8` --> $DIR/async-block-control-flow-static-semantics.rs:26:39 | LL | let _: &dyn Future<Output = ()> = █ | ^^^^^^ expected `()`, found `u8` | - = note: required for the cast from `&[async block@$DIR/async-block-control-flow-static-semantics.rs:23:17: 25:6]` to `&dyn Future<Output = ()>` + = note: required for the cast from `&{async block@$DIR/async-block-control-flow-static-semantics.rs:23:17: 25:6}` to `&dyn Future<Output = ()>` error[E0308]: mismatched types --> $DIR/async-block-control-flow-static-semantics.rs:12:43 @@ -45,13 +45,13 @@ LL | fn return_targets_async_block_not_fn() -> u8 { | | | implicitly returns `()` as its body has no tail or `return` expression -error[E0271]: expected `[async block@$DIR/async-block-control-flow-static-semantics.rs:14:17: 16:6]` to be a future that resolves to `()`, but it resolves to `u8` +error[E0271]: expected `{async block@$DIR/async-block-control-flow-static-semantics.rs:14:17: 16:6}` to be a future that resolves to `()`, but it resolves to `u8` --> $DIR/async-block-control-flow-static-semantics.rs:17:39 | LL | let _: &dyn Future<Output = ()> = █ | ^^^^^^ expected `()`, found `u8` | - = note: required for the cast from `&[async block@$DIR/async-block-control-flow-static-semantics.rs:14:17: 16:6]` to `&dyn Future<Output = ()>` + = note: required for the cast from `&{async block@$DIR/async-block-control-flow-static-semantics.rs:14:17: 16:6}` to `&dyn Future<Output = ()>` error[E0308]: mismatched types --> $DIR/async-block-control-flow-static-semantics.rs:49:44 diff --git a/tests/ui/async-await/async-error-span.drop_tracking.stderr b/tests/ui/async-await/async-error-span.drop_tracking.stderr deleted file mode 100644 index 99a674a26..000000000 --- a/tests/ui/async-await/async-error-span.drop_tracking.stderr +++ /dev/null @@ -1,25 +0,0 @@ -error[E0277]: `()` is not a future - --> $DIR/async-error-span.rs:10:20 - | -LL | fn get_future() -> impl Future<Output = ()> { - | ^^^^^^^^^^^^^^^^^^^^^^^^ `()` is not a future - | - = help: the trait `Future` is not implemented for `()` - = note: () must be a future or must implement `IntoFuture` to be awaited - -error[E0698]: type inside `async fn` body must be known in this context - --> $DIR/async-error-span.rs:16:9 - | -LL | let a; - | ^ cannot infer type - | -note: the type is part of the `async fn` body because of this `await` - --> $DIR/async-error-span.rs:19:18 - | -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`. diff --git a/tests/ui/async-await/async-error-span.drop_tracking_mir.stderr b/tests/ui/async-await/async-error-span.drop_tracking_mir.stderr deleted file mode 100644 index 2f29ee6cd..000000000 --- a/tests/ui/async-await/async-error-span.drop_tracking_mir.stderr +++ /dev/null @@ -1,24 +0,0 @@ -error[E0277]: `()` is not a future - --> $DIR/async-error-span.rs:10:20 - | -LL | fn get_future() -> impl Future<Output = ()> { - | ^^^^^^^^^^^^^^^^^^^^^^^^ `()` is not a future - | - = help: the trait `Future` is not implemented for `()` - = note: () must be a future or must implement `IntoFuture` to be awaited - -error[E0282]: type annotations needed - --> $DIR/async-error-span.rs:16:9 - | -LL | let a; - | ^ - | -help: consider giving `a` an explicit type - | -LL | let a: /* Type */; - | ++++++++++++ - -error: aborting due to 2 previous errors - -Some errors have detailed explanations: E0277, E0282. -For more information about an error, try `rustc --explain E0277`. diff --git a/tests/ui/async-await/async-error-span.no_drop_tracking.stderr b/tests/ui/async-await/async-error-span.no_drop_tracking.stderr deleted file mode 100644 index 99a674a26..000000000 --- a/tests/ui/async-await/async-error-span.no_drop_tracking.stderr +++ /dev/null @@ -1,25 +0,0 @@ -error[E0277]: `()` is not a future - --> $DIR/async-error-span.rs:10:20 - | -LL | fn get_future() -> impl Future<Output = ()> { - | ^^^^^^^^^^^^^^^^^^^^^^^^ `()` is not a future - | - = help: the trait `Future` is not implemented for `()` - = note: () must be a future or must implement `IntoFuture` to be awaited - -error[E0698]: type inside `async fn` body must be known in this context - --> $DIR/async-error-span.rs:16:9 - | -LL | let a; - | ^ cannot infer type - | -note: the type is part of the `async fn` body because of this `await` - --> $DIR/async-error-span.rs:19:18 - | -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`. diff --git a/tests/ui/async-await/async-error-span.rs b/tests/ui/async-await/async-error-span.rs index c9ecf359e..c8127df62 100644 --- a/tests/ui/async-await/async-error-span.rs +++ b/tests/ui/async-await/async-error-span.rs @@ -1,6 +1,3 @@ -// 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. @@ -13,9 +10,7 @@ fn get_future() -> impl Future<Output = ()> { } async fn foo() { - let a; - //[no_drop_tracking,drop_tracking]~^ ERROR type inside `async fn` body must be known in this context - //[drop_tracking_mir]~^^ ERROR type annotations needed + let a; //~ ERROR type annotations needed get_future().await; } diff --git a/tests/ui/async-await/async-error-span.stderr b/tests/ui/async-await/async-error-span.stderr new file mode 100644 index 000000000..2ec968ffc --- /dev/null +++ b/tests/ui/async-await/async-error-span.stderr @@ -0,0 +1,24 @@ +error[E0277]: `()` is not a future + --> $DIR/async-error-span.rs:7: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[E0282]: type annotations needed + --> $DIR/async-error-span.rs:13:9 + | +LL | let a; + | ^ + | +help: consider giving `a` an explicit type + | +LL | let a: /* Type */; + | ++++++++++++ + +error: aborting due to 2 previous errors + +Some errors have detailed explanations: E0277, E0282. +For more information about an error, try `rustc --explain E0277`. diff --git a/tests/ui/async-await/async-fn-nonsend.drop_tracking.stderr b/tests/ui/async-await/async-fn-nonsend.drop_tracking.stderr deleted file mode 100644 index 0515edaed..000000000 --- a/tests/ui/async-await/async-fn-nonsend.drop_tracking.stderr +++ /dev/null @@ -1,49 +0,0 @@ -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:26 - | -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:15 - | -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 - diff --git a/tests/ui/async-await/async-fn-nonsend.drop_tracking_mir.stderr b/tests/ui/async-await/async-fn-nonsend.drop_tracking_mir.stderr deleted file mode 100644 index 219945e09..000000000 --- a/tests/ui/async-await/async-fn-nonsend.drop_tracking_mir.stderr +++ /dev/null @@ -1,43 +0,0 @@ -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:26 - | -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 -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:15 - | -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 -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 - diff --git a/tests/ui/async-await/async-fn-nonsend.no_drop_tracking.stderr b/tests/ui/async-await/async-fn-nonsend.no_drop_tracking.stderr deleted file mode 100644 index b29d2e192..000000000 --- a/tests/ui/async-await/async-fn-nonsend.no_drop_tracking.stderr +++ /dev/null @@ -1,120 +0,0 @@ -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:11 - | -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:26 - | -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:15 - | -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:15 - | -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:15 - | -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 - diff --git a/tests/ui/async-await/async-fn-nonsend.rs b/tests/ui/async-await/async-fn-nonsend.rs index ed440bd01..c5453b67e 100644 --- a/tests/ui/async-await/async-fn-nonsend.rs +++ b/tests/ui/async-await/async-fn-nonsend.rs @@ -1,6 +1,3 @@ -// 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 @@ -68,13 +65,10 @@ fn assert_send(_: impl Send) {} pub fn pass_assert() { assert_send(local_dropped_before_await()); - //[no_drop_tracking]~^ ERROR future cannot be sent between threads safely assert_send(non_send_temporary_in_match()); //~^ ERROR future cannot be sent between threads safely assert_send(non_sync_with_method_call()); //~^ ERROR future cannot be sent between threads safely assert_send(non_sync_with_method_call_panic()); - //[no_drop_tracking]~^ ERROR future cannot be sent between threads safely assert_send(non_sync_with_method_call_infinite_loop()); - //[no_drop_tracking]~^ ERROR future cannot be sent between threads safely } diff --git a/tests/ui/async-await/async-fn-nonsend.stderr b/tests/ui/async-await/async-fn-nonsend.stderr new file mode 100644 index 000000000..0ced6c36f --- /dev/null +++ b/tests/ui/async-await/async-fn-nonsend.stderr @@ -0,0 +1,43 @@ +error: future cannot be sent between threads safely + --> $DIR/async-fn-nonsend.rs:68: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:26 + | +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 +note: required by a bound in `assert_send` + --> $DIR/async-fn-nonsend.rs:64: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 + | +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:15 + | +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 +note: required by a bound in `assert_send` + --> $DIR/async-fn-nonsend.rs:64:24 + | +LL | fn assert_send(_: impl Send) {} + | ^^^^ required by this bound in `assert_send` + +error: aborting due to 2 previous errors + diff --git a/tests/ui/async-await/async-is-unwindsafe.stderr b/tests/ui/async-await/async-is-unwindsafe.stderr index 5d29325c8..eaa455380 100644 --- a/tests/ui/async-await/async-is-unwindsafe.stderr +++ b/tests/ui/async-await/async-is-unwindsafe.stderr @@ -1,21 +1,20 @@ error[E0277]: the type `&mut Context<'_>` may not be safely transferred across an unwind boundary - --> $DIR/async-is-unwindsafe.rs:12:19 + --> $DIR/async-is-unwindsafe.rs:12:5 | LL | is_unwindsafe(async { - | ___________________^ + | _____^^^^^^^^^^^^^_- + | | | + | | `&mut Context<'_>` may not be safely transferred across an unwind boundary LL | | LL | | use std::ptr::null; LL | | use std::task::{Context, RawWaker, RawWakerVTable, Waker}; ... | LL | | drop(cx_ref); LL | | }); - | | ^ - | | | - | |_____`&mut Context<'_>` may not be safely transferred across an unwind boundary - | within this `[async block@$DIR/async-is-unwindsafe.rs:12:19: 29:6]` + | |_____- within this `{async block@$DIR/async-is-unwindsafe.rs:12:19: 29:6}` | - = help: within `[async block@$DIR/async-is-unwindsafe.rs:12:19: 29:6]`, the trait `UnwindSafe` is not implemented for `&mut Context<'_>` - = note: `UnwindSafe` is implemented for `&std::task::Context<'_>`, but not for `&mut std::task::Context<'_>` + = help: within `{async block@$DIR/async-is-unwindsafe.rs:12:19: 29:6}`, the trait `UnwindSafe` is not implemented for `&mut Context<'_>` + = note: `UnwindSafe` is implemented for `&Context<'_>`, but not for `&mut Context<'_>` note: future does not implement `UnwindSafe` as this value is used across an await --> $DIR/async-is-unwindsafe.rs:25:18 | @@ -24,9 +23,6 @@ LL | let cx_ref = &mut cx; LL | LL | async {}.await; // this needs an inner await point | ^^^^^ await occurs here, with `cx_ref` maybe used later -... -LL | }); - | - `cx_ref` is later dropped here note: required by a bound in `is_unwindsafe` --> $DIR/async-is-unwindsafe.rs:3:26 | diff --git a/tests/ui/async-await/await-sequence.rs b/tests/ui/async-await/await-sequence.rs index 726c4284e..79f68dd60 100644 --- a/tests/ui/async-await/await-sequence.rs +++ b/tests/ui/async-await/await-sequence.rs @@ -1,5 +1,4 @@ // edition:2021 -// compile-flags: -Z drop-tracking // build-pass use std::collections::HashMap; diff --git a/tests/ui/async-await/awaiting-unsized-param.rs b/tests/ui/async-await/awaiting-unsized-param.rs new file mode 100644 index 000000000..e8b18bf37 --- /dev/null +++ b/tests/ui/async-await/awaiting-unsized-param.rs @@ -0,0 +1,13 @@ +// edition: 2021 + +#![feature(unsized_fn_params, unsized_locals)] +//~^ WARN the feature `unsized_locals` is incomplete + +use std::future::Future; + +async fn bug<T>(mut f: dyn Future<Output = T> + Unpin) -> T { + //~^ ERROR the size for values of type `(dyn Future<Output = T> + Unpin + 'static)` cannot be known at compilation time + (&mut f).await +} + +fn main() {} diff --git a/tests/ui/async-await/awaiting-unsized-param.stderr b/tests/ui/async-await/awaiting-unsized-param.stderr new file mode 100644 index 000000000..47a5dcebf --- /dev/null +++ b/tests/ui/async-await/awaiting-unsized-param.stderr @@ -0,0 +1,21 @@ +warning: the feature `unsized_locals` is incomplete and may not be safe to use and/or cause compiler crashes + --> $DIR/awaiting-unsized-param.rs:3:31 + | +LL | #![feature(unsized_fn_params, unsized_locals)] + | ^^^^^^^^^^^^^^ + | + = note: see issue #48055 <https://github.com/rust-lang/rust/issues/48055> for more information + = note: `#[warn(incomplete_features)]` on by default + +error[E0277]: the size for values of type `(dyn Future<Output = T> + Unpin + 'static)` cannot be known at compilation time + --> $DIR/awaiting-unsized-param.rs:8:17 + | +LL | async fn bug<T>(mut f: dyn Future<Output = T> + Unpin) -> T { + | ^^^^^ doesn't have a size known at compile-time + | + = help: the trait `Sized` is not implemented for `(dyn Future<Output = T> + Unpin + 'static)` + = note: all values captured by value by a closure must have a statically known size + +error: aborting due to previous error; 1 warning emitted + +For more information about this error, try `rustc --explain E0277`. diff --git a/tests/ui/async-await/const-async-fn-in-main.rs b/tests/ui/async-await/const-async-fn-in-main.rs new file mode 100644 index 000000000..5d1aa4d83 --- /dev/null +++ b/tests/ui/async-await/const-async-fn-in-main.rs @@ -0,0 +1,7 @@ +// edition:2021 +// Check what happens when a const async fn is in the main function (#102796) + +fn main() { + const async fn a() {} +//~^ ERROR functions cannot be both `const` and `async` +} diff --git a/tests/ui/async-await/const-async-fn-in-main.stderr b/tests/ui/async-await/const-async-fn-in-main.stderr new file mode 100644 index 000000000..10b151709 --- /dev/null +++ b/tests/ui/async-await/const-async-fn-in-main.stderr @@ -0,0 +1,11 @@ +error: functions cannot be both `const` and `async` + --> $DIR/const-async-fn-in-main.rs:5:5 + | +LL | const async fn a() {} + | ^^^^^-^^^^^---------- + | | | + | | `async` because of this + | `const` because of this + +error: aborting due to previous error + diff --git a/tests/ui/async-await/default-struct-update.rs b/tests/ui/async-await/default-struct-update.rs index daee8469a..f4757e7cb 100644 --- a/tests/ui/async-await/default-struct-update.rs +++ b/tests/ui/async-await/default-struct-update.rs @@ -1,6 +1,3 @@ -// 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 diff --git a/tests/ui/async-await/drop-and-assign.rs b/tests/ui/async-await/drop-and-assign.rs index e520dfbdc..ef39033a9 100644 --- a/tests/ui/async-await/drop-and-assign.rs +++ b/tests/ui/async-await/drop-and-assign.rs @@ -1,6 +1,3 @@ -// 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 diff --git a/tests/ui/async-await/drop-track-bad-field-in-fru.rs b/tests/ui/async-await/drop-track-bad-field-in-fru.rs index 28ad77675..667b288e6 100644 --- a/tests/ui/async-await/drop-track-bad-field-in-fru.rs +++ b/tests/ui/async-await/drop-track-bad-field-in-fru.rs @@ -1,4 +1,3 @@ -// compile-flags: -Zdrop-tracking // edition: 2021 fn main() {} diff --git a/tests/ui/async-await/drop-track-bad-field-in-fru.stderr b/tests/ui/async-await/drop-track-bad-field-in-fru.stderr index b49b15db6..721e01062 100644 --- a/tests/ui/async-await/drop-track-bad-field-in-fru.stderr +++ b/tests/ui/async-await/drop-track-bad-field-in-fru.stderr @@ -1,5 +1,5 @@ error[E0559]: variant `Option<_>::None` has no field named `value` - --> $DIR/drop-track-bad-field-in-fru.rs:7:12 + --> $DIR/drop-track-bad-field-in-fru.rs:6:12 | LL | None { value: (), ..Default::default() }.await; | ^^^^^ `Option<_>::None` does not have this field @@ -7,7 +7,7 @@ LL | None { value: (), ..Default::default() }.await; = note: all struct fields are already assigned error[E0277]: `Option<_>` is not a future - --> $DIR/drop-track-bad-field-in-fru.rs:7:46 + --> $DIR/drop-track-bad-field-in-fru.rs:6:46 | LL | None { value: (), ..Default::default() }.await; | -^^^^^ diff --git a/tests/ui/async-await/drop-track-field-assign-nonsend.drop_tracking.stderr b/tests/ui/async-await/drop-track-field-assign-nonsend.drop_tracking.stderr deleted file mode 100644 index 80402d842..000000000 --- a/tests/ui/async-await/drop-track-field-assign-nonsend.drop_tracking.stderr +++ /dev/null @@ -1,25 +0,0 @@ -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:39 - | -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 - diff --git a/tests/ui/async-await/drop-track-field-assign-nonsend.drop_tracking_mir.stderr b/tests/ui/async-await/drop-track-field-assign-nonsend.drop_tracking_mir.stderr deleted file mode 100644 index d9141cf4e..000000000 --- a/tests/ui/async-await/drop-track-field-assign-nonsend.drop_tracking_mir.stderr +++ /dev/null @@ -1,23 +0,0 @@ -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:39 - | -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 -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 - diff --git a/tests/ui/async-await/drop-track-field-assign-nonsend.no_drop_tracking.stderr b/tests/ui/async-await/drop-track-field-assign-nonsend.no_drop_tracking.stderr deleted file mode 100644 index 80402d842..000000000 --- a/tests/ui/async-await/drop-track-field-assign-nonsend.no_drop_tracking.stderr +++ /dev/null @@ -1,25 +0,0 @@ -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:39 - | -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 - diff --git a/tests/ui/async-await/drop-track-field-assign-nonsend.rs b/tests/ui/async-await/drop-track-field-assign-nonsend.rs index 3e2228000..19315ef19 100644 --- a/tests/ui/async-await/drop-track-field-assign-nonsend.rs +++ b/tests/ui/async-await/drop-track-field-assign-nonsend.rs @@ -1,6 +1,3 @@ -// 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 diff --git a/tests/ui/async-await/drop-track-field-assign-nonsend.stderr b/tests/ui/async-await/drop-track-field-assign-nonsend.stderr new file mode 100644 index 000000000..6c235916d --- /dev/null +++ b/tests/ui/async-await/drop-track-field-assign-nonsend.stderr @@ -0,0 +1,23 @@ +error: future cannot be sent between threads safely + --> $DIR/drop-track-field-assign-nonsend.rs:42: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:20:39 + | +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 +note: required by a bound in `assert_send` + --> $DIR/drop-track-field-assign-nonsend.rs:37:19 + | +LL | fn assert_send<T: Send>(_: T) {} + | ^^^^ required by this bound in `assert_send` + +error: aborting due to previous error + diff --git a/tests/ui/async-await/drop-track-field-assign.rs b/tests/ui/async-await/drop-track-field-assign.rs index b79d2af06..4887eff7e 100644 --- a/tests/ui/async-await/drop-track-field-assign.rs +++ b/tests/ui/async-await/drop-track-field-assign.rs @@ -1,6 +1,3 @@ -// 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 diff --git a/tests/ui/async-await/drop-tracking-unresolved-typeck-results.rs b/tests/ui/async-await/drop-tracking-unresolved-typeck-results.rs index 7f7294295..9f80b9c6e 100644 --- a/tests/ui/async-await/drop-tracking-unresolved-typeck-results.rs +++ b/tests/ui/async-await/drop-tracking-unresolved-typeck-results.rs @@ -1,4 +1,3 @@ -// compile-flags: -Zdrop-tracking // incremental // edition: 2021 @@ -99,8 +98,6 @@ fn main() { send(async { //~^ ERROR implementation of `FnOnce` is not general enough //~| ERROR implementation of `FnOnce` is not general enough - //~| ERROR implementation of `FnOnce` is not general enough - //~| ERROR implementation of `FnOnce` is not general enough Next(&Buffered(Map(Empty(PhantomData), ready::<&()>), FuturesOrdered(PhantomData), 0)).await }); } diff --git a/tests/ui/async-await/drop-tracking-unresolved-typeck-results.stderr b/tests/ui/async-await/drop-tracking-unresolved-typeck-results.stderr index aa9a22e9e..cfb0ebe38 100644 --- a/tests/ui/async-await/drop-tracking-unresolved-typeck-results.stderr +++ b/tests/ui/async-await/drop-tracking-unresolved-typeck-results.stderr @@ -1,26 +1,9 @@ error: implementation of `FnOnce` is not general enough - --> $DIR/drop-tracking-unresolved-typeck-results.rs:99:5 + --> $DIR/drop-tracking-unresolved-typeck-results.rs:98:5 | LL | / send(async { LL | | LL | | -LL | | -LL | | -LL | | Next(&Buffered(Map(Empty(PhantomData), ready::<&()>), FuturesOrdered(PhantomData), 0)).await -LL | | }); - | |______^ implementation of `FnOnce` is not general enough - | - = note: `fn(&'0 ()) -> std::future::Ready<&'0 ()> {std::future::ready::<&'0 ()>}` must implement `FnOnce<(&'1 (),)>`, for any two lifetimes `'0` and `'1`... - = note: ...but it actually implements `FnOnce<(&(),)>` - -error: implementation of `FnOnce` is not general enough - --> $DIR/drop-tracking-unresolved-typeck-results.rs:99:5 - | -LL | / send(async { -LL | | -LL | | -LL | | -LL | | LL | | Next(&Buffered(Map(Empty(PhantomData), ready::<&()>), FuturesOrdered(PhantomData), 0)).await LL | | }); | |______^ implementation of `FnOnce` is not general enough @@ -29,28 +12,11 @@ LL | | }); = note: ...but it actually implements `FnOnce<(&(),)>` error: implementation of `FnOnce` is not general enough - --> $DIR/drop-tracking-unresolved-typeck-results.rs:99:5 + --> $DIR/drop-tracking-unresolved-typeck-results.rs:98:5 | LL | / send(async { LL | | LL | | -LL | | -LL | | -LL | | Next(&Buffered(Map(Empty(PhantomData), ready::<&()>), FuturesOrdered(PhantomData), 0)).await -LL | | }); - | |______^ implementation of `FnOnce` is not general enough - | - = note: `fn(&'0 ()) -> std::future::Ready<&'0 ()> {std::future::ready::<&'0 ()>}` must implement `FnOnce<(&'1 (),)>`, for any two lifetimes `'0` and `'1`... - = note: ...but it actually implements `FnOnce<(&(),)>` - -error: implementation of `FnOnce` is not general enough - --> $DIR/drop-tracking-unresolved-typeck-results.rs:99:5 - | -LL | / send(async { -LL | | -LL | | -LL | | -LL | | LL | | Next(&Buffered(Map(Empty(PhantomData), ready::<&()>), FuturesOrdered(PhantomData), 0)).await LL | | }); | |______^ implementation of `FnOnce` is not general enough @@ -58,5 +24,5 @@ LL | | }); = note: `fn(&'0 ()) -> std::future::Ready<&'0 ()> {std::future::ready::<&'0 ()>}` must implement `FnOnce<(&'1 (),)>`, for any two lifetimes `'0` and `'1`... = note: ...but it actually implements `FnOnce<(&(),)>` -error: aborting due to 4 previous errors +error: aborting due to 2 previous errors diff --git a/tests/ui/async-await/feature-self-return-type.rs b/tests/ui/async-await/feature-self-return-type.rs index 41f887430..ae6f766d2 100644 --- a/tests/ui/async-await/feature-self-return-type.rs +++ b/tests/ui/async-await/feature-self-return-type.rs @@ -1,5 +1,4 @@ // edition:2018 -#![feature(impl_trait_projections)] // This test checks that we emit the correct borrowck error when `Self` is used as a return type. // See #61949 for context. diff --git a/tests/ui/async-await/feature-self-return-type.stderr b/tests/ui/async-await/feature-self-return-type.stderr index 747c54b66..dc160bfbf 100644 --- a/tests/ui/async-await/feature-self-return-type.stderr +++ b/tests/ui/async-await/feature-self-return-type.stderr @@ -1,5 +1,5 @@ error[E0597]: `bar` does not live long enough - --> $DIR/feature-self-return-type.rs:22:18 + --> $DIR/feature-self-return-type.rs:21:18 | LL | let x = { | - borrow later stored here diff --git a/tests/ui/async-await/field-assign-nonsend.drop_tracking.stderr b/tests/ui/async-await/field-assign-nonsend.drop_tracking.stderr deleted file mode 100644 index e2e64c9ae..000000000 --- a/tests/ui/async-await/field-assign-nonsend.drop_tracking.stderr +++ /dev/null @@ -1,25 +0,0 @@ -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:39 - | -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 - diff --git a/tests/ui/async-await/field-assign-nonsend.drop_tracking_mir.stderr b/tests/ui/async-await/field-assign-nonsend.drop_tracking_mir.stderr deleted file mode 100644 index d1df8e91a..000000000 --- a/tests/ui/async-await/field-assign-nonsend.drop_tracking_mir.stderr +++ /dev/null @@ -1,23 +0,0 @@ -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:39 - | -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 -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 - diff --git a/tests/ui/async-await/field-assign-nonsend.no_drop_tracking.stderr b/tests/ui/async-await/field-assign-nonsend.no_drop_tracking.stderr deleted file mode 100644 index e2e64c9ae..000000000 --- a/tests/ui/async-await/field-assign-nonsend.no_drop_tracking.stderr +++ /dev/null @@ -1,25 +0,0 @@ -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:39 - | -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 - diff --git a/tests/ui/async-await/field-assign-nonsend.rs b/tests/ui/async-await/field-assign-nonsend.rs index 3e2228000..19315ef19 100644 --- a/tests/ui/async-await/field-assign-nonsend.rs +++ b/tests/ui/async-await/field-assign-nonsend.rs @@ -1,6 +1,3 @@ -// 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 diff --git a/tests/ui/async-await/field-assign-nonsend.stderr b/tests/ui/async-await/field-assign-nonsend.stderr new file mode 100644 index 000000000..3037d7024 --- /dev/null +++ b/tests/ui/async-await/field-assign-nonsend.stderr @@ -0,0 +1,23 @@ +error: future cannot be sent between threads safely + --> $DIR/field-assign-nonsend.rs:42: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:20:39 + | +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 +note: required by a bound in `assert_send` + --> $DIR/field-assign-nonsend.rs:37:19 + | +LL | fn assert_send<T: Send>(_: T) {} + | ^^^^ required by this bound in `assert_send` + +error: aborting due to previous error + diff --git a/tests/ui/async-await/field-assign.rs b/tests/ui/async-await/field-assign.rs index b79d2af06..4887eff7e 100644 --- a/tests/ui/async-await/field-assign.rs +++ b/tests/ui/async-await/field-assign.rs @@ -1,6 +1,3 @@ -// 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 diff --git a/tests/ui/async-await/future-contains-err-issue-115188.rs b/tests/ui/async-await/future-contains-err-issue-115188.rs new file mode 100644 index 000000000..bf643c926 --- /dev/null +++ b/tests/ui/async-await/future-contains-err-issue-115188.rs @@ -0,0 +1,17 @@ +// edition: 2021 + +// Makes sure we don't spew a bunch of unrelated opaque errors when the reason +// for this error is just a missing struct field in `foo`. + +async fn foo() { + let y = Wrapper { }; + //~^ ERROR missing field `t` in initializer of `Wrapper<_>` +} + +struct Wrapper<T> { t: T } + +fn is_send<T: Send>(_: T) {} + +fn main() { + is_send(foo()); +} diff --git a/tests/ui/async-await/future-contains-err-issue-115188.stderr b/tests/ui/async-await/future-contains-err-issue-115188.stderr new file mode 100644 index 000000000..8fd2550c1 --- /dev/null +++ b/tests/ui/async-await/future-contains-err-issue-115188.stderr @@ -0,0 +1,9 @@ +error[E0063]: missing field `t` in initializer of `Wrapper<_>` + --> $DIR/future-contains-err-issue-115188.rs:7:13 + | +LL | let y = Wrapper { }; + | ^^^^^^^ missing `t` + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0063`. diff --git a/tests/ui/async-await/future-sizes/async-awaiting-fut.stdout b/tests/ui/async-await/future-sizes/async-awaiting-fut.stdout index c0fbb0204..d63911b0d 100644 --- a/tests/ui/async-await/future-sizes/async-awaiting-fut.stdout +++ b/tests/ui/async-await/future-sizes/async-awaiting-fut.stdout @@ -1,11 +1,17 @@ -print-type-size type: `[async fn body@$DIR/async-awaiting-fut.rs:21:21: 24:2]`: 3078 bytes, alignment: 1 bytes +print-type-size type: `{async fn body@$DIR/async-awaiting-fut.rs:21:21: 24:2}`: 3078 bytes, alignment: 1 bytes print-type-size discriminant: 1 bytes print-type-size variant `Unresumed`: 0 bytes print-type-size variant `Suspend0`: 3077 bytes print-type-size local `.__awaitee`: 3077 bytes print-type-size variant `Returned`: 0 bytes print-type-size variant `Panicked`: 0 bytes -print-type-size type: `[async fn body@$DIR/async-awaiting-fut.rs:10:64: 19:2]`: 3077 bytes, alignment: 1 bytes +print-type-size type: `std::mem::ManuallyDrop<{async fn body@$DIR/async-awaiting-fut.rs:10:64: 19:2}>`: 3077 bytes, alignment: 1 bytes +print-type-size field `.value`: 3077 bytes +print-type-size type: `std::mem::MaybeUninit<{async fn body@$DIR/async-awaiting-fut.rs:10:64: 19:2}>`: 3077 bytes, alignment: 1 bytes +print-type-size variant `MaybeUninit`: 3077 bytes +print-type-size field `.uninit`: 0 bytes +print-type-size field `.value`: 3077 bytes +print-type-size type: `{async fn body@$DIR/async-awaiting-fut.rs:10:64: 19:2}`: 3077 bytes, alignment: 1 bytes print-type-size discriminant: 1 bytes print-type-size variant `Unresumed`: 1025 bytes print-type-size upvar `.fut`: 1025 bytes, offset: 0 bytes, alignment: 1 bytes @@ -30,13 +36,13 @@ print-type-size variant `Returned`: 1025 bytes print-type-size upvar `.fut`: 1025 bytes, offset: 0 bytes, alignment: 1 bytes print-type-size variant `Panicked`: 1025 bytes print-type-size upvar `.fut`: 1025 bytes, offset: 0 bytes, alignment: 1 bytes -print-type-size type: `std::mem::ManuallyDrop<[async fn body@$DIR/async-awaiting-fut.rs:10:64: 19:2]>`: 3077 bytes, alignment: 1 bytes -print-type-size field `.value`: 3077 bytes -print-type-size type: `std::mem::MaybeUninit<[async fn body@$DIR/async-awaiting-fut.rs:10:64: 19:2]>`: 3077 bytes, alignment: 1 bytes -print-type-size variant `MaybeUninit`: 3077 bytes +print-type-size type: `std::mem::ManuallyDrop<{async fn body@$DIR/async-awaiting-fut.rs:8:35: 8:37}>`: 1025 bytes, alignment: 1 bytes +print-type-size field `.value`: 1025 bytes +print-type-size type: `std::mem::MaybeUninit<{async fn body@$DIR/async-awaiting-fut.rs:8:35: 8:37}>`: 1025 bytes, alignment: 1 bytes +print-type-size variant `MaybeUninit`: 1025 bytes print-type-size field `.uninit`: 0 bytes -print-type-size field `.value`: 3077 bytes -print-type-size type: `[async fn body@$DIR/async-awaiting-fut.rs:8:35: 8:37]`: 1025 bytes, alignment: 1 bytes +print-type-size field `.value`: 1025 bytes +print-type-size type: `{async fn body@$DIR/async-awaiting-fut.rs:8:35: 8:37}`: 1025 bytes, alignment: 1 bytes print-type-size discriminant: 1 bytes print-type-size variant `Unresumed`: 1024 bytes print-type-size upvar `.arg`: 1024 bytes @@ -44,17 +50,6 @@ print-type-size variant `Returned`: 1024 bytes print-type-size upvar `.arg`: 1024 bytes print-type-size variant `Panicked`: 1024 bytes print-type-size upvar `.arg`: 1024 bytes -print-type-size type: `std::mem::ManuallyDrop<[async fn body@$DIR/async-awaiting-fut.rs:8:35: 8:37]>`: 1025 bytes, alignment: 1 bytes -print-type-size field `.value`: 1025 bytes -print-type-size type: `std::mem::MaybeUninit<[async fn body@$DIR/async-awaiting-fut.rs:8:35: 8:37]>`: 1025 bytes, alignment: 1 bytes -print-type-size variant `MaybeUninit`: 1025 bytes -print-type-size field `.uninit`: 0 bytes -print-type-size field `.value`: 1025 bytes -print-type-size type: `[async fn body@$DIR/async-awaiting-fut.rs:6:17: 6:19]`: 1 bytes, alignment: 1 bytes -print-type-size discriminant: 1 bytes -print-type-size variant `Unresumed`: 0 bytes -print-type-size variant `Returned`: 0 bytes -print-type-size variant `Panicked`: 0 bytes print-type-size type: `std::mem::ManuallyDrop<bool>`: 1 bytes, alignment: 1 bytes print-type-size field `.value`: 1 bytes print-type-size type: `std::mem::MaybeUninit<bool>`: 1 bytes, alignment: 1 bytes @@ -66,3 +61,8 @@ print-type-size discriminant: 1 bytes print-type-size variant `Ready`: 0 bytes print-type-size field `.0`: 0 bytes print-type-size variant `Pending`: 0 bytes +print-type-size type: `{async fn body@$DIR/async-awaiting-fut.rs:6:17: 6:19}`: 1 bytes, alignment: 1 bytes +print-type-size discriminant: 1 bytes +print-type-size variant `Unresumed`: 0 bytes +print-type-size variant `Returned`: 0 bytes +print-type-size variant `Panicked`: 0 bytes diff --git a/tests/ui/async-await/future-sizes/large-arg.stdout b/tests/ui/async-await/future-sizes/large-arg.stdout index b5e95ddd7..005460df6 100644 --- a/tests/ui/async-await/future-sizes/large-arg.stdout +++ b/tests/ui/async-await/future-sizes/large-arg.stdout @@ -1,55 +1,47 @@ -print-type-size type: `[async fn body@$DIR/large-arg.rs:6:21: 8:2]`: 3076 bytes, alignment: 1 bytes +print-type-size type: `{async fn body@$DIR/large-arg.rs:6:21: 8:2}`: 3076 bytes, alignment: 1 bytes print-type-size discriminant: 1 bytes print-type-size variant `Unresumed`: 0 bytes print-type-size variant `Suspend0`: 3075 bytes print-type-size local `.__awaitee`: 3075 bytes print-type-size variant `Returned`: 0 bytes print-type-size variant `Panicked`: 0 bytes -print-type-size type: `[async fn body@$DIR/large-arg.rs:10:30: 12:2]`: 3075 bytes, alignment: 1 bytes -print-type-size discriminant: 1 bytes -print-type-size variant `Unresumed`: 1024 bytes -print-type-size upvar `.t`: 1024 bytes -print-type-size variant `Suspend0`: 3074 bytes -print-type-size upvar `.t`: 1024 bytes -print-type-size local `.__awaitee`: 2050 bytes -print-type-size variant `Returned`: 1024 bytes -print-type-size upvar `.t`: 1024 bytes -print-type-size variant `Panicked`: 1024 bytes -print-type-size upvar `.t`: 1024 bytes -print-type-size type: `std::mem::ManuallyDrop<[async fn body@$DIR/large-arg.rs:10:30: 12:2]>`: 3075 bytes, alignment: 1 bytes +print-type-size type: `std::mem::ManuallyDrop<{async fn body@$DIR/large-arg.rs:10:30: 12:2}>`: 3075 bytes, alignment: 1 bytes print-type-size field `.value`: 3075 bytes -print-type-size type: `std::mem::MaybeUninit<[async fn body@$DIR/large-arg.rs:10:30: 12:2]>`: 3075 bytes, alignment: 1 bytes +print-type-size type: `std::mem::MaybeUninit<{async fn body@$DIR/large-arg.rs:10:30: 12:2}>`: 3075 bytes, alignment: 1 bytes print-type-size variant `MaybeUninit`: 3075 bytes print-type-size field `.uninit`: 0 bytes print-type-size field `.value`: 3075 bytes -print-type-size type: `[async fn body@$DIR/large-arg.rs:13:26: 15:2]`: 2050 bytes, alignment: 1 bytes +print-type-size type: `{async fn body@$DIR/large-arg.rs:10:30: 12:2}`: 3075 bytes, alignment: 1 bytes print-type-size discriminant: 1 bytes print-type-size variant `Unresumed`: 1024 bytes print-type-size upvar `.t`: 1024 bytes -print-type-size variant `Suspend0`: 2049 bytes +print-type-size variant `Suspend0`: 3074 bytes print-type-size upvar `.t`: 1024 bytes -print-type-size local `.__awaitee`: 1025 bytes +print-type-size local `.__awaitee`: 2050 bytes print-type-size variant `Returned`: 1024 bytes print-type-size upvar `.t`: 1024 bytes print-type-size variant `Panicked`: 1024 bytes print-type-size upvar `.t`: 1024 bytes -print-type-size type: `std::mem::ManuallyDrop<[async fn body@$DIR/large-arg.rs:13:26: 15:2]>`: 2050 bytes, alignment: 1 bytes +print-type-size type: `std::mem::ManuallyDrop<{async fn body@$DIR/large-arg.rs:13:26: 15:2}>`: 2050 bytes, alignment: 1 bytes print-type-size field `.value`: 2050 bytes -print-type-size type: `std::mem::MaybeUninit<[async fn body@$DIR/large-arg.rs:13:26: 15:2]>`: 2050 bytes, alignment: 1 bytes +print-type-size type: `std::mem::MaybeUninit<{async fn body@$DIR/large-arg.rs:13:26: 15:2}>`: 2050 bytes, alignment: 1 bytes print-type-size variant `MaybeUninit`: 2050 bytes print-type-size field `.uninit`: 0 bytes print-type-size field `.value`: 2050 bytes -print-type-size type: `[async fn body@$DIR/large-arg.rs:16:26: 18:2]`: 1025 bytes, alignment: 1 bytes +print-type-size type: `{async fn body@$DIR/large-arg.rs:13:26: 15:2}`: 2050 bytes, alignment: 1 bytes print-type-size discriminant: 1 bytes print-type-size variant `Unresumed`: 1024 bytes print-type-size upvar `.t`: 1024 bytes +print-type-size variant `Suspend0`: 2049 bytes +print-type-size upvar `.t`: 1024 bytes +print-type-size local `.__awaitee`: 1025 bytes print-type-size variant `Returned`: 1024 bytes print-type-size upvar `.t`: 1024 bytes print-type-size variant `Panicked`: 1024 bytes print-type-size upvar `.t`: 1024 bytes -print-type-size type: `std::mem::ManuallyDrop<[async fn body@$DIR/large-arg.rs:16:26: 18:2]>`: 1025 bytes, alignment: 1 bytes +print-type-size type: `std::mem::ManuallyDrop<{async fn body@$DIR/large-arg.rs:16:26: 18:2}>`: 1025 bytes, alignment: 1 bytes print-type-size field `.value`: 1025 bytes -print-type-size type: `std::mem::MaybeUninit<[async fn body@$DIR/large-arg.rs:16:26: 18:2]>`: 1025 bytes, alignment: 1 bytes +print-type-size type: `std::mem::MaybeUninit<{async fn body@$DIR/large-arg.rs:16:26: 18:2}>`: 1025 bytes, alignment: 1 bytes print-type-size variant `MaybeUninit`: 1025 bytes print-type-size field `.uninit`: 0 bytes print-type-size field `.value`: 1025 bytes @@ -58,3 +50,11 @@ print-type-size discriminant: 1 bytes print-type-size variant `Ready`: 1024 bytes print-type-size field `.0`: 1024 bytes print-type-size variant `Pending`: 0 bytes +print-type-size type: `{async fn body@$DIR/large-arg.rs:16:26: 18:2}`: 1025 bytes, alignment: 1 bytes +print-type-size discriminant: 1 bytes +print-type-size variant `Unresumed`: 1024 bytes +print-type-size upvar `.t`: 1024 bytes +print-type-size variant `Returned`: 1024 bytes +print-type-size upvar `.t`: 1024 bytes +print-type-size variant `Panicked`: 1024 bytes +print-type-size upvar `.t`: 1024 bytes diff --git a/tests/ui/async-await/generator-desc.stderr b/tests/ui/async-await/generator-desc.stderr index 042766f19..d3e951cfe 100644 --- a/tests/ui/async-await/generator-desc.stderr +++ b/tests/ui/async-await/generator-desc.stderr @@ -7,8 +7,8 @@ LL | fun(async {}, async {}); | | the expected `async` block | arguments to this function are incorrect | - = note: expected `async` block `[async block@$DIR/generator-desc.rs:10:9: 10:17]` - found `async` block `[async block@$DIR/generator-desc.rs:10:19: 10:27]` + = note: expected `async` block `{async block@$DIR/generator-desc.rs:10:9: 10:17}` + found `async` block `{async block@$DIR/generator-desc.rs:10:19: 10:27}` note: function defined here --> $DIR/generator-desc.rs:8:4 | @@ -40,8 +40,8 @@ LL | fun((async || {})(), (async || {})()); | | the expected `async` closure body | arguments to this function are incorrect | - = note: expected `async` closure body `[async closure body@$DIR/generator-desc.rs:14:19: 14:21]` - found `async` closure body `[async closure body@$DIR/generator-desc.rs:14:36: 14:38]` + = note: expected `async` closure body `{async closure body@$DIR/generator-desc.rs:14:19: 14:21}` + found `async` closure body `{async closure body@$DIR/generator-desc.rs:14:36: 14:38}` note: function defined here --> $DIR/generator-desc.rs:8:4 | diff --git a/tests/ui/async-await/generator-not-future.stderr b/tests/ui/async-await/generator-not-future.stderr index 1b81b461f..540501b98 100644 --- a/tests/ui/async-await/generator-not-future.stderr +++ b/tests/ui/async-await/generator-not-future.stderr @@ -26,11 +26,11 @@ note: required by a bound in `takes_generator` LL | fn takes_generator<ResumeTy>(_g: impl Generator<ResumeTy, Yield = (), Return = ()>) {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `takes_generator` -error[E0277]: the trait bound `[async block@$DIR/generator-not-future.rs:35:21: 35:29]: Generator<_>` is not satisfied +error[E0277]: the trait bound `{async block@$DIR/generator-not-future.rs:35:21: 35:29}: Generator<_>` is not satisfied --> $DIR/generator-not-future.rs:35:21 | LL | takes_generator(async {}); - | --------------- ^^^^^^^^ the trait `Generator<_>` is not implemented for `[async block@$DIR/generator-not-future.rs:35:21: 35:29]` + | --------------- ^^^^^^^^ the trait `Generator<_>` is not implemented for `{async block@$DIR/generator-not-future.rs:35:21: 35:29}` | | | required by a bound introduced by this call | @@ -56,7 +56,7 @@ note: required by a bound in `takes_future` LL | fn takes_future(_f: impl Future<Output = ()>) {} | ^^^^^^^^^^^^^^^^^^^ required by this bound in `takes_future` -error[E0277]: `[generator@$DIR/generator-not-future.rs:41:18: 41:23]` is not a future +error[E0277]: `{generator@$DIR/generator-not-future.rs:41:18: 41:23}` is not a future --> $DIR/generator-not-future.rs:41:18 | LL | takes_future(|ctx| { @@ -66,10 +66,10 @@ LL | takes_future(|ctx| { LL | | LL | | ctx = yield (); LL | | }); - | |_____^ `[generator@$DIR/generator-not-future.rs:41:18: 41:23]` is not a future + | |_____^ `{generator@$DIR/generator-not-future.rs:41:18: 41:23}` is not a future | - = help: the trait `Future` is not implemented for `[generator@$DIR/generator-not-future.rs:41:18: 41:23]` - = note: [generator@$DIR/generator-not-future.rs:41:18: 41:23] must be a future or must implement `IntoFuture` to be awaited + = help: the trait `Future` is not implemented for `{generator@$DIR/generator-not-future.rs:41:18: 41:23}` + = note: {generator@$DIR/generator-not-future.rs:41:18: 41:23} must be a future or must implement `IntoFuture` to be awaited note: required by a bound in `takes_future` --> $DIR/generator-not-future.rs:17:26 | diff --git a/tests/ui/async-await/in-trait/async-associated-types.rs b/tests/ui/async-await/in-trait/async-associated-types.rs index 974f5aaff..3e2739a16 100644 --- a/tests/ui/async-await/in-trait/async-associated-types.rs +++ b/tests/ui/async-await/in-trait/async-associated-types.rs @@ -2,7 +2,6 @@ // edition: 2021 #![feature(async_fn_in_trait)] -#![feature(impl_trait_projections)] #![allow(incomplete_features)] use std::fmt::Debug; diff --git a/tests/ui/async-await/in-trait/async-example-desugared-extra.rs b/tests/ui/async-await/in-trait/async-example-desugared-extra.rs index 81e1e59a3..3505690f1 100644 --- a/tests/ui/async-await/in-trait/async-example-desugared-extra.rs +++ b/tests/ui/async-await/in-trait/async-example-desugared-extra.rs @@ -2,14 +2,14 @@ // edition: 2021 #![feature(async_fn_in_trait)] -#![feature(return_position_impl_trait_in_trait)] +#![feature(return_position_impl_trait_in_trait, lint_reasons)] #![allow(incomplete_features)] use std::future::Future; use std::pin::Pin; use std::task::Poll; -trait MyTrait { +pub trait MyTrait { async fn foo(&self) -> i32; } @@ -27,8 +27,7 @@ impl Future for MyFuture { } impl MyTrait for i32 { - // FIXME: this should eventually require `#[refine]` to compile, because it also provides - // `Clone`. + #[expect(refining_impl_trait)] fn foo(&self) -> impl Future<Output = i32> + Clone { MyFuture(*self) } diff --git a/tests/ui/async-await/in-trait/async-example-desugared.rs b/tests/ui/async-await/in-trait/async-example-desugared.rs index fb92ec786..0a5023176 100644 --- a/tests/ui/async-await/in-trait/async-example-desugared.rs +++ b/tests/ui/async-await/in-trait/async-example-desugared.rs @@ -12,7 +12,7 @@ trait MyTrait { } impl MyTrait for i32 { - fn foo(&self) -> impl Future<Output = i32> + '_ { + fn foo(&self) -> impl Future<Output = i32> { async { *self } } } diff --git a/tests/ui/async-await/in-trait/auxiliary/foreign-async-fn.rs b/tests/ui/async-await/in-trait/auxiliary/foreign-async-fn.rs new file mode 100644 index 000000000..bba886f17 --- /dev/null +++ b/tests/ui/async-await/in-trait/auxiliary/foreign-async-fn.rs @@ -0,0 +1,7 @@ +// edition:2021 + +#![feature(async_fn_in_trait)] + +pub trait Foo { + async fn test(); +} diff --git a/tests/ui/async-await/in-trait/indirect-recursion-issue-112047.rs b/tests/ui/async-await/in-trait/indirect-recursion-issue-112047.rs new file mode 100644 index 000000000..2fe6b473d --- /dev/null +++ b/tests/ui/async-await/in-trait/indirect-recursion-issue-112047.rs @@ -0,0 +1,38 @@ +// edition: 2021 +// build-fail +//~^^ ERROR cycle detected when computing layout of + +#![feature(async_fn_in_trait)] + +fn main() { + let _ = async { + A.first().await.second().await; + }; +} + +pub trait First { + type Second: Second; + async fn first(self) -> Self::Second; +} + +struct A; + +impl First for A { + type Second = A; + async fn first(self) -> Self::Second { + A + } +} + +pub trait Second { + async fn second(self); +} + +impl<C> Second for C +where + C: First, +{ + async fn second(self) { + self.first().await.second().await; + } +} diff --git a/tests/ui/async-await/in-trait/indirect-recursion-issue-112047.stderr b/tests/ui/async-await/in-trait/indirect-recursion-issue-112047.stderr new file mode 100644 index 000000000..41e84466a --- /dev/null +++ b/tests/ui/async-await/in-trait/indirect-recursion-issue-112047.stderr @@ -0,0 +1,10 @@ +error[E0391]: cycle detected when computing layout of `{async fn body@$DIR/indirect-recursion-issue-112047.rs:35:27: 37:6}` + | + = note: ...which requires computing layout of `<<A as First>::Second as Second>::{opaque#0}`... + = note: ...which again requires computing layout of `{async fn body@$DIR/indirect-recursion-issue-112047.rs:35:27: 37:6}`, completing the cycle + = note: cycle used when computing layout of `{async block@$DIR/indirect-recursion-issue-112047.rs:8:13: 10:6}` + = note: see https://rustc-dev-guide.rust-lang.org/overview.html#queries and https://rustc-dev-guide.rust-lang.org/query.html for more information + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0391`. diff --git a/tests/ui/async-await/in-trait/missing-send-bound.stderr b/tests/ui/async-await/in-trait/missing-send-bound.stderr index 18185b755..7e59d94d4 100644 --- a/tests/ui/async-await/in-trait/missing-send-bound.stderr +++ b/tests/ui/async-await/in-trait/missing-send-bound.stderr @@ -15,6 +15,11 @@ note: required by a bound in `assert_is_send` | LL | fn assert_is_send(_: impl Send) {} | ^^^^ required by this bound in `assert_is_send` +help: `Send` can be made part of the associated future's guarantees for all implementations of `Foo::bar` + | +LL - async fn bar(); +LL + fn bar() -> impl std::future::Future<Output = ()> + Send; + | error: aborting due to previous error diff --git a/tests/ui/async-await/in-trait/send-on-async-fn-in-trait.fixed b/tests/ui/async-await/in-trait/send-on-async-fn-in-trait.fixed new file mode 100644 index 000000000..33c005874 --- /dev/null +++ b/tests/ui/async-await/in-trait/send-on-async-fn-in-trait.fixed @@ -0,0 +1,20 @@ +// run-rustfix +// edition: 2021 + +#![feature(async_fn_in_trait, return_position_impl_trait_in_trait)] +#![allow(unused)] + +trait Foo { + fn test() -> impl std::future::Future<Output = ()> + Send { async {} } + fn test2() -> impl std::future::Future<Output = i32> + Send {async { 1 + 2 } } +} + +fn bar<T: Foo>() { + fn needs_send(_: impl Send) {} + needs_send(T::test()); + //~^ ERROR `impl Future<Output = ()>` cannot be sent between threads safely + needs_send(T::test2()); + //~^ ERROR `impl Future<Output = i32>` cannot be sent between threads safely +} + +fn main() {} diff --git a/tests/ui/async-await/in-trait/send-on-async-fn-in-trait.rs b/tests/ui/async-await/in-trait/send-on-async-fn-in-trait.rs new file mode 100644 index 000000000..96b623d69 --- /dev/null +++ b/tests/ui/async-await/in-trait/send-on-async-fn-in-trait.rs @@ -0,0 +1,20 @@ +// run-rustfix +// edition: 2021 + +#![feature(async_fn_in_trait, return_position_impl_trait_in_trait)] +#![allow(unused)] + +trait Foo { + async fn test() -> () {} + async fn test2() -> i32 { 1 + 2 } +} + +fn bar<T: Foo>() { + fn needs_send(_: impl Send) {} + needs_send(T::test()); + //~^ ERROR `impl Future<Output = ()>` cannot be sent between threads safely + needs_send(T::test2()); + //~^ ERROR `impl Future<Output = i32>` cannot be sent between threads safely +} + +fn main() {} diff --git a/tests/ui/async-await/in-trait/send-on-async-fn-in-trait.stderr b/tests/ui/async-await/in-trait/send-on-async-fn-in-trait.stderr new file mode 100644 index 000000000..4319a1411 --- /dev/null +++ b/tests/ui/async-await/in-trait/send-on-async-fn-in-trait.stderr @@ -0,0 +1,43 @@ +error[E0277]: `impl Future<Output = ()>` cannot be sent between threads safely + --> $DIR/send-on-async-fn-in-trait.rs:14:16 + | +LL | needs_send(T::test()); + | ---------- ^^^^^^^^^ `impl Future<Output = ()>` cannot be sent between threads safely + | | + | required by a bound introduced by this call + | + = help: the trait `Send` is not implemented for `impl Future<Output = ()>` +note: required by a bound in `needs_send` + --> $DIR/send-on-async-fn-in-trait.rs:13:27 + | +LL | fn needs_send(_: impl Send) {} + | ^^^^ required by this bound in `needs_send` +help: `Send` can be made part of the associated future's guarantees for all implementations of `Foo::test` + | +LL - async fn test() -> () {} +LL + fn test() -> impl std::future::Future<Output = ()> + Send { async {} } + | + +error[E0277]: `impl Future<Output = i32>` cannot be sent between threads safely + --> $DIR/send-on-async-fn-in-trait.rs:16:16 + | +LL | needs_send(T::test2()); + | ---------- ^^^^^^^^^^ `impl Future<Output = i32>` cannot be sent between threads safely + | | + | required by a bound introduced by this call + | + = help: the trait `Send` is not implemented for `impl Future<Output = i32>` +note: required by a bound in `needs_send` + --> $DIR/send-on-async-fn-in-trait.rs:13:27 + | +LL | fn needs_send(_: impl Send) {} + | ^^^^ required by this bound in `needs_send` +help: `Send` can be made part of the associated future's guarantees for all implementations of `Foo::test2` + | +LL - async fn test2() -> i32 { 1 + 2 } +LL + fn test2() -> impl std::future::Future<Output = i32> + Send {async { 1 + 2 } } + | + +error: aborting due to 2 previous errors + +For more information about this error, try `rustc --explain E0277`. diff --git a/tests/ui/async-await/in-trait/send-on-foreign-async-fn-in-trait.rs b/tests/ui/async-await/in-trait/send-on-foreign-async-fn-in-trait.rs new file mode 100644 index 000000000..83b69d72a --- /dev/null +++ b/tests/ui/async-await/in-trait/send-on-foreign-async-fn-in-trait.rs @@ -0,0 +1,15 @@ +// aux-build:foreign-async-fn.rs +// edition:2021 + +#![feature(async_fn_in_trait)] + +extern crate foreign_async_fn; +use foreign_async_fn::Foo; + +fn bar<T: Foo>() { + fn needs_send(_: impl Send) {} + needs_send(T::test()); + //~^ ERROR `impl Future<Output = ()>` cannot be sent between threads safely +} + +fn main() {} diff --git a/tests/ui/async-await/in-trait/send-on-foreign-async-fn-in-trait.stderr b/tests/ui/async-await/in-trait/send-on-foreign-async-fn-in-trait.stderr new file mode 100644 index 000000000..f337a04ba --- /dev/null +++ b/tests/ui/async-await/in-trait/send-on-foreign-async-fn-in-trait.stderr @@ -0,0 +1,23 @@ +error[E0277]: `impl Future<Output = ()>` cannot be sent between threads safely + --> $DIR/send-on-foreign-async-fn-in-trait.rs:11:16 + | +LL | needs_send(T::test()); + | ---------- ^^^^^^^^^ `impl Future<Output = ()>` cannot be sent between threads safely + | | + | required by a bound introduced by this call + | + = help: the trait `Send` is not implemented for `impl Future<Output = ()>` +note: `<T as Foo>::test` is an `async fn` in trait, which does not automatically imply that its future is `Send` + --> $DIR/auxiliary/foreign-async-fn.rs:6:5 + | +LL | async fn test(); + | ^^^^^^^^^^^^^^^^ +note: required by a bound in `needs_send` + --> $DIR/send-on-foreign-async-fn-in-trait.rs:10:27 + | +LL | fn needs_send(_: impl Send) {} + | ^^^^ required by this bound in `needs_send` + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0277`. diff --git a/tests/ui/async-await/issue-61949-self-return-type.rs b/tests/ui/async-await/issue-61949-self-return-type.rs deleted file mode 100644 index d73dbc6e8..000000000 --- a/tests/ui/async-await/issue-61949-self-return-type.rs +++ /dev/null @@ -1,28 +0,0 @@ -// edition:2018 -// gate-test-impl_trait_projections - -// This test checks that `Self` is prohibited as a return type. See #61949 for context. - -pub struct Foo<'a> { - pub bar: &'a i32, -} - -impl<'a> Foo<'a> { - pub async fn new(_bar: &'a i32) -> Self { - //~^ ERROR `async fn` return type cannot contain a projection or `Self` that references lifetimes from a parent scope - Foo { - bar: &22 - } - } -} - -async fn foo() { - let x = { - let bar = 22; - Foo::new(&bar).await - //~^ ERROR `bar` does not live long enough - }; - drop(x); -} - -fn main() { } diff --git a/tests/ui/async-await/issue-61949-self-return-type.stderr b/tests/ui/async-await/issue-61949-self-return-type.stderr deleted file mode 100644 index ac85ed288..000000000 --- a/tests/ui/async-await/issue-61949-self-return-type.stderr +++ /dev/null @@ -1,26 +0,0 @@ -error[E0658]: `async fn` return type cannot contain a projection or `Self` that references lifetimes from a parent scope - --> $DIR/issue-61949-self-return-type.rs:11:40 - | -LL | pub async fn new(_bar: &'a i32) -> Self { - | ^^^^ help: consider spelling out the type instead: `Foo<'a>` - | - = note: see issue #103532 <https://github.com/rust-lang/rust/issues/103532> for more information - = help: add `#![feature(impl_trait_projections)]` to the crate attributes to enable - -error[E0597]: `bar` does not live long enough - --> $DIR/issue-61949-self-return-type.rs:22:18 - | -LL | let x = { - | - borrow later stored here -LL | let bar = 22; - | --- binding `bar` declared here -LL | Foo::new(&bar).await - | ^^^^ borrowed value does not live long enough -LL | -LL | }; - | - `bar` dropped here while still borrowed - -error: aborting due to 2 previous errors - -Some errors have detailed explanations: E0597, E0658. -For more information about an error, try `rustc --explain E0597`. diff --git a/tests/ui/async-await/issue-64130-1-sync.drop_tracking.stderr b/tests/ui/async-await/issue-64130-1-sync.drop_tracking.stderr deleted file mode 100644 index 56aa035f4..000000000 --- a/tests/ui/async-await/issue-64130-1-sync.drop_tracking.stderr +++ /dev/null @@ -1,25 +0,0 @@ -error: future cannot be shared between threads safely - --> $DIR/issue-64130-1-sync.rs:25: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:11 - | -LL | let x = Foo; - | - has type `Foo` which is not `Sync` -LL | baz().await; - | ^^^^^ await occurs here, with `x` maybe used later -LL | drop(x); -LL | } - | - `x` is later dropped here -note: required by a bound in `is_sync` - --> $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 - diff --git a/tests/ui/async-await/issue-64130-1-sync.drop_tracking_mir.stderr b/tests/ui/async-await/issue-64130-1-sync.drop_tracking_mir.stderr deleted file mode 100644 index ea1bfb9f9..000000000 --- a/tests/ui/async-await/issue-64130-1-sync.drop_tracking_mir.stderr +++ /dev/null @@ -1,22 +0,0 @@ -error: future cannot be shared between threads safely - --> $DIR/issue-64130-1-sync.rs:25: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:11 - | -LL | let x = Foo; - | - has type `Foo` which is not `Sync` -LL | baz().await; - | ^^^^^ await occurs here, with `x` maybe used later -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 - diff --git a/tests/ui/async-await/issue-64130-1-sync.no_drop_tracking.stderr b/tests/ui/async-await/issue-64130-1-sync.no_drop_tracking.stderr deleted file mode 100644 index 56aa035f4..000000000 --- a/tests/ui/async-await/issue-64130-1-sync.no_drop_tracking.stderr +++ /dev/null @@ -1,25 +0,0 @@ -error: future cannot be shared between threads safely - --> $DIR/issue-64130-1-sync.rs:25: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:11 - | -LL | let x = Foo; - | - has type `Foo` which is not `Sync` -LL | baz().await; - | ^^^^^ await occurs here, with `x` maybe used later -LL | drop(x); -LL | } - | - `x` is later dropped here -note: required by a bound in `is_sync` - --> $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 - diff --git a/tests/ui/async-await/issue-64130-1-sync.rs b/tests/ui/async-await/issue-64130-1-sync.rs index 44646e0e5..7769085a0 100644 --- a/tests/ui/async-await/issue-64130-1-sync.rs +++ b/tests/ui/async-await/issue-64130-1-sync.rs @@ -1,6 +1,3 @@ -// 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 diff --git a/tests/ui/async-await/issue-64130-1-sync.stderr b/tests/ui/async-await/issue-64130-1-sync.stderr new file mode 100644 index 000000000..207e085d2 --- /dev/null +++ b/tests/ui/async-await/issue-64130-1-sync.stderr @@ -0,0 +1,22 @@ +error: future cannot be shared between threads safely + --> $DIR/issue-64130-1-sync.rs:22: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:11 + | +LL | let x = Foo; + | - has type `Foo` which is not `Sync` +LL | baz().await; + | ^^^^^ await occurs here, with `x` maybe used later +note: required by a bound in `is_sync` + --> $DIR/issue-64130-1-sync.rs:11:15 + | +LL | fn is_sync<T: Sync>(t: T) { } + | ^^^^ required by this bound in `is_sync` + +error: aborting due to previous error + diff --git a/tests/ui/async-await/issue-64130-2-send.drop_tracking.stderr b/tests/ui/async-await/issue-64130-2-send.drop_tracking.stderr deleted file mode 100644 index d1717ad33..000000000 --- a/tests/ui/async-await/issue-64130-2-send.drop_tracking.stderr +++ /dev/null @@ -1,28 +0,0 @@ -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` - | - = note: the trait bound `Unique<Foo>: Send` is not satisfied -note: future is not `Send` as this value is used across an await - --> $DIR/issue-64130-2-send.rs:18:11 - | -LL | let x = Box::new(Foo); - | - has type `Box<Foo>` which is not `Send` -LL | baz().await; - | ^^^^^ await occurs here, with `x` maybe used later -LL | } - | - `x` is later dropped here -note: required by a bound in `is_send` - --> $DIR/issue-64130-2-send.rs:14:15 - | -LL | fn is_send<T: Send>(t: T) { } - | ^^^^ required by this bound in `is_send` -help: consider borrowing here - | -LL | is_send(&bar()); - | + - -error: aborting due to previous error - diff --git a/tests/ui/async-await/issue-64130-2-send.drop_tracking_mir.stderr b/tests/ui/async-await/issue-64130-2-send.drop_tracking_mir.stderr deleted file mode 100644 index 45e43525a..000000000 --- a/tests/ui/async-await/issue-64130-2-send.drop_tracking_mir.stderr +++ /dev/null @@ -1,26 +0,0 @@ -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` - | - = note: the trait bound `Unique<Foo>: Send` is not satisfied -note: future is not `Send` as this value is used across an await - --> $DIR/issue-64130-2-send.rs:18:11 - | -LL | let x = Box::new(Foo); - | - has type `Box<Foo>` which is not `Send` -LL | baz().await; - | ^^^^^ await occurs here, with `x` maybe used later -note: required by a bound in `is_send` - --> $DIR/issue-64130-2-send.rs:14:15 - | -LL | fn is_send<T: Send>(t: T) { } - | ^^^^ required by this bound in `is_send` -help: consider borrowing here - | -LL | is_send(&bar()); - | + - -error: aborting due to previous error - diff --git a/tests/ui/async-await/issue-64130-2-send.no_drop_tracking.stderr b/tests/ui/async-await/issue-64130-2-send.no_drop_tracking.stderr deleted file mode 100644 index d1717ad33..000000000 --- a/tests/ui/async-await/issue-64130-2-send.no_drop_tracking.stderr +++ /dev/null @@ -1,28 +0,0 @@ -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` - | - = note: the trait bound `Unique<Foo>: Send` is not satisfied -note: future is not `Send` as this value is used across an await - --> $DIR/issue-64130-2-send.rs:18:11 - | -LL | let x = Box::new(Foo); - | - has type `Box<Foo>` which is not `Send` -LL | baz().await; - | ^^^^^ await occurs here, with `x` maybe used later -LL | } - | - `x` is later dropped here -note: required by a bound in `is_send` - --> $DIR/issue-64130-2-send.rs:14:15 - | -LL | fn is_send<T: Send>(t: T) { } - | ^^^^ required by this bound in `is_send` -help: consider borrowing here - | -LL | is_send(&bar()); - | + - -error: aborting due to previous error - diff --git a/tests/ui/async-await/issue-64130-2-send.rs b/tests/ui/async-await/issue-64130-2-send.rs index d6d855bac..0195afe6b 100644 --- a/tests/ui/async-await/issue-64130-2-send.rs +++ b/tests/ui/async-await/issue-64130-2-send.rs @@ -1,6 +1,3 @@ -// 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 @@ -14,8 +11,9 @@ impl !Send for Foo {} fn is_send<T: Send>(t: T) { } async fn bar() { - let x = Box::new(Foo); + let x = Foo; baz().await; + drop(x); } async fn baz() { } diff --git a/tests/ui/async-await/issue-64130-2-send.stderr b/tests/ui/async-await/issue-64130-2-send.stderr new file mode 100644 index 000000000..a433c76ae --- /dev/null +++ b/tests/ui/async-await/issue-64130-2-send.stderr @@ -0,0 +1,22 @@ +error: future cannot be sent between threads safely + --> $DIR/issue-64130-2-send.rs:22: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:11 + | +LL | let x = Foo; + | - has type `Foo` which is not `Send` +LL | baz().await; + | ^^^^^ await occurs here, with `x` maybe used later +note: required by a bound in `is_send` + --> $DIR/issue-64130-2-send.rs:11:15 + | +LL | fn is_send<T: Send>(t: T) { } + | ^^^^ required by this bound in `is_send` + +error: aborting due to previous error + diff --git a/tests/ui/async-await/issue-64130-3-other.drop_tracking.stderr b/tests/ui/async-await/issue-64130-3-other.drop_tracking.stderr deleted file mode 100644 index b69f06da1..000000000 --- a/tests/ui/async-await/issue-64130-3-other.drop_tracking.stderr +++ /dev/null @@ -1,27 +0,0 @@ -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:11 - | -LL | let x = Box::new(Foo); - | - has type `Box<Foo>` which does not implement `Qux` -LL | baz().await; - | ^^^^^ await occurs here, with `x` maybe used later -LL | } - | - `x` is later dropped here -note: required by a bound in `is_qux` - --> $DIR/issue-64130-3-other.rs:17:14 - | -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`. diff --git a/tests/ui/async-await/issue-64130-3-other.drop_tracking_mir.stderr b/tests/ui/async-await/issue-64130-3-other.drop_tracking_mir.stderr deleted file mode 100644 index 129837124..000000000 --- a/tests/ui/async-await/issue-64130-3-other.drop_tracking_mir.stderr +++ /dev/null @@ -1,25 +0,0 @@ -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:11 - | -LL | let x = Box::new(Foo); - | - has type `Box<Foo>` which does not implement `Qux` -LL | baz().await; - | ^^^^^ await occurs here, with `x` maybe used later -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`. diff --git a/tests/ui/async-await/issue-64130-3-other.no_drop_tracking.stderr b/tests/ui/async-await/issue-64130-3-other.no_drop_tracking.stderr deleted file mode 100644 index b69f06da1..000000000 --- a/tests/ui/async-await/issue-64130-3-other.no_drop_tracking.stderr +++ /dev/null @@ -1,27 +0,0 @@ -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:11 - | -LL | let x = Box::new(Foo); - | - has type `Box<Foo>` which does not implement `Qux` -LL | baz().await; - | ^^^^^ await occurs here, with `x` maybe used later -LL | } - | - `x` is later dropped here -note: required by a bound in `is_qux` - --> $DIR/issue-64130-3-other.rs:17:14 - | -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`. diff --git a/tests/ui/async-await/issue-64130-3-other.rs b/tests/ui/async-await/issue-64130-3-other.rs index 92d3b7c81..074d67aa3 100644 --- a/tests/ui/async-await/issue-64130-3-other.rs +++ b/tests/ui/async-await/issue-64130-3-other.rs @@ -1,6 +1,3 @@ -// 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 @@ -17,8 +14,9 @@ impl !Qux for Foo {} fn is_qux<T: Qux>(t: T) {} async fn bar() { - let x = Box::new(Foo); + let x = Foo; baz().await; + drop(x); } async fn baz() {} diff --git a/tests/ui/async-await/issue-64130-3-other.stderr b/tests/ui/async-await/issue-64130-3-other.stderr new file mode 100644 index 000000000..573da1034 --- /dev/null +++ b/tests/ui/async-await/issue-64130-3-other.stderr @@ -0,0 +1,25 @@ +error[E0277]: the trait bound `Foo: Qux` is not satisfied in `impl Future<Output = ()>` + --> $DIR/issue-64130-3-other.rs:25: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:18:11 + | +LL | let x = Foo; + | - has type `Foo` which does not implement `Qux` +LL | baz().await; + | ^^^^^ await occurs here, with `x` maybe used later +note: required by a bound in `is_qux` + --> $DIR/issue-64130-3-other.rs:14: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`. diff --git a/tests/ui/async-await/issue-64130-4-async-move.drop-tracking.stderr b/tests/ui/async-await/issue-64130-4-async-move.drop-tracking.stderr deleted file mode 100644 index 884619f4d..000000000 --- a/tests/ui/async-await/issue-64130-4-async-move.drop-tracking.stderr +++ /dev/null @@ -1,26 +0,0 @@ -error: future cannot be sent between threads safely - --> $DIR/issue-64130-4-async-move.rs:20:17 - | -LL | pub fn foo() -> impl Future + Send { - | ^^^^^^^^^^^^^^^^^^ future created by async block is not `Send` - | - = help: the trait `Sync` is not implemented for `(dyn Any + Send + 'static)` -note: future is not `Send` as this value is used across an await - --> $DIR/issue-64130-4-async-move.rs:27:31 - | -LL | match client.status() { - | ------ has type `&Client` which is not `Send` -LL | 200 => { -LL | let _x = get().await; - | ^^^^^^ await occurs here, with `client` maybe used later -... -LL | } - | - `client` is later dropped here -help: consider moving this into a `let` binding to create a shorter lived borrow - --> $DIR/issue-64130-4-async-move.rs:25:15 - | -LL | match client.status() { - | ^^^^^^^^^^^^^^^ - -error: aborting due to previous error - diff --git a/tests/ui/async-await/issue-64130-4-async-move.no_drop_tracking.stderr b/tests/ui/async-await/issue-64130-4-async-move.no_drop_tracking.stderr deleted file mode 100644 index 60b7551ff..000000000 --- a/tests/ui/async-await/issue-64130-4-async-move.no_drop_tracking.stderr +++ /dev/null @@ -1,26 +0,0 @@ -error: future cannot be sent between threads safely - --> $DIR/issue-64130-4-async-move.rs:21: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:23 - | -LL | match client.status() { - | ------ has type `&Client` which is not `Send` -LL | 200 => { -LL | 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 - diff --git a/tests/ui/async-await/issue-64130-4-async-move.rs b/tests/ui/async-await/issue-64130-4-async-move.rs index 5d68a808b..359813f63 100644 --- a/tests/ui/async-await/issue-64130-4-async-move.rs +++ b/tests/ui/async-await/issue-64130-4-async-move.rs @@ -1,9 +1,5 @@ // 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 -// [drop_tracking_mir] check-pass -// [drop_tracking] check-pass +// check-pass use std::any::Any; use std::future::Future; @@ -19,7 +15,6 @@ impl Client { async fn get() {} pub fn foo() -> impl Future + Send { - //[no_drop_tracking]~^ ERROR future cannot be sent between threads safely let client = Client(Box::new(true)); async move { match client.status() { diff --git a/tests/ui/async-await/issue-64130-non-send-future-diags.stderr b/tests/ui/async-await/issue-64130-non-send-future-diags.stderr index e044e2ca0..cb02fcf5c 100644 --- a/tests/ui/async-await/issue-64130-non-send-future-diags.stderr +++ b/tests/ui/async-await/issue-64130-non-send-future-diags.stderr @@ -12,8 +12,6 @@ LL | let g = x.lock().unwrap(); | - has type `MutexGuard<'_, u32>` which is not `Send` LL | baz().await; | ^^^^^ await occurs here, with `g` maybe used later -LL | } - | - `g` is later dropped here note: required by a bound in `is_send` --> $DIR/issue-64130-non-send-future-diags.rs:9:15 | diff --git a/tests/ui/async-await/issue-67252-unnamed-future.drop_tracking.stderr b/tests/ui/async-await/issue-67252-unnamed-future.drop_tracking.stderr deleted file mode 100644 index fa2229865..000000000 --- a/tests/ui/async-await/issue-67252-unnamed-future.drop_tracking.stderr +++ /dev/null @@ -1,30 +0,0 @@ -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 | | drop(a); -LL | | }); - | |_____^ future created by async block is not `Send` - | - = help: within `[async block@$DIR/issue-67252-unnamed-future.rs:21:11: 25:6]`, the trait `Send` is not implemented for `*mut ()` -note: future is not `Send` as this value is used across an await - --> $DIR/issue-67252-unnamed-future.rs:23:17 - | -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 | drop(a); -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 - diff --git a/tests/ui/async-await/issue-67252-unnamed-future.drop_tracking_mir.stderr b/tests/ui/async-await/issue-67252-unnamed-future.drop_tracking_mir.stderr deleted file mode 100644 index 8cf7bb8d9..000000000 --- a/tests/ui/async-await/issue-67252-unnamed-future.drop_tracking_mir.stderr +++ /dev/null @@ -1,22 +0,0 @@ -error: future cannot be sent between threads safely - --> $DIR/issue-67252-unnamed-future.rs:21:5 - | -LL | spawn(async { - | ^^^^^ future created by async block is not `Send` - | - = help: within `[async block@$DIR/issue-67252-unnamed-future.rs:21:11: 25:6]`, the trait `Send` is not implemented for `*mut ()` -note: future is not `Send` as this value is used across an await - --> $DIR/issue-67252-unnamed-future.rs:23:17 - | -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 -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 - diff --git a/tests/ui/async-await/issue-67252-unnamed-future.no_drop_tracking.stderr b/tests/ui/async-await/issue-67252-unnamed-future.no_drop_tracking.stderr deleted file mode 100644 index fa2229865..000000000 --- a/tests/ui/async-await/issue-67252-unnamed-future.no_drop_tracking.stderr +++ /dev/null @@ -1,30 +0,0 @@ -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 | | drop(a); -LL | | }); - | |_____^ future created by async block is not `Send` - | - = help: within `[async block@$DIR/issue-67252-unnamed-future.rs:21:11: 25:6]`, the trait `Send` is not implemented for `*mut ()` -note: future is not `Send` as this value is used across an await - --> $DIR/issue-67252-unnamed-future.rs:23:17 - | -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 | drop(a); -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 - diff --git a/tests/ui/async-await/issue-67252-unnamed-future.rs b/tests/ui/async-await/issue-67252-unnamed-future.rs index bb9ad77ce..60717d993 100644 --- a/tests/ui/async-await/issue-67252-unnamed-future.rs +++ b/tests/ui/async-await/issue-67252-unnamed-future.rs @@ -1,6 +1,3 @@ -// 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; @@ -21,7 +18,7 @@ async fn foo() { spawn(async { //~ ERROR future cannot be sent between threads safely let a = std::ptr::null_mut::<()>(); // `*mut ()` is not `Send` AFuture.await; - drop(a); + let _a = a; }); } diff --git a/tests/ui/async-await/issue-67252-unnamed-future.stderr b/tests/ui/async-await/issue-67252-unnamed-future.stderr new file mode 100644 index 000000000..069befa91 --- /dev/null +++ b/tests/ui/async-await/issue-67252-unnamed-future.stderr @@ -0,0 +1,22 @@ +error: future cannot be sent between threads safely + --> $DIR/issue-67252-unnamed-future.rs:18:5 + | +LL | spawn(async { + | ^^^^^ future created by async block is not `Send` + | + = help: within `{async block@$DIR/issue-67252-unnamed-future.rs:18:11: 22: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:17 + | +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 +note: required by a bound in `spawn` + --> $DIR/issue-67252-unnamed-future.rs:6:13 + | +LL | fn spawn<T: Send>(_: T) {} + | ^^^^ required by this bound in `spawn` + +error: aborting due to previous error + diff --git a/tests/ui/async-await/issue-68112.drop_tracking.stderr b/tests/ui/async-await/issue-68112.drop_tracking.stderr deleted file mode 100644 index bd648de30..000000000 --- a/tests/ui/async-await/issue-68112.drop_tracking.stderr +++ /dev/null @@ -1,82 +0,0 @@ -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>>>`, `()`, `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`. diff --git a/tests/ui/async-await/issue-68112.drop_tracking_mir.stderr b/tests/ui/async-await/issue-68112.drop_tracking_mir.stderr deleted file mode 100644 index 7a9242cba..000000000 --- a/tests/ui/async-await/issue-68112.drop_tracking_mir.stderr +++ /dev/null @@ -1,80 +0,0 @@ -error: future cannot be sent between threads safely - --> $DIR/issue-68112.rs:37:5 - | -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:5 - | -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:5 - | -LL | require_send(send_fut); - | ^^^^^^^^^^^^ `RefCell<i32>` cannot be shared between threads safely - | - = help: the trait `Sync` is not implemented for `RefCell<i32>` - = note: if you want to do aliasing and mutation between multiple threads, use `std::sync::RwLock` instead - = 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: `impl Future<Output = Arc<RefCell<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`. diff --git a/tests/ui/async-await/issue-68112.no_drop_tracking.stderr b/tests/ui/async-await/issue-68112.no_drop_tracking.stderr deleted file mode 100644 index 35b7341f6..000000000 --- a/tests/ui/async-await/issue-68112.no_drop_tracking.stderr +++ /dev/null @@ -1,82 +0,0 @@ -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`. diff --git a/tests/ui/async-await/issue-68112.rs b/tests/ui/async-await/issue-68112.rs index 19119ae0f..fd6089e0c 100644 --- a/tests/ui/async-await/issue-68112.rs +++ b/tests/ui/async-await/issue-68112.rs @@ -1,7 +1,4 @@ // 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 use std::{ cell::RefCell, diff --git a/tests/ui/async-await/issue-68112.stderr b/tests/ui/async-await/issue-68112.stderr new file mode 100644 index 000000000..17b619ebe --- /dev/null +++ b/tests/ui/async-await/issue-68112.stderr @@ -0,0 +1,80 @@ +error: future cannot be sent between threads safely + --> $DIR/issue-68112.rs:34:5 + | +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:31: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:11: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:43:5 + | +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:40: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:11: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:62:5 + | +LL | require_send(send_fut); + | ^^^^^^^^^^^^ `RefCell<i32>` cannot be shared between threads safely + | + = help: the trait `Sync` is not implemented for `RefCell<i32>` + = note: if you want to do aliasing and mutation between multiple threads, use `std::sync::RwLock` instead + = note: required for `Arc<RefCell<i32>>` to implement `Send` +note: required because it's used within this `async fn` body + --> $DIR/issue-68112.rs:47: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:50:31 + | +LL | fn make_non_send_future2() -> impl Future<Output = Arc<RefCell<i32>>> { + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + = note: required because it captures the following types: `impl Future<Output = Arc<RefCell<i32>>>`, `Ready<i32>` +note: required because it's used within this `async` block + --> $DIR/issue-68112.rs:57: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:11: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`. diff --git a/tests/ui/async-await/issue-68523-start.rs b/tests/ui/async-await/issue-68523-start.rs index 2ced88a16..5adc28b20 100644 --- a/tests/ui/async-await/issue-68523-start.rs +++ b/tests/ui/async-await/issue-68523-start.rs @@ -4,6 +4,6 @@ #[start] pub async fn start(_: isize, _: *const *const u8) -> isize { -//~^ ERROR `start` is not allowed to be `async` +//~^ ERROR `#[start]` function is not allowed to be `async` 0 } diff --git a/tests/ui/async-await/issue-68523-start.stderr b/tests/ui/async-await/issue-68523-start.stderr index 3a0a3b5de..7c06fe340 100644 --- a/tests/ui/async-await/issue-68523-start.stderr +++ b/tests/ui/async-await/issue-68523-start.stderr @@ -1,8 +1,8 @@ -error[E0752]: `start` is not allowed to be `async` +error[E0752]: `#[start]` function is not allowed to be `async` --> $DIR/issue-68523-start.rs:6:1 | LL | pub async fn start(_: isize, _: *const *const u8) -> isize { - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `start` is not allowed to be `async` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `#[start]` is not allowed to be `async` error: aborting due to previous error diff --git a/tests/ui/async-await/issue-70818.drop_tracking.stderr b/tests/ui/async-await/issue-70818.drop_tracking.stderr deleted file mode 100644 index ab0698c3e..000000000 --- a/tests/ui/async-await/issue-70818.drop_tracking.stderr +++ /dev/null @@ -1,18 +0,0 @@ -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 - diff --git a/tests/ui/async-await/issue-70818.drop_tracking_mir.stderr b/tests/ui/async-await/issue-70818.drop_tracking_mir.stderr deleted file mode 100644 index ab0698c3e..000000000 --- a/tests/ui/async-await/issue-70818.drop_tracking_mir.stderr +++ /dev/null @@ -1,18 +0,0 @@ -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 - diff --git a/tests/ui/async-await/issue-70818.no_drop_tracking.stderr b/tests/ui/async-await/issue-70818.no_drop_tracking.stderr deleted file mode 100644 index ab0698c3e..000000000 --- a/tests/ui/async-await/issue-70818.no_drop_tracking.stderr +++ /dev/null @@ -1,18 +0,0 @@ -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 - diff --git a/tests/ui/async-await/issue-70818.rs b/tests/ui/async-await/issue-70818.rs index 2941de0f5..019c56eb2 100644 --- a/tests/ui/async-await/issue-70818.rs +++ b/tests/ui/async-await/issue-70818.rs @@ -1,6 +1,3 @@ -// 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; diff --git a/tests/ui/async-await/issue-70818.stderr b/tests/ui/async-await/issue-70818.stderr new file mode 100644 index 000000000..20109d4d1 --- /dev/null +++ b/tests/ui/async-await/issue-70818.stderr @@ -0,0 +1,18 @@ +error: future cannot be sent between threads safely + --> $DIR/issue-70818.rs:4: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 + | +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 + diff --git a/tests/ui/async-await/issue-70935-complex-spans.drop_tracking.stderr b/tests/ui/async-await/issue-70935-complex-spans.drop_tracking.stderr deleted file mode 100644 index f80bb4242..000000000 --- a/tests/ui/async-await/issue-70935-complex-spans.drop_tracking.stderr +++ /dev/null @@ -1,41 +0,0 @@ -error[E0277]: `*mut ()` cannot be shared between threads safely - --> $DIR/issue-70935-complex-spans.rs:18:23 - | -LL | fn foo(x: NotSync) -> impl Future + Send { - | ^^^^^^^^^^^^^^^^^^ `*mut ()` cannot be shared between threads safely - | - = help: within `NotSync`, the trait `Sync` is not implemented for `*mut ()` -note: required because it appears within the type `PhantomData<*mut ()>` - --> $SRC_DIR/core/src/marker.rs:LL:COL -note: required because it appears within the type `NotSync` - --> $DIR/issue-70935-complex-spans.rs:12:8 - | -LL | struct NotSync(PhantomData<*mut ()>); - | ^^^^^^^ - = note: required for `&NotSync` to implement `Send` -note: required because it's used within this closure - --> $DIR/issue-70935-complex-spans.rs:22:13 - | -LL | baz(|| async { - | ^^ -note: required because it's used within this `async fn` body - --> $DIR/issue-70935-complex-spans.rs:15:67 - | -LL | async fn baz<T>(_c: impl FnMut() -> T) where T: Future<Output=()> { - | ___________________________________________________________________^ -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:21:5 - | -LL | / async move { -LL | | baz(|| async { -LL | | foo(x.clone()); -LL | | }).await; -LL | | } - | |_____^ - -error: aborting due to previous error - -For more information about this error, try `rustc --explain E0277`. diff --git a/tests/ui/async-await/issue-70935-complex-spans.drop_tracking_mir.stderr b/tests/ui/async-await/issue-70935-complex-spans.drop_tracking_mir.stderr deleted file mode 100644 index eb9d93e22..000000000 --- a/tests/ui/async-await/issue-70935-complex-spans.drop_tracking_mir.stderr +++ /dev/null @@ -1,41 +0,0 @@ -error[E0277]: `*mut ()` cannot be shared between threads safely - --> $DIR/issue-70935-complex-spans.rs:18:23 - | -LL | fn foo(x: NotSync) -> impl Future + Send { - | ^^^^^^^^^^^^^^^^^^ `*mut ()` cannot be shared between threads safely - | - = help: within `NotSync`, the trait `Sync` is not implemented for `*mut ()` -note: required because it appears within the type `PhantomData<*mut ()>` - --> $SRC_DIR/core/src/marker.rs:LL:COL -note: required because it appears within the type `NotSync` - --> $DIR/issue-70935-complex-spans.rs:12:8 - | -LL | struct NotSync(PhantomData<*mut ()>); - | ^^^^^^^ - = note: required for `&NotSync` to implement `Send` -note: required because it's used within this closure - --> $DIR/issue-70935-complex-spans.rs:22:13 - | -LL | baz(|| async { - | ^^ -note: required because it's used within this `async fn` body - --> $DIR/issue-70935-complex-spans.rs:15:67 - | -LL | async fn baz<T>(_c: impl FnMut() -> T) where T: Future<Output=()> { - | ___________________________________________________________________^ -LL | | } - | |_^ - = note: required because it captures the following types: `impl Future<Output = ()>` -note: required because it's used within this `async` block - --> $DIR/issue-70935-complex-spans.rs:21:5 - | -LL | / async move { -LL | | baz(|| async { -LL | | foo(x.clone()); -LL | | }).await; -LL | | } - | |_____^ - -error: aborting due to previous error - -For more information about this error, try `rustc --explain E0277`. diff --git a/tests/ui/async-await/issue-70935-complex-spans.no_drop_tracking.stderr b/tests/ui/async-await/issue-70935-complex-spans.no_drop_tracking.stderr deleted file mode 100644 index d8ef6a5ee..000000000 --- a/tests/ui/async-await/issue-70935-complex-spans.no_drop_tracking.stderr +++ /dev/null @@ -1,21 +0,0 @@ -error: future cannot be sent between threads safely - --> $DIR/issue-70935-complex-spans.rs:18:23 - | -LL | fn foo(x: NotSync) -> impl Future + Send { - | ^^^^^^^^^^^^^^^^^^ future created by async block is not `Send` - | - = help: within `NotSync`, the trait `Sync` is not implemented for `*mut ()` -note: future is not `Send` as this value is used across an await - --> $DIR/issue-70935-complex-spans.rs:24:12 - | -LL | baz(|| async { - | _____________- -LL | | foo(x.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:22:13: 22:15]` which is not `Send` - -error: aborting due to previous error - diff --git a/tests/ui/async-await/issue-70935-complex-spans.rs b/tests/ui/async-await/issue-70935-complex-spans.rs index 9ebde1d39..4af737395 100644 --- a/tests/ui/async-await/issue-70935-complex-spans.rs +++ b/tests/ui/async-await/issue-70935-complex-spans.rs @@ -1,7 +1,4 @@ // 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 // #70935: Check if we do not emit snippet // with newlines which lead complex diagnostics. @@ -16,8 +13,7 @@ async fn baz<T>(_c: impl FnMut() -> T) where T: Future<Output=()> { } fn foo(x: NotSync) -> impl Future + Send { - //[no_drop_tracking]~^ ERROR future cannot be sent between threads safely - //[drop_tracking,drop_tracking_mir]~^^ ERROR `*mut ()` cannot be shared between threads + //~^ ERROR `*mut ()` cannot be shared between threads safely async move { baz(|| async { foo(x.clone()); diff --git a/tests/ui/async-await/issue-70935-complex-spans.stderr b/tests/ui/async-await/issue-70935-complex-spans.stderr new file mode 100644 index 000000000..ab834daa8 --- /dev/null +++ b/tests/ui/async-await/issue-70935-complex-spans.stderr @@ -0,0 +1,41 @@ +error[E0277]: `*mut ()` cannot be shared between threads safely + --> $DIR/issue-70935-complex-spans.rs:15:23 + | +LL | fn foo(x: NotSync) -> impl Future + Send { + | ^^^^^^^^^^^^^^^^^^ `*mut ()` cannot be shared between threads safely + | + = help: within `NotSync`, the trait `Sync` is not implemented for `*mut ()` +note: required because it appears within the type `PhantomData<*mut ()>` + --> $SRC_DIR/core/src/marker.rs:LL:COL +note: required because it appears within the type `NotSync` + --> $DIR/issue-70935-complex-spans.rs:9:8 + | +LL | struct NotSync(PhantomData<*mut ()>); + | ^^^^^^^ + = note: required for `&NotSync` to implement `Send` +note: required because it's used within this closure + --> $DIR/issue-70935-complex-spans.rs:18:13 + | +LL | baz(|| async { + | ^^ +note: required because it's used within this `async fn` body + --> $DIR/issue-70935-complex-spans.rs:12:67 + | +LL | async fn baz<T>(_c: impl FnMut() -> T) where T: Future<Output=()> { + | ___________________________________________________________________^ +LL | | } + | |_^ + = note: required because it captures the following types: `impl Future<Output = ()>` +note: required because it's used within this `async` block + --> $DIR/issue-70935-complex-spans.rs:17:5 + | +LL | / async move { +LL | | baz(|| async { +LL | | foo(x.clone()); +LL | | }).await; +LL | | } + | |_____^ + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0277`. diff --git a/tests/ui/async-await/issue-71137.stderr b/tests/ui/async-await/issue-71137.stderr index a344246d6..443af010c 100644 --- a/tests/ui/async-await/issue-71137.stderr +++ b/tests/ui/async-await/issue-71137.stderr @@ -12,9 +12,6 @@ LL | let mut guard = m.lock().unwrap(); | --------- has type `MutexGuard<'_, i32>` which is not `Send` LL | (async { "right"; }).await; | ^^^^^ await occurs here, with `mut guard` maybe used later -LL | *guard += 1; -LL | } - | - `mut guard` is later dropped here note: required by a bound in `fake_spawn` --> $DIR/issue-71137.rs:8:27 | diff --git a/tests/ui/async-await/issue-73137.rs b/tests/ui/async-await/issue-73137.rs index dcbe7765a..c43ce2cad 100644 --- a/tests/ui/async-await/issue-73137.rs +++ b/tests/ui/async-await/issue-73137.rs @@ -2,9 +2,6 @@ // run-pass // edition:2018 -// revisions: normal drop-tracking -// [normal]compile-flags: -Zdrop-tracking=no -// [drop-tracking]compile-flags: -Zdrop-tracking #![allow(dead_code)] use std::future::Future; diff --git a/tests/ui/async-await/issue-73741-type-err-drop-tracking.drop_tracking.stderr b/tests/ui/async-await/issue-73741-type-err-drop-tracking.drop_tracking.stderr deleted file mode 100644 index 6d19c3beb..000000000 --- a/tests/ui/async-await/issue-73741-type-err-drop-tracking.drop_tracking.stderr +++ /dev/null @@ -1,11 +0,0 @@ -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`. diff --git a/tests/ui/async-await/issue-73741-type-err-drop-tracking.drop_tracking_mir.stderr b/tests/ui/async-await/issue-73741-type-err-drop-tracking.drop_tracking_mir.stderr deleted file mode 100644 index 6d19c3beb..000000000 --- a/tests/ui/async-await/issue-73741-type-err-drop-tracking.drop_tracking_mir.stderr +++ /dev/null @@ -1,11 +0,0 @@ -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`. diff --git a/tests/ui/async-await/issue-73741-type-err-drop-tracking.no_drop_tracking.stderr b/tests/ui/async-await/issue-73741-type-err-drop-tracking.no_drop_tracking.stderr deleted file mode 100644 index 6d19c3beb..000000000 --- a/tests/ui/async-await/issue-73741-type-err-drop-tracking.no_drop_tracking.stderr +++ /dev/null @@ -1,11 +0,0 @@ -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`. diff --git a/tests/ui/async-await/issue-73741-type-err-drop-tracking.rs b/tests/ui/async-await/issue-73741-type-err-drop-tracking.rs deleted file mode 100644 index 1fa8d6914..000000000 --- a/tests/ui/async-await/issue-73741-type-err-drop-tracking.rs +++ /dev/null @@ -1,17 +0,0 @@ -// 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 -// -// Regression test for issue #73741 -// Ensures that we don't emit spurious errors when -// a type error ocurrs in an `async fn` - -async fn weird() { - 1 = 2; //~ ERROR invalid left-hand side - - let mut loop_count = 0; - async {}.await -} - -fn main() {} diff --git a/tests/ui/async-await/issue-86507.drop_tracking.stderr b/tests/ui/async-await/issue-86507.drop_tracking.stderr deleted file mode 100644 index adb7b9bf4..000000000 --- a/tests/ui/async-await/issue-86507.drop_tracking.stderr +++ /dev/null @@ -1,23 +0,0 @@ -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 `Pin<Box<[async block@$DIR/issue-86507.rs:21:17: 23:18]>>` to `Pin<Box<(dyn Future<Output = ()> + Send + 'async_trait)>>` -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 - diff --git a/tests/ui/async-await/issue-86507.drop_tracking_mir.stderr b/tests/ui/async-await/issue-86507.drop_tracking_mir.stderr deleted file mode 100644 index adb7b9bf4..000000000 --- a/tests/ui/async-await/issue-86507.drop_tracking_mir.stderr +++ /dev/null @@ -1,23 +0,0 @@ -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 `Pin<Box<[async block@$DIR/issue-86507.rs:21:17: 23:18]>>` to `Pin<Box<(dyn Future<Output = ()> + Send + 'async_trait)>>` -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 - diff --git a/tests/ui/async-await/issue-86507.no_drop_tracking.stderr b/tests/ui/async-await/issue-86507.no_drop_tracking.stderr deleted file mode 100644 index adb7b9bf4..000000000 --- a/tests/ui/async-await/issue-86507.no_drop_tracking.stderr +++ /dev/null @@ -1,23 +0,0 @@ -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 `Pin<Box<[async block@$DIR/issue-86507.rs:21:17: 23:18]>>` to `Pin<Box<(dyn Future<Output = ()> + Send + 'async_trait)>>` -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 - diff --git a/tests/ui/async-await/issue-86507.rs b/tests/ui/async-await/issue-86507.rs index 63c298dbe..317f03176 100644 --- a/tests/ui/async-await/issue-86507.rs +++ b/tests/ui/async-await/issue-86507.rs @@ -1,6 +1,3 @@ -// 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; diff --git a/tests/ui/async-await/issue-86507.stderr b/tests/ui/async-await/issue-86507.stderr new file mode 100644 index 000000000..d5a3f72cf --- /dev/null +++ b/tests/ui/async-await/issue-86507.stderr @@ -0,0 +1,23 @@ +error: future cannot be sent between threads safely + --> $DIR/issue-86507.rs:17: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:19:29 + | +LL | let x = x; + | ^ has type `&T` which is not `Send`, because `T` is not `Sync` + = note: required for the cast from `Pin<Box<{async block@$DIR/issue-86507.rs:18:17: 20:18}>>` to `Pin<Box<(dyn Future<Output = ()> + Send + 'async_trait)>>` +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 + diff --git a/tests/ui/async-await/issue-93197.rs b/tests/ui/async-await/issue-93197.rs index c627fe17a..05ec013d0 100644 --- a/tests/ui/async-await/issue-93197.rs +++ b/tests/ui/async-await/issue-93197.rs @@ -1,7 +1,6 @@ // Regression test for #93197 // check-pass // edition:2021 -// compile-flags: -Zdrop-tracking #![feature(try_blocks)] diff --git a/tests/ui/async-await/issue-93648.rs b/tests/ui/async-await/issue-93648.rs index ec2249ca5..b27a79a42 100644 --- a/tests/ui/async-await/issue-93648.rs +++ b/tests/ui/async-await/issue-93648.rs @@ -1,6 +1,3 @@ -// 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 diff --git a/tests/ui/async-await/issues/auxiliary/issue_67893.rs b/tests/ui/async-await/issues/auxiliary/issue_67893.rs index d53944698..efde4d286 100644 --- a/tests/ui/async-await/issues/auxiliary/issue_67893.rs +++ b/tests/ui/async-await/issues/auxiliary/issue_67893.rs @@ -1,13 +1,12 @@ -// 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}; +fn make_arc() -> Arc<Mutex<()>> { unimplemented!() } + pub async fn f(_: ()) {} pub async fn run() { - let x: Arc<Mutex<()>> = unimplemented!(); + let x: Arc<Mutex<()>> = make_arc(); f(*x.lock().unwrap()).await; } diff --git a/tests/ui/async-await/issues/issue-107280.rs b/tests/ui/async-await/issues/issue-107280.rs index 85fce8740..81ae9553c 100644 --- a/tests/ui/async-await/issues/issue-107280.rs +++ b/tests/ui/async-await/issues/issue-107280.rs @@ -3,11 +3,6 @@ async fn foo() { inner::<false>().await //~^ ERROR: function takes 2 generic arguments but 1 generic argument was supplied - //~| ERROR: type inside `async fn` body must be known in this context - //~| ERROR: type inside `async fn` body must be known in this context - //~| ERROR: type inside `async fn` body must be known in this context - //~| ERROR: type inside `async fn` body must be known in this context - //~| ERROR: type inside `async fn` body must be known in this context } async fn inner<T, const PING: bool>() {} diff --git a/tests/ui/async-await/issues/issue-107280.stderr b/tests/ui/async-await/issues/issue-107280.stderr index 2e69862a0..c5fd5c5bf 100644 --- a/tests/ui/async-await/issues/issue-107280.stderr +++ b/tests/ui/async-await/issues/issue-107280.stderr @@ -7,7 +7,7 @@ LL | inner::<false>().await | expected 2 generic arguments | note: function defined here, with 2 generic parameters: `T`, `PING` - --> $DIR/issue-107280.rs:13:10 + --> $DIR/issue-107280.rs:8:10 | LL | async fn inner<T, const PING: bool>() {} | ^^^^^ - ---------------- @@ -16,67 +16,6 @@ help: add missing generic argument LL | inner::<false, PING>().await | ++++++ -error[E0698]: type inside `async fn` body must be known in this context - --> $DIR/issue-107280.rs:4:5 - | -LL | inner::<false>().await - | ^^^^^^^^^^^^^^ cannot infer the value of const parameter `PING` declared on the function `inner` - | -note: the type is part of the `async fn` body because of this `await` - --> $DIR/issue-107280.rs:4:22 - | -LL | inner::<false>().await - | ^^^^^ - -error[E0698]: type inside `async fn` body must be known in this context - --> $DIR/issue-107280.rs:4:5 - | -LL | inner::<false>().await - | ^^^^^^^^^^^^^^ cannot infer the value of const parameter `PING` declared on the function `inner` - | -note: the type is part of the `async fn` body because of this `await` - --> $DIR/issue-107280.rs:4:22 - | -LL | inner::<false>().await - | ^^^^^ - -error[E0698]: type inside `async fn` body must be known in this context - --> $DIR/issue-107280.rs:4:5 - | -LL | inner::<false>().await - | ^^^^^^^^^^^^^^ cannot infer the value of const parameter `PING` declared on the function `inner` - | -note: the type is part of the `async fn` body because of this `await` - --> $DIR/issue-107280.rs:4:22 - | -LL | inner::<false>().await - | ^^^^^ - -error[E0698]: type inside `async fn` body must be known in this context - --> $DIR/issue-107280.rs:4:5 - | -LL | inner::<false>().await - | ^^^^^^^^^^^^^^ cannot infer the value of const parameter `PING` declared on the function `inner` - | -note: the type is part of the `async fn` body because of this `await` - --> $DIR/issue-107280.rs:4:22 - | -LL | inner::<false>().await - | ^^^^^ - -error[E0698]: type inside `async fn` body must be known in this context - --> $DIR/issue-107280.rs:4:5 - | -LL | inner::<false>().await - | ^^^^^^^^^^^^^^ cannot infer the value of const parameter `PING` declared on the function `inner` - | -note: the type is part of the `async fn` body because of this `await` - --> $DIR/issue-107280.rs:4:22 - | -LL | inner::<false>().await - | ^^^^^ - -error: aborting due to 6 previous errors +error: aborting due to previous error -Some errors have detailed explanations: E0107, E0698. -For more information about an error, try `rustc --explain E0107`. +For more information about this error, try `rustc --explain E0107`. diff --git a/tests/ui/async-await/issues/issue-62009-1.stderr b/tests/ui/async-await/issues/issue-62009-1.stderr index 53d0577a1..bb617d090 100644 --- a/tests/ui/async-await/issues/issue-62009-1.stderr +++ b/tests/ui/async-await/issues/issue-62009-1.stderr @@ -24,18 +24,18 @@ LL | fn main() { LL | (|_| 2333).await; | ^^^^^ only allowed inside `async` functions and blocks -error[E0277]: `[closure@$DIR/issue-62009-1.rs:12:6: 12:9]` is not a future +error[E0277]: `{closure@$DIR/issue-62009-1.rs:12:6: 12:9}` is not a future --> $DIR/issue-62009-1.rs:12:16 | LL | (|_| 2333).await; | -^^^^^ | || - | |`[closure@$DIR/issue-62009-1.rs:12:6: 12:9]` is not a future + | |`{closure@$DIR/issue-62009-1.rs:12:6: 12:9}` is not a future | help: remove the `.await` | - = help: the trait `Future` is not implemented for closure `[closure@$DIR/issue-62009-1.rs:12:6: 12:9]` - = note: [closure@$DIR/issue-62009-1.rs:12:6: 12:9] must be a future or must implement `IntoFuture` to be awaited - = note: required for `[closure@$DIR/issue-62009-1.rs:12:6: 12:9]` to implement `IntoFuture` + = help: the trait `Future` is not implemented for closure `{closure@$DIR/issue-62009-1.rs:12:6: 12:9}` + = note: {closure@$DIR/issue-62009-1.rs:12:6: 12:9} must be a future or must implement `IntoFuture` to be awaited + = note: required for `{closure@$DIR/issue-62009-1.rs:12:6: 12:9}` to implement `IntoFuture` error: aborting due to 4 previous errors diff --git a/tests/ui/async-await/issues/issue-65436-raw-ptr-not-send.no_drop_tracking.stderr b/tests/ui/async-await/issues/issue-65436-raw-ptr-not-send.no_drop_tracking.stderr deleted file mode 100644 index 53d326202..000000000 --- a/tests/ui/async-await/issues/issue-65436-raw-ptr-not-send.no_drop_tracking.stderr +++ /dev/null @@ -1,32 +0,0 @@ -error: future cannot be sent between threads safely - --> $DIR/issue-65436-raw-ptr-not-send.rs:17:17 - | -LL | assert_send(async { - | _________________^ -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:17:17: 20:6]`, the trait `Send` is not implemented for `*const u8` -note: future is not `Send` as this value is used across an await - --> $DIR/issue-65436-raw-ptr-not-send.rs:19:36 - | -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:14:19 - | -LL | fn assert_send<T: Send>(_: T) {} - | ^^^^ required by this bound in `assert_send` - -error: aborting due to previous error - diff --git a/tests/ui/async-await/issues/issue-65436-raw-ptr-not-send.rs b/tests/ui/async-await/issues/issue-65436-raw-ptr-not-send.rs index d7ef92951..ef6f105f3 100644 --- a/tests/ui/async-await/issues/issue-65436-raw-ptr-not-send.rs +++ b/tests/ui/async-await/issues/issue-65436-raw-ptr-not-send.rs @@ -1,9 +1,5 @@ // 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 -// [drop_tracking] check-pass -// [drop_tracking_mir] check-pass +// check-pass struct Foo(*const u8); @@ -15,7 +11,6 @@ fn assert_send<T: Send>(_: T) {} fn main() { assert_send(async { - //[no_drop_tracking]~^ ERROR future cannot be sent between threads safely bar(Foo(std::ptr::null())).await; }) } diff --git a/tests/ui/async-await/issues/issue-66695-static-refs.rs b/tests/ui/async-await/issues/issue-66695-static-refs.rs index f0609713b..1b0e1c6c9 100644 --- a/tests/ui/async-await/issues/issue-66695-static-refs.rs +++ b/tests/ui/async-await/issues/issue-66695-static-refs.rs @@ -1,12 +1,15 @@ // build-pass // edition:2018 +#![feature(if_let_guard)] + static A: [i32; 5] = [1, 2, 3, 4, 5]; async fn fun() { let u = A[async { 1 }.await]; match A { i if async { true }.await => (), + i if let Some(1) = async { Some(1) }.await => (), _ => (), } } @@ -18,6 +21,7 @@ fn main() { async { match A { i if async { true }.await => (), + i if let Some(2) = async { Some(2) }.await => (), _ => (), } }; diff --git a/tests/ui/async-await/issues/issue-67611-static-mut-refs.rs b/tests/ui/async-await/issues/issue-67611-static-mut-refs.rs index c4f8f607d..caed76269 100644 --- a/tests/ui/async-await/issues/issue-67611-static-mut-refs.rs +++ b/tests/ui/async-await/issues/issue-67611-static-mut-refs.rs @@ -1,9 +1,7 @@ // 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 +#![feature(if_let_guard)] static mut A: [i32; 5] = [1, 2, 3, 4, 5]; @@ -14,6 +12,7 @@ async fn fun() { unsafe { match A { i if async { true }.await => (), + i if let Some(1) = async { Some(1) }.await => (), _ => (), } } @@ -27,6 +26,7 @@ fn main() { unsafe { match A { i if async { true }.await => (), + i if let Some(2) = async { Some(2) }.await => (), _ => (), } } diff --git a/tests/ui/async-await/issues/issue-67893.rs b/tests/ui/async-await/issues/issue-67893.rs index d73772e5f..359c75f17 100644 --- a/tests/ui/async-await/issues/issue-67893.rs +++ b/tests/ui/async-await/issues/issue-67893.rs @@ -7,5 +7,5 @@ fn g(_: impl Send) {} fn main() { g(issue_67893::run()) - //~^ ERROR future cannot be sent between threads safely + //~^ ERROR `MutexGuard<'_, ()>` cannot be sent between threads safely } diff --git a/tests/ui/async-await/issues/issue-67893.stderr b/tests/ui/async-await/issues/issue-67893.stderr index c941b9eeb..f36269e8f 100644 --- a/tests/ui/async-await/issues/issue-67893.stderr +++ b/tests/ui/async-await/issues/issue-67893.stderr @@ -1,18 +1,27 @@ -error: future cannot be sent between threads safely +error[E0277]: `MutexGuard<'_, ()>` cannot be sent between threads safely --> $DIR/issue-67893.rs:9:7 | LL | g(issue_67893::run()) - | ^^^^^^^^^^^^^^^^^^ future is not `Send` + | - ^^^^^^^^^^^^^^^^^^ `MutexGuard<'_, ()>` cannot be sent between threads safely + | | + | required by a bound introduced by this call + | + ::: $DIR/auxiliary/issue_67893.rs:9:20 + | +LL | pub async fn run() { + | - within this `impl Future<Output = ()>` | = 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:12:27 + = note: required because it captures the following types: `Arc<Mutex<()>>`, `MutexGuard<'_, ()>`, `impl Future<Output = ()>` +note: required because it's used within this `async fn` body + --> $DIR/auxiliary/issue_67893.rs:9:20 | -LL | f(*x.lock().unwrap()).await; - | ----------------- ^^^^^- `x.lock().unwrap()` is later dropped here - | | | - | | await occurs here, with `x.lock().unwrap()` maybe used later - | has type `MutexGuard<'_, ()>` which is not `Send` +LL | pub async fn run() { + | ____________________^ +LL | | let x: Arc<Mutex<()>> = make_arc(); +LL | | f(*x.lock().unwrap()).await; +LL | | } + | |_^ note: required by a bound in `g` --> $DIR/issue-67893.rs:6:14 | @@ -21,3 +30,4 @@ LL | fn g(_: impl Send) {} error: aborting due to previous error +For more information about this error, try `rustc --explain E0277`. diff --git a/tests/ui/async-await/issues/issue-78600.rs b/tests/ui/async-await/issues/issue-78600.rs index 8aaeaecf3..4303fc795 100644 --- a/tests/ui/async-await/issues/issue-78600.rs +++ b/tests/ui/async-await/issues/issue-78600.rs @@ -1,10 +1,10 @@ +// check-pass // edition:2018 struct S<'a>(&'a i32); impl<'a> S<'a> { async fn new(i: &'a i32) -> Result<Self, ()> { - //~^ ERROR: `async fn` Ok(S(&22)) } } diff --git a/tests/ui/async-await/issues/issue-78600.stderr b/tests/ui/async-await/issues/issue-78600.stderr deleted file mode 100644 index 37eafa996..000000000 --- a/tests/ui/async-await/issues/issue-78600.stderr +++ /dev/null @@ -1,14 +0,0 @@ -error[E0658]: `async fn` return type cannot contain a projection or `Self` that references lifetimes from a parent scope - --> $DIR/issue-78600.rs:6:33 - | -LL | async fn new(i: &'a i32) -> Result<Self, ()> { - | ^^^^^^^----^^^^^ - | | - | help: consider spelling out the type instead: `S<'a>` - | - = note: see issue #103532 <https://github.com/rust-lang/rust/issues/103532> for more information - = help: add `#![feature(impl_trait_projections)]` to the crate attributes to enable - -error: aborting due to previous error - -For more information about this error, try `rustc --explain E0658`. diff --git a/tests/ui/async-await/large_moves.attribute.stderr b/tests/ui/async-await/large_moves.attribute.stderr deleted file mode 100644 index 94f61caa2..000000000 --- a/tests/ui/async-await/large_moves.attribute.stderr +++ /dev/null @@ -1,31 +0,0 @@ -error: moving 10024 bytes - --> $DIR/large_moves.rs:19:14 - | -LL | let z = (x, 42); - | ^ value moved from here - | - = note: The current maximum size is 1000, but it can be customized with the move_size_limit attribute: `#![move_size_limit = "..."]` -note: the lint level is defined here - --> $DIR/large_moves.rs:1:9 - | -LL | #![deny(large_assignments)] - | ^^^^^^^^^^^^^^^^^ - -error: moving 10024 bytes - --> $DIR/large_moves.rs:19:13 - | -LL | let z = (x, 42); - | ^^^^^^^ value moved from here - | - = note: The current maximum size is 1000, but it can be customized with the move_size_limit attribute: `#![move_size_limit = "..."]` - -error: moving 10024 bytes - --> $DIR/large_moves.rs:21:13 - | -LL | let a = z.0; - | ^^^ value moved from here - | - = note: The current maximum size is 1000, but it can be customized with the move_size_limit attribute: `#![move_size_limit = "..."]` - -error: aborting due to 3 previous errors - diff --git a/tests/ui/async-await/large_moves.option.stderr b/tests/ui/async-await/large_moves.option.stderr deleted file mode 100644 index 94f61caa2..000000000 --- a/tests/ui/async-await/large_moves.option.stderr +++ /dev/null @@ -1,31 +0,0 @@ -error: moving 10024 bytes - --> $DIR/large_moves.rs:19:14 - | -LL | let z = (x, 42); - | ^ value moved from here - | - = note: The current maximum size is 1000, but it can be customized with the move_size_limit attribute: `#![move_size_limit = "..."]` -note: the lint level is defined here - --> $DIR/large_moves.rs:1:9 - | -LL | #![deny(large_assignments)] - | ^^^^^^^^^^^^^^^^^ - -error: moving 10024 bytes - --> $DIR/large_moves.rs:19:13 - | -LL | let z = (x, 42); - | ^^^^^^^ value moved from here - | - = note: The current maximum size is 1000, but it can be customized with the move_size_limit attribute: `#![move_size_limit = "..."]` - -error: moving 10024 bytes - --> $DIR/large_moves.rs:21:13 - | -LL | let a = z.0; - | ^^^ value moved from here - | - = note: The current maximum size is 1000, but it can be customized with the move_size_limit attribute: `#![move_size_limit = "..."]` - -error: aborting due to 3 previous errors - diff --git a/tests/ui/async-await/large_moves.rs b/tests/ui/async-await/large_moves.rs deleted file mode 100644 index c8ed6bafe..000000000 --- a/tests/ui/async-await/large_moves.rs +++ /dev/null @@ -1,27 +0,0 @@ -#![deny(large_assignments)] -#![feature(large_assignments)] -#![cfg_attr(attribute, move_size_limit = "1000")] -// build-fail -// only-x86_64 -// revisions: attribute option -// [option]compile-flags: -Zmove-size-limit=1000 - -// edition:2018 -// compile-flags: -Zmir-opt-level=0 - -fn main() { - let x = async { - let y = [0; 9999]; - dbg!(y); - thing(&y).await; - dbg!(y); - }; - let z = (x, 42); //~ ERROR large_assignments - //~^ ERROR large_assignments - let a = z.0; //~ ERROR large_assignments - let b = z.1; -} - -async fn thing(y: &[u8]) { - dbg!(y); -} diff --git a/tests/ui/async-await/missed-capture-issue-107414.rs b/tests/ui/async-await/missed-capture-issue-107414.rs index 0ab4f5ade..bb14eb74b 100644 --- a/tests/ui/async-await/missed-capture-issue-107414.rs +++ b/tests/ui/async-await/missed-capture-issue-107414.rs @@ -1,6 +1,8 @@ // check-pass // edition:2018 +#![feature(if_let_guard)] + fn main() {} struct StructA {} @@ -22,3 +24,10 @@ async fn ice() { _ => {} } } + +async fn if_let() { + match Some(StructB {}) { + Some(struct_b) if let true = get_struct_a_async().await.fn_taking_struct_b(&struct_b) => {} + _ => {} + } +} diff --git a/tests/ui/async-await/mutually-recursive-async-impl-trait-type.drop_tracking.stderr b/tests/ui/async-await/mutually-recursive-async-impl-trait-type.drop_tracking.stderr deleted file mode 100644 index 8a7317bb9..000000000 --- a/tests/ui/async-await/mutually-recursive-async-impl-trait-type.drop_tracking.stderr +++ /dev/null @@ -1,21 +0,0 @@ -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`. diff --git a/tests/ui/async-await/mutually-recursive-async-impl-trait-type.drop_tracking_mir.stderr b/tests/ui/async-await/mutually-recursive-async-impl-trait-type.drop_tracking_mir.stderr deleted file mode 100644 index 8a7317bb9..000000000 --- a/tests/ui/async-await/mutually-recursive-async-impl-trait-type.drop_tracking_mir.stderr +++ /dev/null @@ -1,21 +0,0 @@ -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`. diff --git a/tests/ui/async-await/mutually-recursive-async-impl-trait-type.no_drop_tracking.stderr b/tests/ui/async-await/mutually-recursive-async-impl-trait-type.no_drop_tracking.stderr deleted file mode 100644 index 8a7317bb9..000000000 --- a/tests/ui/async-await/mutually-recursive-async-impl-trait-type.no_drop_tracking.stderr +++ /dev/null @@ -1,21 +0,0 @@ -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`. diff --git a/tests/ui/async-await/mutually-recursive-async-impl-trait-type.rs b/tests/ui/async-await/mutually-recursive-async-impl-trait-type.rs index a241f30e7..bb2a61f03 100644 --- a/tests/ui/async-await/mutually-recursive-async-impl-trait-type.rs +++ b/tests/ui/async-await/mutually-recursive-async-impl-trait-type.rs @@ -1,7 +1,3 @@ -// 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`. diff --git a/tests/ui/async-await/mutually-recursive-async-impl-trait-type.stderr b/tests/ui/async-await/mutually-recursive-async-impl-trait-type.stderr new file mode 100644 index 000000000..f789ad2a0 --- /dev/null +++ b/tests/ui/async-await/mutually-recursive-async-impl-trait-type.stderr @@ -0,0 +1,21 @@ +error[E0733]: recursion in an `async fn` requires boxing + --> $DIR/mutually-recursive-async-impl-trait-type.rs:5: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:9: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`. diff --git a/tests/ui/async-await/non-trivial-drop.rs b/tests/ui/async-await/non-trivial-drop.rs index 258da0756..3fed7c972 100644 --- a/tests/ui/async-await/non-trivial-drop.rs +++ b/tests/ui/async-await/non-trivial-drop.rs @@ -1,6 +1,3 @@ -// 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 diff --git a/tests/ui/async-await/partial-drop-partial-reinit.drop_tracking.stderr b/tests/ui/async-await/partial-drop-partial-reinit.drop_tracking.stderr deleted file mode 100644 index 17b4ef7bd..000000000 --- a/tests/ui/async-await/partial-drop-partial-reinit.drop_tracking.stderr +++ /dev/null @@ -1,35 +0,0 @@ -error[E0277]: `NotSend` cannot be sent between threads safely - --> $DIR/partial-drop-partial-reinit.rs:9:16 - | -LL | gimme_send(foo()); - | ---------- ^^^^^ `NotSend` cannot be sent between threads safely - | | - | required by a bound introduced by this call -... -LL | async fn foo() { - | - within this `impl Future<Output = ()>` - | - = help: within `impl Future<Output = ()>`, the trait `Send` is not implemented for `NotSend` - = note: required because it appears within the type `(NotSend,)` - = note: required because it captures the following types: `ResumeTy`, `(NotSend,)`, `()`, `impl Future<Output = ()>` -note: required because it's used within this `async fn` body - --> $DIR/partial-drop-partial-reinit.rs:31:16 - | -LL | async fn foo() { - | ________________^ -LL | | -LL | | -LL | | let mut x = (NotSend {},); -... | -LL | | bar().await; -LL | | } - | |_^ -note: required by a bound in `gimme_send` - --> $DIR/partial-drop-partial-reinit.rs:17:18 - | -LL | fn gimme_send<T: Send>(t: T) { - | ^^^^ required by this bound in `gimme_send` - -error: aborting due to previous error - -For more information about this error, try `rustc --explain E0277`. diff --git a/tests/ui/async-await/partial-drop-partial-reinit.no_drop_tracking.stderr b/tests/ui/async-await/partial-drop-partial-reinit.no_drop_tracking.stderr deleted file mode 100644 index 34d8a159f..000000000 --- a/tests/ui/async-await/partial-drop-partial-reinit.no_drop_tracking.stderr +++ /dev/null @@ -1,35 +0,0 @@ -error[E0277]: `NotSend` cannot be sent between threads safely - --> $DIR/partial-drop-partial-reinit.rs:9:16 - | -LL | gimme_send(foo()); - | ---------- ^^^^^ `NotSend` cannot be sent between threads safely - | | - | required by a bound introduced by this call -... -LL | async fn foo() { - | - within this `impl Future<Output = ()>` - | - = help: within `impl Future<Output = ()>`, the trait `Send` is not implemented for `NotSend` - = note: required because it appears within the type `(NotSend,)` - = note: required because it captures the following types: `ResumeTy`, `(NotSend,)`, `impl Future<Output = ()>`, `()` -note: required because it's used within this `async fn` body - --> $DIR/partial-drop-partial-reinit.rs:31:16 - | -LL | async fn foo() { - | ________________^ -LL | | -LL | | -LL | | let mut x = (NotSend {},); -... | -LL | | bar().await; -LL | | } - | |_^ -note: required by a bound in `gimme_send` - --> $DIR/partial-drop-partial-reinit.rs:17:18 - | -LL | fn gimme_send<T: Send>(t: T) { - | ^^^^ required by this bound in `gimme_send` - -error: aborting due to previous error - -For more information about this error, try `rustc --explain E0277`. diff --git a/tests/ui/async-await/partial-drop-partial-reinit.rs b/tests/ui/async-await/partial-drop-partial-reinit.rs index 7d097e72f..75acb442e 100644 --- a/tests/ui/async-await/partial-drop-partial-reinit.rs +++ b/tests/ui/async-await/partial-drop-partial-reinit.rs @@ -1,7 +1,4 @@ // edition:2021 -// revisions: no_drop_tracking drop_tracking -// [drop_tracking] compile-flags: -Zdrop-tracking=yes -// [no_drop_tracking] compile-flags: -Zdrop-tracking=no #![feature(negative_impls)] #![allow(unused)] diff --git a/tests/ui/async-await/partial-drop-partial-reinit.stderr b/tests/ui/async-await/partial-drop-partial-reinit.stderr new file mode 100644 index 000000000..85e1830c7 --- /dev/null +++ b/tests/ui/async-await/partial-drop-partial-reinit.stderr @@ -0,0 +1,35 @@ +error[E0277]: `NotSend` cannot be sent between threads safely + --> $DIR/partial-drop-partial-reinit.rs:6:16 + | +LL | gimme_send(foo()); + | ---------- ^^^^^ `NotSend` cannot be sent between threads safely + | | + | required by a bound introduced by this call +... +LL | async fn foo() { + | - within this `impl Future<Output = ()>` + | + = help: within `impl Future<Output = ()>`, the trait `Send` is not implemented for `NotSend` + = note: required because it appears within the type `(NotSend,)` + = note: required because it captures the following types: `(NotSend,)`, `impl Future<Output = ()>` +note: required because it's used within this `async fn` body + --> $DIR/partial-drop-partial-reinit.rs:28:16 + | +LL | async fn foo() { + | ________________^ +LL | | +LL | | +LL | | let mut x = (NotSend {},); +... | +LL | | bar().await; +LL | | } + | |_^ +note: required by a bound in `gimme_send` + --> $DIR/partial-drop-partial-reinit.rs:14:18 + | +LL | fn gimme_send<T: Send>(t: T) { + | ^^^^ required by this bound in `gimme_send` + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0277`. diff --git a/tests/ui/async-await/recursive-async-impl-trait-type.drop_tracking.stderr b/tests/ui/async-await/recursive-async-impl-trait-type.drop_tracking.stderr deleted file mode 100644 index 7e63a8da5..000000000 --- a/tests/ui/async-await/recursive-async-impl-trait-type.drop_tracking.stderr +++ /dev/null @@ -1,12 +0,0 @@ -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`. diff --git a/tests/ui/async-await/recursive-async-impl-trait-type.drop_tracking_mir.stderr b/tests/ui/async-await/recursive-async-impl-trait-type.drop_tracking_mir.stderr deleted file mode 100644 index 7e63a8da5..000000000 --- a/tests/ui/async-await/recursive-async-impl-trait-type.drop_tracking_mir.stderr +++ /dev/null @@ -1,12 +0,0 @@ -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`. diff --git a/tests/ui/async-await/recursive-async-impl-trait-type.no_drop_tracking.stderr b/tests/ui/async-await/recursive-async-impl-trait-type.no_drop_tracking.stderr deleted file mode 100644 index 7e63a8da5..000000000 --- a/tests/ui/async-await/recursive-async-impl-trait-type.no_drop_tracking.stderr +++ /dev/null @@ -1,12 +0,0 @@ -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`. diff --git a/tests/ui/async-await/recursive-async-impl-trait-type.rs b/tests/ui/async-await/recursive-async-impl-trait-type.rs index 60b34d3a1..edc4cb8ac 100644 --- a/tests/ui/async-await/recursive-async-impl-trait-type.rs +++ b/tests/ui/async-await/recursive-async-impl-trait-type.rs @@ -1,6 +1,3 @@ -// 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`. diff --git a/tests/ui/async-await/recursive-async-impl-trait-type.stderr b/tests/ui/async-await/recursive-async-impl-trait-type.stderr new file mode 100644 index 000000000..63f64f445 --- /dev/null +++ b/tests/ui/async-await/recursive-async-impl-trait-type.stderr @@ -0,0 +1,12 @@ +error[E0733]: recursion in an `async fn` requires boxing + --> $DIR/recursive-async-impl-trait-type.rs:5: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`. diff --git a/tests/ui/async-await/return-type-notation/issue-110963-early.current.stderr b/tests/ui/async-await/return-type-notation/issue-110963-early.current.stderr index 1b847b59e..77385e966 100644 --- a/tests/ui/async-await/return-type-notation/issue-110963-early.current.stderr +++ b/tests/ui/async-await/return-type-notation/issue-110963-early.current.stderr @@ -7,7 +7,7 @@ LL | #![feature(return_type_notation)] = note: see issue #109417 <https://github.com/rust-lang/rust/issues/109417> for more information = note: `#[warn(incomplete_features)]` on by default -error: higher-ranked lifetime error +error[E0308]: mismatched types --> $DIR/issue-110963-early.rs:17:5 | LL | / spawn(async move { @@ -16,11 +16,17 @@ LL | | if !hc.check().await { LL | | log_health_check_failure().await; LL | | } LL | | }); - | |______^ + | |______^ one type is more general than the other | - = note: could not prove `[async block@$DIR/issue-110963-early.rs:17:11: 22:6]: Send` + = note: expected trait `Send` + found trait `for<'a> Send` +note: the lifetime requirement is introduced here + --> $DIR/issue-110963-early.rs:37:17 + | +LL | F: Future + Send + 'static, + | ^^^^ -error: higher-ranked lifetime error +error[E0308]: mismatched types --> $DIR/issue-110963-early.rs:17:5 | LL | / spawn(async move { @@ -29,9 +35,16 @@ LL | | if !hc.check().await { LL | | log_health_check_failure().await; LL | | } LL | | }); - | |______^ + | |______^ one type is more general than the other + | + = note: expected trait `Send` + found trait `for<'a> Send` +note: the lifetime requirement is introduced here + --> $DIR/issue-110963-early.rs:37:17 | - = note: could not prove `[async block@$DIR/issue-110963-early.rs:17:11: 22:6]: Send` +LL | F: Future + Send + 'static, + | ^^^^ error: aborting due to 2 previous errors; 1 warning emitted +For more information about this error, try `rustc --explain E0308`. diff --git a/tests/ui/async-await/return-type-notation/issue-110963-early.next.stderr b/tests/ui/async-await/return-type-notation/issue-110963-early.next.stderr index 1b847b59e..77385e966 100644 --- a/tests/ui/async-await/return-type-notation/issue-110963-early.next.stderr +++ b/tests/ui/async-await/return-type-notation/issue-110963-early.next.stderr @@ -7,7 +7,7 @@ LL | #![feature(return_type_notation)] = note: see issue #109417 <https://github.com/rust-lang/rust/issues/109417> for more information = note: `#[warn(incomplete_features)]` on by default -error: higher-ranked lifetime error +error[E0308]: mismatched types --> $DIR/issue-110963-early.rs:17:5 | LL | / spawn(async move { @@ -16,11 +16,17 @@ LL | | if !hc.check().await { LL | | log_health_check_failure().await; LL | | } LL | | }); - | |______^ + | |______^ one type is more general than the other | - = note: could not prove `[async block@$DIR/issue-110963-early.rs:17:11: 22:6]: Send` + = note: expected trait `Send` + found trait `for<'a> Send` +note: the lifetime requirement is introduced here + --> $DIR/issue-110963-early.rs:37:17 + | +LL | F: Future + Send + 'static, + | ^^^^ -error: higher-ranked lifetime error +error[E0308]: mismatched types --> $DIR/issue-110963-early.rs:17:5 | LL | / spawn(async move { @@ -29,9 +35,16 @@ LL | | if !hc.check().await { LL | | log_health_check_failure().await; LL | | } LL | | }); - | |______^ + | |______^ one type is more general than the other + | + = note: expected trait `Send` + found trait `for<'a> Send` +note: the lifetime requirement is introduced here + --> $DIR/issue-110963-early.rs:37:17 | - = note: could not prove `[async block@$DIR/issue-110963-early.rs:17:11: 22:6]: Send` +LL | F: Future + Send + 'static, + | ^^^^ error: aborting due to 2 previous errors; 1 warning emitted +For more information about this error, try `rustc --explain E0308`. diff --git a/tests/ui/async-await/return-type-notation/issue-110963-early.stderr b/tests/ui/async-await/return-type-notation/issue-110963-early.stderr index 33e22dec3..969094a2c 100644 --- a/tests/ui/async-await/return-type-notation/issue-110963-early.stderr +++ b/tests/ui/async-await/return-type-notation/issue-110963-early.stderr @@ -7,7 +7,7 @@ LL | #![feature(return_type_notation)] = note: see issue #109417 <https://github.com/rust-lang/rust/issues/109417> for more information = note: `#[warn(incomplete_features)]` on by default -error: higher-ranked lifetime error +error[E0308]: mismatched types --> $DIR/issue-110963-early.rs:15:5 | LL | / spawn(async move { @@ -16,11 +16,17 @@ LL | | if !hc.check().await { LL | | log_health_check_failure().await; LL | | } LL | | }); - | |______^ + | |______^ one type is more general than the other | - = note: could not prove `[async block@$DIR/issue-110963-early.rs:15:11: 20:6]: Send` + = note: expected trait `Send` + found trait `for<'a> Send` +note: the lifetime requirement is introduced here + --> $DIR/issue-110963-early.rs:35:17 + | +LL | F: Future + Send + 'static, + | ^^^^ -error: higher-ranked lifetime error +error[E0308]: mismatched types --> $DIR/issue-110963-early.rs:15:5 | LL | / spawn(async move { @@ -29,9 +35,16 @@ LL | | if !hc.check().await { LL | | log_health_check_failure().await; LL | | } LL | | }); - | |______^ + | |______^ one type is more general than the other + | + = note: expected trait `Send` + found trait `for<'a> Send` +note: the lifetime requirement is introduced here + --> $DIR/issue-110963-early.rs:35:17 | - = note: could not prove `[async block@$DIR/issue-110963-early.rs:15:11: 20:6]: Send` +LL | F: Future + Send + 'static, + | ^^^^ error: aborting due to 2 previous errors; 1 warning emitted +For more information about this error, try `rustc --explain E0308`. diff --git a/tests/ui/async-await/return-type-notation/normalizing-self-auto-trait-issue-109924.current.stderr b/tests/ui/async-await/return-type-notation/normalizing-self-auto-trait-issue-109924.current.stderr new file mode 100644 index 000000000..8f4590203 --- /dev/null +++ b/tests/ui/async-await/return-type-notation/normalizing-self-auto-trait-issue-109924.current.stderr @@ -0,0 +1,35 @@ +warning: the feature `return_type_notation` is incomplete and may not be safe to use and/or cause compiler crashes + --> $DIR/normalizing-self-auto-trait-issue-109924.rs:8:12 + | +LL | #![feature(return_type_notation)] + | ^^^^^^^^^^^^^^^^^^^^ + | + = note: see issue #109417 <https://github.com/rust-lang/rust/issues/109417> for more information + = note: `#[warn(incomplete_features)]` on by default + +error[E0277]: `impl Future<Output = ()> { <_ as Foo>::bar() }` cannot be sent between threads safely + --> $DIR/normalizing-self-auto-trait-issue-109924.rs:23:11 + | +LL | build(Bar); + | ----- ^^^ `impl Future<Output = ()> { <_ as Foo>::bar() }` cannot be sent between threads safely + | | + | required by a bound introduced by this call + | + = help: the trait `for<'a> Send` is not implemented for `impl Future<Output = ()> { <_ as Foo>::bar() }` +note: this is a known limitation of the trait solver that will be lifted in the future + --> $DIR/normalizing-self-auto-trait-issue-109924.rs:23:11 + | +LL | build(Bar); + | ------^^^- + | | | + | | the trait solver is unable to infer the generic types that should be inferred from this argument + | add turbofish arguments to this call to specify the types manually, even if it's redundant +note: required by a bound in `build` + --> $DIR/normalizing-self-auto-trait-issue-109924.rs:20:39 + | +LL | fn build<T>(_: T) where T: Foo<bar(): Send> {} + | ^^^^ required by this bound in `build` + +error: aborting due to previous error; 1 warning emitted + +For more information about this error, try `rustc --explain E0277`. diff --git a/tests/ui/async-await/return-type-notation/normalizing-self-auto-trait-issue-109924.next.stderr b/tests/ui/async-await/return-type-notation/normalizing-self-auto-trait-issue-109924.next.stderr new file mode 100644 index 000000000..6fab71787 --- /dev/null +++ b/tests/ui/async-await/return-type-notation/normalizing-self-auto-trait-issue-109924.next.stderr @@ -0,0 +1,11 @@ +warning: the feature `return_type_notation` is incomplete and may not be safe to use and/or cause compiler crashes + --> $DIR/normalizing-self-auto-trait-issue-109924.rs:8:12 + | +LL | #![feature(return_type_notation)] + | ^^^^^^^^^^^^^^^^^^^^ + | + = note: see issue #109417 <https://github.com/rust-lang/rust/issues/109417> for more information + = note: `#[warn(incomplete_features)]` on by default + +warning: 1 warning emitted + diff --git a/tests/ui/async-await/return-type-notation/normalizing-self-auto-trait-issue-109924.rs b/tests/ui/async-await/return-type-notation/normalizing-self-auto-trait-issue-109924.rs new file mode 100644 index 000000000..b2cd9707d --- /dev/null +++ b/tests/ui/async-await/return-type-notation/normalizing-self-auto-trait-issue-109924.rs @@ -0,0 +1,24 @@ +// revisions: current next +//[current] known-bug: #109924 +//[next] check-pass +//[next] compile-flags: -Ztrait-solver=next +// edition:2021 + +#![feature(async_fn_in_trait)] +#![feature(return_type_notation)] +//[next]~^ WARN the feature `return_type_notation` is incomplete + +trait Foo { + async fn bar(&self); +} + +struct Bar; +impl Foo for Bar { + async fn bar(&self) {} +} + +fn build<T>(_: T) where T: Foo<bar(): Send> {} + +fn main() { + build(Bar); +} diff --git a/tests/ui/async-await/unresolved_type_param.drop_tracking.stderr b/tests/ui/async-await/unresolved_type_param.drop_tracking.stderr deleted file mode 100644 index 6b4a3a363..000000000 --- a/tests/ui/async-await/unresolved_type_param.drop_tracking.stderr +++ /dev/null @@ -1,39 +0,0 @@ -error[E0698]: type inside `async fn` body must be known in this context - --> $DIR/unresolved_type_param.rs:12:5 - | -LL | bar().await; - | ^^^ cannot infer type for type parameter `T` declared on the function `bar` - | -note: the type is part of the `async fn` body because of this `await` - --> $DIR/unresolved_type_param.rs:12:11 - | -LL | bar().await; - | ^^^^^ - -error[E0698]: type inside `async fn` body must be known in this context - --> $DIR/unresolved_type_param.rs:12:5 - | -LL | bar().await; - | ^^^ cannot infer type for type parameter `T` declared on the function `bar` - | -note: the type is part of the `async fn` body because of this `await` - --> $DIR/unresolved_type_param.rs:12:11 - | -LL | bar().await; - | ^^^^^ - -error[E0698]: type inside `async fn` body must be known in this context - --> $DIR/unresolved_type_param.rs:12:5 - | -LL | bar().await; - | ^^^ cannot infer type for type parameter `T` declared on the function `bar` - | -note: the type is part of the `async fn` body because of this `await` - --> $DIR/unresolved_type_param.rs:12:11 - | -LL | bar().await; - | ^^^^^ - -error: aborting due to 3 previous errors - -For more information about this error, try `rustc --explain E0698`. diff --git a/tests/ui/async-await/unresolved_type_param.drop_tracking_mir.stderr b/tests/ui/async-await/unresolved_type_param.drop_tracking_mir.stderr deleted file mode 100644 index 95c799468..000000000 --- a/tests/ui/async-await/unresolved_type_param.drop_tracking_mir.stderr +++ /dev/null @@ -1,14 +0,0 @@ -error[E0282]: type annotations needed - --> $DIR/unresolved_type_param.rs:12:5 - | -LL | bar().await; - | ^^^ cannot infer type of the type parameter `T` declared on the function `bar` - | -help: consider specifying the generic argument - | -LL | bar::<T>().await; - | +++++ - -error: aborting due to previous error - -For more information about this error, try `rustc --explain E0282`. diff --git a/tests/ui/async-await/unresolved_type_param.no_drop_tracking.stderr b/tests/ui/async-await/unresolved_type_param.no_drop_tracking.stderr deleted file mode 100644 index 6642e90ac..000000000 --- a/tests/ui/async-await/unresolved_type_param.no_drop_tracking.stderr +++ /dev/null @@ -1,63 +0,0 @@ -error[E0698]: type inside `async fn` body must be known in this context - --> $DIR/unresolved_type_param.rs:12:5 - | -LL | bar().await; - | ^^^ cannot infer type for type parameter `T` declared on the function `bar` - | -note: the type is part of the `async fn` body because of this `await` - --> $DIR/unresolved_type_param.rs:12:11 - | -LL | bar().await; - | ^^^^^ - -error[E0698]: type inside `async fn` body must be known in this context - --> $DIR/unresolved_type_param.rs:12:5 - | -LL | bar().await; - | ^^^ cannot infer type for type parameter `T` declared on the function `bar` - | -note: the type is part of the `async fn` body because of this `await` - --> $DIR/unresolved_type_param.rs:12:11 - | -LL | bar().await; - | ^^^^^ - -error[E0698]: type inside `async fn` body must be known in this context - --> $DIR/unresolved_type_param.rs:12:5 - | -LL | bar().await; - | ^^^ cannot infer type for type parameter `T` declared on the function `bar` - | -note: the type is part of the `async fn` body because of this `await` - --> $DIR/unresolved_type_param.rs:12:11 - | -LL | bar().await; - | ^^^^^ - -error[E0698]: type inside `async fn` body must be known in this context - --> $DIR/unresolved_type_param.rs:12:5 - | -LL | bar().await; - | ^^^ cannot infer type for type parameter `T` declared on the function `bar` - | -note: the type is part of the `async fn` body because of this `await` - --> $DIR/unresolved_type_param.rs:12:11 - | -LL | bar().await; - | ^^^^^ - -error[E0698]: type inside `async fn` body must be known in this context - --> $DIR/unresolved_type_param.rs:12:5 - | -LL | bar().await; - | ^^^ cannot infer type for type parameter `T` declared on the function `bar` - | -note: the type is part of the `async fn` body because of this `await` - --> $DIR/unresolved_type_param.rs:12:11 - | -LL | bar().await; - | ^^^^^ - -error: aborting due to 5 previous errors - -For more information about this error, try `rustc --explain E0698`. diff --git a/tests/ui/async-await/unresolved_type_param.rs b/tests/ui/async-await/unresolved_type_param.rs index ca0a92b94..dd5aa0dd0 100644 --- a/tests/ui/async-await/unresolved_type_param.rs +++ b/tests/ui/async-await/unresolved_type_param.rs @@ -1,6 +1,3 @@ -// 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) @@ -10,27 +7,6 @@ async fn bar<T>() -> () {} async fn foo() { bar().await; - //[drop_tracking_mir]~^ ERROR type annotations needed - //[drop_tracking_mir]~| NOTE cannot infer type of the type parameter `T` - //[no_drop_tracking,drop_tracking]~^^^ ERROR type inside `async fn` body must be known in this context - //[no_drop_tracking,drop_tracking]~| ERROR type inside `async fn` body must be known in this context - //[no_drop_tracking,drop_tracking]~| ERROR type inside `async fn` body must be known in this context - //[no_drop_tracking,drop_tracking]~| NOTE cannot infer type for type parameter `T` - //[no_drop_tracking,drop_tracking]~| NOTE cannot infer type for type parameter `T` - //[no_drop_tracking,drop_tracking]~| NOTE cannot infer type for type parameter `T` - //[no_drop_tracking,drop_tracking]~| NOTE the type is part of the `async fn` body because of this `await` - //[no_drop_tracking,drop_tracking]~| NOTE the type is part of the `async fn` body because of this `await` - //[no_drop_tracking,drop_tracking]~| NOTE the type is part of the `async fn` body because of this `await` - //[no_drop_tracking,drop_tracking]~| NOTE in this expansion of desugaring of `await` - //[no_drop_tracking,drop_tracking]~| NOTE in this expansion of desugaring of `await` - //[no_drop_tracking,drop_tracking]~| NOTE in this expansion of desugaring of `await` - //[no_drop_tracking]~^^^^^^^^^^^^^^^ ERROR type inside `async fn` body must be known in this context - //[no_drop_tracking]~| ERROR type inside `async fn` body must be known in this context - //[no_drop_tracking]~| NOTE cannot infer type for type parameter `T` - //[no_drop_tracking]~| NOTE cannot infer type for type parameter `T` - //[no_drop_tracking]~| NOTE the type is part of the `async fn` body because of this `await` - //[no_drop_tracking]~| NOTE the type is part of the `async fn` body because of this `await` - //[no_drop_tracking]~| NOTE in this expansion of desugaring of `await` - //[no_drop_tracking]~| NOTE in this expansion of desugaring of `await` + //~^ ERROR type annotations needed } fn main() {} diff --git a/tests/ui/async-await/unresolved_type_param.stderr b/tests/ui/async-await/unresolved_type_param.stderr new file mode 100644 index 000000000..45aa76606 --- /dev/null +++ b/tests/ui/async-await/unresolved_type_param.stderr @@ -0,0 +1,14 @@ +error[E0282]: type annotations needed + --> $DIR/unresolved_type_param.rs:9:5 + | +LL | bar().await; + | ^^^ cannot infer type of the type parameter `T` declared on the function `bar` + | +help: consider specifying the generic argument + | +LL | bar::<T>().await; + | +++++ + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0282`. diff --git a/tests/ui/async-await/unsized-across-await.rs b/tests/ui/async-await/unsized-across-await.rs new file mode 100644 index 000000000..32cb4f88e --- /dev/null +++ b/tests/ui/async-await/unsized-across-await.rs @@ -0,0 +1,16 @@ +// edition: 2021 + +#![feature(unsized_locals)] +//~^ WARN the feature `unsized_locals` is incomplete + +async fn f() {} + +async fn g(x: Box<dyn std::fmt::Display>) { + let _x = *x; + //~^ ERROR the size for values of type `dyn std::fmt::Display` cannot be known at compilation time + f().await; +} + +fn main() { + let _a = g(Box::new(5)); +} diff --git a/tests/ui/async-await/unsized-across-await.stderr b/tests/ui/async-await/unsized-across-await.stderr new file mode 100644 index 000000000..649b12ce5 --- /dev/null +++ b/tests/ui/async-await/unsized-across-await.stderr @@ -0,0 +1,21 @@ +warning: the feature `unsized_locals` is incomplete and may not be safe to use and/or cause compiler crashes + --> $DIR/unsized-across-await.rs:3:12 + | +LL | #![feature(unsized_locals)] + | ^^^^^^^^^^^^^^ + | + = note: see issue #48055 <https://github.com/rust-lang/rust/issues/48055> for more information + = note: `#[warn(incomplete_features)]` on by default + +error[E0277]: the size for values of type `dyn std::fmt::Display` cannot be known at compilation time + --> $DIR/unsized-across-await.rs:9:9 + | +LL | let _x = *x; + | ^^ doesn't have a size known at compile-time + | + = help: the trait `Sized` is not implemented for `dyn std::fmt::Display` + = note: all values live across `await` must have a statically known size + +error: aborting due to previous error; 1 warning emitted + +For more information about this error, try `rustc --explain E0277`. |