summaryrefslogtreecommitdiffstats
path: root/src/test/ui/async-await
diff options
context:
space:
mode:
Diffstat (limited to 'src/test/ui/async-await')
-rw-r--r--src/test/ui/async-await/async-await-let-else.drop-tracking.stderr110
-rw-r--r--src/test/ui/async-await/async-await-let-else.no-drop-tracking.stderr (renamed from src/test/ui/async-await/async-await-let-else.stderr)28
-rw-r--r--src/test/ui/async-await/async-await-let-else.rs13
-rw-r--r--src/test/ui/async-await/async-block-control-flow-static-semantics.rs8
-rw-r--r--src/test/ui/async-await/async-block-control-flow-static-semantics.stderr8
-rw-r--r--src/test/ui/async-await/async-trait-fn.rs3
-rw-r--r--src/test/ui/async-await/async-trait-fn.stderr75
-rw-r--r--src/test/ui/async-await/edition-deny-async-fns-2015.rs3
-rw-r--r--src/test/ui/async-await/edition-deny-async-fns-2015.stderr30
-rw-r--r--src/test/ui/async-await/generator-desc.stderr4
-rw-r--r--src/test/ui/async-await/issue-101715.rs17
-rw-r--r--src/test/ui/async-await/issue-101715.stderr16
-rw-r--r--src/test/ui/async-await/issue-64130-4-async-move.drop-tracking.stderr (renamed from src/test/ui/async-await/issue-64130-4-async-move.stderr)6
-rw-r--r--src/test/ui/async-await/issue-64130-4-async-move.no_drop_tracking.stderr26
-rw-r--r--src/test/ui/async-await/issue-64130-4-async-move.rs10
-rw-r--r--src/test/ui/async-await/issue-67252-unnamed-future.stderr10
-rw-r--r--src/test/ui/async-await/issue-68112.drop_tracking.stderr79
-rw-r--r--src/test/ui/async-await/issue-68112.no_drop_tracking.stderr (renamed from src/test/ui/async-await/issue-68112.stderr)39
-rw-r--r--src/test/ui/async-await/issue-68112.rs11
-rw-r--r--src/test/ui/async-await/issue-70594.stderr12
-rw-r--r--src/test/ui/async-await/issue-70935-complex-spans.drop_tracking.stderr10
-rw-r--r--src/test/ui/async-await/issue-70935-complex-spans.no_drop_tracking.stderr (renamed from src/test/ui/async-await/issue-70935-complex-spans.normal.stderr)8
-rw-r--r--src/test/ui/async-await/issue-70935-complex-spans.rs5
-rw-r--r--src/test/ui/async-await/issue-73137.rs3
-rw-r--r--src/test/ui/async-await/issues/issue-62009-1.stderr14
-rw-r--r--src/test/ui/async-await/issues/issue-65436-raw-ptr-not-send.no_drop_tracking.stderr (renamed from src/test/ui/async-await/issues/issue-65436-raw-ptr-not-send.stderr)18
-rw-r--r--src/test/ui/async-await/issues/issue-65436-raw-ptr-not-send.rs6
-rw-r--r--src/test/ui/async-await/issues/issue-95307.stderr14
-rw-r--r--src/test/ui/async-await/partial-drop-partial-reinit.drop_tracking.stderr35
-rw-r--r--src/test/ui/async-await/partial-drop-partial-reinit.no_drop_tracking.stderr (renamed from src/test/ui/async-await/partial-drop-partial-reinit.stderr)6
-rw-r--r--src/test/ui/async-await/partial-drop-partial-reinit.rs11
-rw-r--r--src/test/ui/async-await/unnecessary-await.stderr2
32 files changed, 514 insertions, 126 deletions
diff --git a/src/test/ui/async-await/async-await-let-else.drop-tracking.stderr b/src/test/ui/async-await/async-await-let-else.drop-tracking.stderr
new file mode 100644
index 000000000..3be7f370d
--- /dev/null
+++ b/src/test/ui/async-await/async-await-let-else.drop-tracking.stderr
@@ -0,0 +1,110 @@
+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);
+ | ----------- ^^^^^^ await occurs here, with `Rc::new(())` maybe used later
+ | |
+ | has type `Rc<()>` which is not `Send`
+note: `Rc::new(())` is later dropped here
+ --> $DIR/async-await-let-else.rs:33:35
+ |
+LL | (Rc::new(()), bar().await);
+ | ^
+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/src/test/ui/async-await/async-await-let-else.stderr b/src/test/ui/async-await/async-await-let-else.no-drop-tracking.stderr
index 4d23e27c4..7f93563e2 100644
--- a/src/test/ui/async-await/async-await-let-else.stderr
+++ b/src/test/ui/async-await/async-await-let-else.no-drop-tracking.stderr
@@ -1,12 +1,12 @@
error: future cannot be sent between threads safely
- --> $DIR/async-await-let-else.rs:45:13
+ --> $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:8:14
+ --> $DIR/async-await-let-else.rs:11:14
|
LL | let r = Rc::new(());
| - has type `Rc<()>` which is not `Send`
@@ -15,67 +15,67 @@ LL | bar().await
LL | };
| - `r` is later dropped here
note: required by a bound in `is_send`
- --> $DIR/async-await-let-else.rs:16:15
+ --> $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:47:13
+ --> $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:20:26
+ --> $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
+ | - `Rc::new(())` is later dropped here
note: required by a bound in `is_send`
- --> $DIR/async-await-let-else.rs:16:15
+ --> $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:49:13
+ --> $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:30:28
+ --> $DIR/async-await-let-else.rs:33:28
|
LL | (Rc::new(()), bar().await);
| ----------- ^^^^^^ await occurs here, with `Rc::new(())` maybe used later
| |
| has type `Rc<()>` which is not `Send`
note: `Rc::new(())` is later dropped here
- --> $DIR/async-await-let-else.rs:30:35
+ --> $DIR/async-await-let-else.rs:33:35
|
LL | (Rc::new(()), bar().await);
| ^
note: required by a bound in `is_send`
- --> $DIR/async-await-let-else.rs:16:15
+ --> $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:51:13
+ --> $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:38:14
+ --> $DIR/async-await-let-else.rs:41:14
|
LL | let r = Rc::new(());
| - has type `Rc<()>` which is not `Send`
@@ -85,7 +85,7 @@ LL | bar().await;
LL | };
| - `r` is later dropped here
note: required by a bound in `is_send`
- --> $DIR/async-await-let-else.rs:16:15
+ --> $DIR/async-await-let-else.rs:19:15
|
LL | fn is_send<T: Send>(_: T) {}
| ^^^^ required by this bound in `is_send`
diff --git a/src/test/ui/async-await/async-await-let-else.rs b/src/test/ui/async-await/async-await-let-else.rs
index 7ea07ae9a..3fb2142b9 100644
--- a/src/test/ui/async-await/async-await-let-else.rs
+++ b/src/test/ui/async-await/async-await-let-else.rs
@@ -1,5 +1,8 @@
// edition:2021
-#![feature(let_else)]
+// revisions: drop-tracking no-drop-tracking
+// [drop-tracking] compile-flags: -Zdrop-tracking=yes
+// [no-drop-tracking] compile-flags: -Zdrop-tracking=no
+
use std::rc::Rc;
async fn foo(x: Option<bool>) {
@@ -43,11 +46,11 @@ async fn foo4(x: Option<bool>) {
fn main() {
is_send(foo(Some(true)));
- //~^ ERROR future cannot be sent between threads safely
+ //~^ ERROR cannot be sent between threads safely
is_send(foo2(Some(true)));
- //~^ ERROR future cannot be sent between threads safely
+ //~^ ERROR cannot be sent between threads safely
is_send(foo3(Some(true)));
- //~^ ERROR future cannot be sent between threads safely
+ //~^ ERROR cannot be sent between threads safely
is_send(foo4(Some(true)));
- //~^ ERROR future cannot be sent between threads safely
+ //~^ ERROR cannot be sent between threads safely
}
diff --git a/src/test/ui/async-await/async-block-control-flow-static-semantics.rs b/src/test/ui/async-await/async-block-control-flow-static-semantics.rs
index b831d6102..446212ca7 100644
--- a/src/test/ui/async-await/async-block-control-flow-static-semantics.rs
+++ b/src/test/ui/async-await/async-block-control-flow-static-semantics.rs
@@ -15,7 +15,7 @@ fn return_targets_async_block_not_fn() -> u8 {
return 0u8;
};
let _: &dyn Future<Output = ()> = &block;
- //~^ ERROR type mismatch
+ //~^ ERROR expected `impl Future<Output = u8>` to be a future that resolves to `()`, but it resolves to `u8`
}
async fn return_targets_async_block_not_async_fn() -> u8 {
@@ -24,7 +24,7 @@ async fn return_targets_async_block_not_async_fn() -> u8 {
return 0u8;
};
let _: &dyn Future<Output = ()> = &block;
- //~^ ERROR type mismatch resolving `<impl Future<Output = u8> as Future>::Output == ()`
+ //~^ ERROR expected `impl Future<Output = u8>` to be a future that resolves to `()`, but it resolves to `u8`
}
fn no_break_in_async_block() {
@@ -42,7 +42,9 @@ fn no_break_in_async_block_even_with_outer_loop() {
}
struct MyErr;
-fn err() -> Result<u8, MyErr> { Err(MyErr) }
+fn err() -> Result<u8, MyErr> {
+ Err(MyErr)
+}
fn rethrow_targets_async_block_not_fn() -> Result<u8, MyErr> {
//~^ ERROR mismatched types
diff --git a/src/test/ui/async-await/async-block-control-flow-static-semantics.stderr b/src/test/ui/async-await/async-block-control-flow-static-semantics.stderr
index e58876896..2a08d5d6c 100644
--- a/src/test/ui/async-await/async-block-control-flow-static-semantics.stderr
+++ b/src/test/ui/async-await/async-block-control-flow-static-semantics.stderr
@@ -31,7 +31,7 @@ LL | |
LL | | }
| |_^ expected `u8`, found `()`
-error[E0271]: type mismatch resolving `<impl Future<Output = u8> as Future>::Output == ()`
+error[E0271]: expected `impl Future<Output = u8>` 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 = ()> = &block;
@@ -47,7 +47,7 @@ LL | fn return_targets_async_block_not_fn() -> u8 {
| |
| implicitly returns `()` as its body has no tail or `return` expression
-error[E0271]: type mismatch resolving `<impl Future<Output = u8> as Future>::Output == ()`
+error[E0271]: expected `impl Future<Output = u8>` 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 = ()> = &block;
@@ -56,7 +56,7 @@ LL | let _: &dyn Future<Output = ()> = &block;
= note: required for the cast from `impl Future<Output = u8>` to the object type `dyn Future<Output = ()>`
error[E0308]: mismatched types
- --> $DIR/async-block-control-flow-static-semantics.rs:47:44
+ --> $DIR/async-block-control-flow-static-semantics.rs:49:44
|
LL | fn rethrow_targets_async_block_not_fn() -> Result<u8, MyErr> {
| ---------------------------------- ^^^^^^^^^^^^^^^^^ expected enum `Result`, found `()`
@@ -67,7 +67,7 @@ LL | fn rethrow_targets_async_block_not_fn() -> Result<u8, MyErr> {
found unit type `()`
error[E0308]: mismatched types
- --> $DIR/async-block-control-flow-static-semantics.rs:56:50
+ --> $DIR/async-block-control-flow-static-semantics.rs:58:50
|
LL | fn rethrow_targets_async_block_not_async_fn() -> Result<u8, MyErr> {
| ---------------------------------------- ^^^^^^^^^^^^^^^^^ expected enum `Result`, found `()`
diff --git a/src/test/ui/async-await/async-trait-fn.rs b/src/test/ui/async-await/async-trait-fn.rs
index e2062e827..0ea685986 100644
--- a/src/test/ui/async-await/async-trait-fn.rs
+++ b/src/test/ui/async-await/async-trait-fn.rs
@@ -1,8 +1,11 @@
// edition:2018
trait T {
async fn foo() {} //~ ERROR functions in traits cannot be declared `async`
+ //~^ ERROR mismatched types
async fn bar(&self) {} //~ ERROR functions in traits cannot be declared `async`
+ //~^ ERROR mismatched types
async fn baz() { //~ ERROR functions in traits cannot be declared `async`
+ //~^ ERROR mismatched types
// Nested item must not ICE.
fn a() {}
}
diff --git a/src/test/ui/async-await/async-trait-fn.stderr b/src/test/ui/async-await/async-trait-fn.stderr
index 1eb8969a8..e5c584e31 100644
--- a/src/test/ui/async-await/async-trait-fn.stderr
+++ b/src/test/ui/async-await/async-trait-fn.stderr
@@ -2,40 +2,89 @@ error[E0706]: functions in traits cannot be declared `async`
--> $DIR/async-trait-fn.rs:3:5
|
LL | async fn foo() {}
- | -----^^^^^^^^^^^^
+ | -----^^^^^^^^^
| |
| `async` because of this
|
= note: `async` trait functions are not currently supported
= note: consider using the `async-trait` crate: https://crates.io/crates/async-trait
+ = note: see issue #91611 <https://github.com/rust-lang/rust/issues/91611> for more information
+ = help: add `#![feature(return_position_impl_trait_in_trait)]` to the crate attributes to enable
error[E0706]: functions in traits cannot be declared `async`
- --> $DIR/async-trait-fn.rs:4:5
+ --> $DIR/async-trait-fn.rs:5:5
|
LL | async fn bar(&self) {}
- | -----^^^^^^^^^^^^^^^^^
+ | -----^^^^^^^^^^^^^^
| |
| `async` because of this
|
= note: `async` trait functions are not currently supported
= note: consider using the `async-trait` crate: https://crates.io/crates/async-trait
+ = note: see issue #91611 <https://github.com/rust-lang/rust/issues/91611> for more information
+ = help: add `#![feature(return_position_impl_trait_in_trait)]` to the crate attributes to enable
error[E0706]: functions in traits cannot be declared `async`
- --> $DIR/async-trait-fn.rs:5:5
+ --> $DIR/async-trait-fn.rs:7:5
+ |
+LL | async fn baz() {
+ | -----^^^^^^^^^
+ | |
+ | `async` because of this
+ |
+ = note: `async` trait functions are not currently supported
+ = note: consider using the `async-trait` crate: https://crates.io/crates/async-trait
+ = note: see issue #91611 <https://github.com/rust-lang/rust/issues/91611> for more information
+ = help: add `#![feature(return_position_impl_trait_in_trait)]` to the crate attributes to enable
+
+error[E0308]: mismatched types
+ --> $DIR/async-trait-fn.rs:3:20
+ |
+LL | async fn foo() {}
+ | ^^ expected associated type, found opaque type
+ |
+ ::: $SRC_DIR/core/src/future/mod.rs:LL:COL
+ |
+LL | pub const fn from_generator<T>(gen: T) -> impl Future<Output = T::Return>
+ | ------------------------------- the found opaque type
+ |
+ = note: expected associated type `impl Future<Output = ()>` (trait associated opaque type at <$DIR/async-trait-fn.rs:3:20>)
+ found opaque type `impl Future<Output = ()>` (opaque type at <$SRC_DIR/core/src/future/mod.rs:LL:COL>)
+
+error[E0308]: mismatched types
+ --> $DIR/async-trait-fn.rs:5:25
+ |
+LL | async fn bar(&self) {}
+ | ^^ expected associated type, found opaque type
+ |
+ ::: $SRC_DIR/core/src/future/mod.rs:LL:COL
+ |
+LL | pub const fn from_generator<T>(gen: T) -> impl Future<Output = T::Return>
+ | ------------------------------- the found opaque type
+ |
+ = note: expected associated type `impl Future<Output = ()>` (trait associated opaque type at <$DIR/async-trait-fn.rs:5:25>)
+ found opaque type `impl Future<Output = ()>` (opaque type at <$SRC_DIR/core/src/future/mod.rs:LL:COL>)
+
+error[E0308]: mismatched types
+ --> $DIR/async-trait-fn.rs:7:20
|
LL | async fn baz() {
- | ^----
- | |
- | _____`async` because of this
- | |
+ | ____________________^
+LL | |
LL | | // Nested item must not ICE.
LL | | fn a() {}
LL | | }
- | |_____^
+ | |_____^ expected associated type, found opaque type
|
- = note: `async` trait functions are not currently supported
- = note: consider using the `async-trait` crate: https://crates.io/crates/async-trait
+ ::: $SRC_DIR/core/src/future/mod.rs:LL:COL
+ |
+LL | pub const fn from_generator<T>(gen: T) -> impl Future<Output = T::Return>
+ | ------------------------------- the found opaque type
+ |
+ = note: expected associated type `impl Future<Output = ()>` (trait associated opaque type at <$DIR/async-trait-fn.rs:7:20>)
+ found opaque type `impl Future<Output = ()>` (opaque type at <$SRC_DIR/core/src/future/mod.rs:LL:COL>)
-error: aborting due to 3 previous errors
+error: aborting due to 6 previous errors
-For more information about this error, try `rustc --explain E0706`.
+Some errors have detailed explanations: E0308, E0706.
+For more information about an error, try `rustc --explain E0308`.
diff --git a/src/test/ui/async-await/edition-deny-async-fns-2015.rs b/src/test/ui/async-await/edition-deny-async-fns-2015.rs
index e5dc9c8a5..22a61dcd2 100644
--- a/src/test/ui/async-await/edition-deny-async-fns-2015.rs
+++ b/src/test/ui/async-await/edition-deny-async-fns-2015.rs
@@ -16,7 +16,8 @@ impl Foo {
trait Bar {
async fn foo() {} //~ ERROR `async fn` is not permitted in Rust 2015
- //~^ ERROR functions in traits cannot be declared `async`
+ //~^ ERROR functions in traits cannot be declared `async`
+ //~| ERROR mismatched types
}
fn main() {
diff --git a/src/test/ui/async-await/edition-deny-async-fns-2015.stderr b/src/test/ui/async-await/edition-deny-async-fns-2015.stderr
index 35f9c581c..8c2902d9b 100644
--- a/src/test/ui/async-await/edition-deny-async-fns-2015.stderr
+++ b/src/test/ui/async-await/edition-deny-async-fns-2015.stderr
@@ -53,7 +53,7 @@ LL | async fn foo() {}
= note: for more on editions, read https://doc.rust-lang.org/edition-guide
error[E0670]: `async fn` is not permitted in Rust 2015
- --> $DIR/edition-deny-async-fns-2015.rs:36:9
+ --> $DIR/edition-deny-async-fns-2015.rs:37:9
|
LL | async fn bar() {}
| ^^^^^ to use `async fn`, switch to Rust 2018 or later
@@ -62,7 +62,7 @@ LL | async fn bar() {}
= note: for more on editions, read https://doc.rust-lang.org/edition-guide
error[E0670]: `async fn` is not permitted in Rust 2015
- --> $DIR/edition-deny-async-fns-2015.rs:26:9
+ --> $DIR/edition-deny-async-fns-2015.rs:27:9
|
LL | async fn foo() {}
| ^^^^^ to use `async fn`, switch to Rust 2018 or later
@@ -71,7 +71,7 @@ LL | async fn foo() {}
= note: for more on editions, read https://doc.rust-lang.org/edition-guide
error[E0670]: `async fn` is not permitted in Rust 2015
- --> $DIR/edition-deny-async-fns-2015.rs:31:13
+ --> $DIR/edition-deny-async-fns-2015.rs:32:13
|
LL | async fn bar() {}
| ^^^^^ to use `async fn`, switch to Rust 2018 or later
@@ -83,14 +83,30 @@ error[E0706]: functions in traits cannot be declared `async`
--> $DIR/edition-deny-async-fns-2015.rs:18:5
|
LL | async fn foo() {}
- | -----^^^^^^^^^^^^
+ | -----^^^^^^^^^
| |
| `async` because of this
|
= note: `async` trait functions are not currently supported
= note: consider using the `async-trait` crate: https://crates.io/crates/async-trait
+ = note: see issue #91611 <https://github.com/rust-lang/rust/issues/91611> for more information
+ = help: add `#![feature(return_position_impl_trait_in_trait)]` to the crate attributes to enable
-error: aborting due to 10 previous errors
+error[E0308]: mismatched types
+ --> $DIR/edition-deny-async-fns-2015.rs:18:20
+ |
+LL | async fn foo() {}
+ | ^^ expected associated type, found opaque type
+ |
+ ::: $SRC_DIR/core/src/future/mod.rs:LL:COL
+ |
+LL | pub const fn from_generator<T>(gen: T) -> impl Future<Output = T::Return>
+ | ------------------------------- the found opaque type
+ |
+ = note: expected associated type `impl Future<Output = ()>` (trait associated opaque type at <$DIR/edition-deny-async-fns-2015.rs:18:20>)
+ found opaque type `impl Future<Output = ()>` (opaque type at <$SRC_DIR/core/src/future/mod.rs:LL:COL>)
+
+error: aborting due to 11 previous errors
-Some errors have detailed explanations: E0670, E0706.
-For more information about an error, try `rustc --explain E0670`.
+Some errors have detailed explanations: E0308, E0670, E0706.
+For more information about an error, try `rustc --explain E0308`.
diff --git a/src/test/ui/async-await/generator-desc.stderr b/src/test/ui/async-await/generator-desc.stderr
index 3be8c5520..2494c3feb 100644
--- a/src/test/ui/async-await/generator-desc.stderr
+++ b/src/test/ui/async-await/generator-desc.stderr
@@ -42,7 +42,7 @@ note: function defined here
--> $DIR/generator-desc.rs:8:4
|
LL | fn fun<F: Future<Output = ()>>(f1: F, f2: F) {}
- | ^^^ ----- -----
+ | ^^^ -----
error[E0308]: mismatched types
--> $DIR/generator-desc.rs:14:26
@@ -67,7 +67,7 @@ note: function defined here
--> $DIR/generator-desc.rs:8:4
|
LL | fn fun<F: Future<Output = ()>>(f1: F, f2: F) {}
- | ^^^ ----- -----
+ | ^^^ -----
error: aborting due to 3 previous errors
diff --git a/src/test/ui/async-await/issue-101715.rs b/src/test/ui/async-await/issue-101715.rs
new file mode 100644
index 000000000..1be5d0248
--- /dev/null
+++ b/src/test/ui/async-await/issue-101715.rs
@@ -0,0 +1,17 @@
+// edition:2018
+
+struct S;
+
+impl S {
+ fn very_long_method_name_the_longest_method_name_in_the_whole_universe(self) {}
+}
+
+async fn foo() {
+ S.very_long_method_name_the_longest_method_name_in_the_whole_universe()
+ .await
+ //~^ error: `()` is not a future
+ //~| help: remove the `.await`
+ //~| help: the trait `Future` is not implemented for `()`
+}
+
+fn main() {}
diff --git a/src/test/ui/async-await/issue-101715.stderr b/src/test/ui/async-await/issue-101715.stderr
new file mode 100644
index 000000000..a0e8d2a89
--- /dev/null
+++ b/src/test/ui/async-await/issue-101715.stderr
@@ -0,0 +1,16 @@
+error[E0277]: `()` is not a future
+ --> $DIR/issue-101715.rs:11:9
+ |
+LL | .await
+ | ^^^^^^
+ | |
+ | `()` is not a future
+ | help: remove the `.await`
+ |
+ = help: the trait `Future` is not implemented for `()`
+ = note: () must be a future or must implement `IntoFuture` to be awaited
+ = note: required for `()` to implement `IntoFuture`
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0277`.
diff --git a/src/test/ui/async-await/issue-64130-4-async-move.stderr b/src/test/ui/async-await/issue-64130-4-async-move.drop-tracking.stderr
index d631e6dc7..f609e3636 100644
--- a/src/test/ui/async-await/issue-64130-4-async-move.stderr
+++ b/src/test/ui/async-await/issue-64130-4-async-move.drop-tracking.stderr
@@ -1,12 +1,12 @@
error: future cannot be sent between threads safely
- --> $DIR/issue-64130-4-async-move.rs:15:17
+ --> $DIR/issue-64130-4-async-move.rs:19: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:21:31
+ --> $DIR/issue-64130-4-async-move.rs:25:31
|
LL | match client.status() {
| ------ has type `&Client` which is not `Send`
@@ -17,7 +17,7 @@ LL | let _x = get().await;
LL | }
| - `client` is later dropped here
help: consider moving this into a `let` binding to create a shorter lived borrow
- --> $DIR/issue-64130-4-async-move.rs:19:15
+ --> $DIR/issue-64130-4-async-move.rs:23:15
|
LL | match client.status() {
| ^^^^^^^^^^^^^^^
diff --git a/src/test/ui/async-await/issue-64130-4-async-move.no_drop_tracking.stderr b/src/test/ui/async-await/issue-64130-4-async-move.no_drop_tracking.stderr
new file mode 100644
index 000000000..f609e3636
--- /dev/null
+++ b/src/test/ui/async-await/issue-64130-4-async-move.no_drop_tracking.stderr
@@ -0,0 +1,26 @@
+error: future cannot be sent between threads safely
+ --> $DIR/issue-64130-4-async-move.rs:19:17
+ |
+LL | pub fn foo() -> impl Future + Send {
+ | ^^^^^^^^^^^^^^^^^^ future created by async block is not `Send`
+ |
+ = help: the trait `Sync` is not implemented for `(dyn Any + Send + 'static)`
+note: future is not `Send` as this value is used across an await
+ --> $DIR/issue-64130-4-async-move.rs:25:31
+ |
+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:23:15
+ |
+LL | match client.status() {
+ | ^^^^^^^^^^^^^^^
+
+error: aborting due to previous error
+
diff --git a/src/test/ui/async-await/issue-64130-4-async-move.rs b/src/test/ui/async-await/issue-64130-4-async-move.rs
index 2538f3435..a38428fc0 100644
--- a/src/test/ui/async-await/issue-64130-4-async-move.rs
+++ b/src/test/ui/async-await/issue-64130-4-async-move.rs
@@ -1,4 +1,8 @@
// edition:2018
+// revisions: no_drop_tracking drop_tracking
+// [drop_tracking] check-pass
+// [drop_tracking] compile-flags: -Zdrop-tracking=yes
+// [no_drop_tracking] compile-flags: -Zdrop-tracking=no
use std::any::Any;
use std::future::Future;
@@ -10,16 +14,16 @@ impl Client {
}
}
-async fn get() { }
+async fn get() {}
pub fn foo() -> impl Future + Send {
- //~^ ERROR future cannot be sent between threads safely
+ //[no_drop_tracking]~^ ERROR future cannot be sent between threads safely
let client = Client(Box::new(true));
async move {
match client.status() {
200 => {
let _x = get().await;
- },
+ }
_ => (),
}
}
diff --git a/src/test/ui/async-await/issue-67252-unnamed-future.stderr b/src/test/ui/async-await/issue-67252-unnamed-future.stderr
index 01c0d3225..af99b608c 100644
--- a/src/test/ui/async-await/issue-67252-unnamed-future.stderr
+++ b/src/test/ui/async-await/issue-67252-unnamed-future.stderr
@@ -1,8 +1,12 @@
error: future cannot be sent between threads safely
- --> $DIR/issue-67252-unnamed-future.rs:18:5
+ --> $DIR/issue-67252-unnamed-future.rs:18:11
|
-LL | spawn(async {
- | ^^^^^ future created by async block is not `Send`
+LL | spawn(async {
+ | ___________^
+LL | | let _a = std::ptr::null_mut::<()>(); // `*mut ()` is not `Send`
+LL | | AFuture.await;
+LL | | });
+ | |_____^ future created by async block is not `Send`
|
= help: within `impl Future<Output = ()>`, the trait `Send` is not implemented for `*mut ()`
note: future is not `Send` as this value is used across an await
diff --git a/src/test/ui/async-await/issue-68112.drop_tracking.stderr b/src/test/ui/async-await/issue-68112.drop_tracking.stderr
new file mode 100644
index 000000000..c915164cf
--- /dev/null
+++ b/src/test/ui/async-await/issue-68112.drop_tracking.stderr
@@ -0,0 +1,79 @@
+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: 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: 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: 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:26
+ |
+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/src/test/ui/async-await/issue-68112.stderr b/src/test/ui/async-await/issue-68112.no_drop_tracking.stderr
index 4285fbbec..11b7d1aaa 100644
--- a/src/test/ui/async-await/issue-68112.stderr
+++ b/src/test/ui/async-await/issue-68112.no_drop_tracking.stderr
@@ -1,60 +1,65 @@
error: future cannot be sent between threads safely
- --> $DIR/issue-68112.rs:34:5
+ --> $DIR/issue-68112.rs:37:18
|
LL | require_send(send_fut);
- | ^^^^^^^^^^^^ future created by async block is not `Send`
+ | ^^^^^^^^ future created by async block is not `Send`
|
= help: the trait `Sync` is not implemented for `RefCell<i32>`
note: future is not `Send` as it awaits another future which is not `Send`
- --> $DIR/issue-68112.rs:31:17
+ --> $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:11:25
+ --> $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:43:5
+ --> $DIR/issue-68112.rs:46:18
|
LL | require_send(send_fut);
- | ^^^^^^^^^^^^ future created by async block is not `Send`
+ | ^^^^^^^^ future created by async block is not `Send`
|
= help: the trait `Sync` is not implemented for `RefCell<i32>`
note: future is not `Send` as it awaits another future which is not `Send`
- --> $DIR/issue-68112.rs:40:17
+ --> $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:11:25
+ --> $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:60:5
+ --> $DIR/issue-68112.rs:65:18
|
LL | require_send(send_fut);
- | ^^^^^^^^^^^^ `RefCell<i32>` cannot be shared between threads safely
+ | ------------ ^^^^^^^^ `RefCell<i32>` cannot be shared between threads safely
+ | |
+ | required by a bound introduced by this call
|
= help: the trait `Sync` is not implemented for `RefCell<i32>`
- = note: required because of the requirements on the impl of `Send` for `Arc<RefCell<i32>>`
+ = 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
+ --> $DIR/issue-68112.rs:50:31
|
-LL | async fn ready2<T>(t: T) -> T { t }
- | ^^^^^
+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:48:31
+ --> $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:55:26
+ --> $DIR/issue-68112.rs:60:26
|
LL | let send_fut = async {
| __________________________^
@@ -64,7 +69,7 @@ LL | | ready(0).await;
LL | | };
| |_____^
note: required by a bound in `require_send`
- --> $DIR/issue-68112.rs:11:25
+ --> $DIR/issue-68112.rs:14:25
|
LL | fn require_send(_: impl Send) {}
| ^^^^ required by this bound in `require_send`
diff --git a/src/test/ui/async-await/issue-68112.rs b/src/test/ui/async-await/issue-68112.rs
index bfabf81d1..9c705137a 100644
--- a/src/test/ui/async-await/issue-68112.rs
+++ b/src/test/ui/async-await/issue-68112.rs
@@ -1,10 +1,13 @@
// edition:2018
+// revisions: no_drop_tracking drop_tracking
+// [drop_tracking] compile-flags: -Zdrop-tracking=yes
+// [no_drop_tracking] compile-flags: -Zdrop-tracking=no
use std::{
- future::Future,
cell::RefCell,
- sync::Arc,
+ future::Future,
pin::Pin,
+ sync::Arc,
task::{Context, Poll},
};
@@ -44,7 +47,9 @@ fn test1_no_let() {
//~^ ERROR future cannot be sent between threads
}
-async fn ready2<T>(t: T) -> T { t }
+async fn ready2<T>(t: T) -> T {
+ t
+}
fn make_non_send_future2() -> impl Future<Output = Arc<RefCell<i32>>> {
ready2(Arc::new(RefCell::new(0)))
}
diff --git a/src/test/ui/async-await/issue-70594.stderr b/src/test/ui/async-await/issue-70594.stderr
index a88bce6cc..d3cf57d3b 100644
--- a/src/test/ui/async-await/issue-70594.stderr
+++ b/src/test/ui/async-await/issue-70594.stderr
@@ -22,16 +22,14 @@ error[E0277]: `()` is not a future
--> $DIR/issue-70594.rs:4:11
|
LL | [1; ().await];
- | ^^^^^^ `()` is not a future
+ | ^^^^^^
+ | |
+ | `()` is not a future
+ | help: remove the `.await`
|
= help: the trait `Future` is not implemented for `()`
= note: () must be a future or must implement `IntoFuture` to be awaited
- = note: required because of the requirements on the impl of `IntoFuture` for `()`
-help: remove the `.await`
- |
-LL - [1; ().await];
-LL + [1; ()];
- |
+ = note: required for `()` to implement `IntoFuture`
error: aborting due to 4 previous errors
diff --git a/src/test/ui/async-await/issue-70935-complex-spans.drop_tracking.stderr b/src/test/ui/async-await/issue-70935-complex-spans.drop_tracking.stderr
index 2ce7309e1..198de7bf7 100644
--- a/src/test/ui/async-await/issue-70935-complex-spans.drop_tracking.stderr
+++ b/src/test/ui/async-await/issue-70935-complex-spans.drop_tracking.stderr
@@ -1,18 +1,18 @@
error[E0277]: `Sender<i32>` cannot be shared between threads safely
- --> $DIR/issue-70935-complex-spans.rs:12:45
+ --> $DIR/issue-70935-complex-spans.rs:13:45
|
LL | fn foo(tx: std::sync::mpsc::Sender<i32>) -> impl Future + Send {
| ^^^^^^^^^^^^^^^^^^ `Sender<i32>` cannot be shared between threads safely
|
= help: the trait `Sync` is not implemented for `Sender<i32>`
- = note: required because of the requirements on the impl of `Send` for `&Sender<i32>`
+ = note: required for `&Sender<i32>` to implement `Send`
note: required because it's used within this closure
- --> $DIR/issue-70935-complex-spans.rs:16:13
+ --> $DIR/issue-70935-complex-spans.rs:17:13
|
LL | baz(|| async{
| ^^
note: required because it's used within this `async fn` body
- --> $DIR/issue-70935-complex-spans.rs:9:67
+ --> $DIR/issue-70935-complex-spans.rs:10:67
|
LL | async fn baz<T>(_c: impl FnMut() -> T) where T: Future<Output=()> {
| ___________________________________________________________________^
@@ -20,7 +20,7 @@ LL | | }
| |_^
= note: required because it captures the following types: `ResumeTy`, `impl for<'r, 's, 't0> Future<Output = ()>`, `()`
note: required because it's used within this `async` block
- --> $DIR/issue-70935-complex-spans.rs:15:16
+ --> $DIR/issue-70935-complex-spans.rs:16:16
|
LL | async move {
| ________________^
diff --git a/src/test/ui/async-await/issue-70935-complex-spans.normal.stderr b/src/test/ui/async-await/issue-70935-complex-spans.no_drop_tracking.stderr
index 2b81b4000..34b31198e 100644
--- a/src/test/ui/async-await/issue-70935-complex-spans.normal.stderr
+++ b/src/test/ui/async-await/issue-70935-complex-spans.no_drop_tracking.stderr
@@ -1,12 +1,12 @@
error: future cannot be sent between threads safely
- --> $DIR/issue-70935-complex-spans.rs:12:45
+ --> $DIR/issue-70935-complex-spans.rs:13:45
|
LL | fn foo(tx: std::sync::mpsc::Sender<i32>) -> impl Future + Send {
| ^^^^^^^^^^^^^^^^^^ future created by async block is not `Send`
|
= help: the trait `Sync` is not implemented for `Sender<i32>`
note: future is not `Send` as this value is used across an await
- --> $DIR/issue-70935-complex-spans.rs:18:11
+ --> $DIR/issue-70935-complex-spans.rs:19:11
|
LL | baz(|| async{
| _____________-
@@ -14,9 +14,9 @@ LL | | foo(tx.clone());
LL | | }).await;
| | - ^^^^^^ await occurs here, with the value maybe used later
| |_________|
- | has type `[closure@$DIR/issue-70935-complex-spans.rs:16:13: 16:15]` which is not `Send`
+ | has type `[closure@$DIR/issue-70935-complex-spans.rs:17:13: 17:15]` which is not `Send`
note: the value is later dropped here
- --> $DIR/issue-70935-complex-spans.rs:18:17
+ --> $DIR/issue-70935-complex-spans.rs:19:17
|
LL | }).await;
| ^
diff --git a/src/test/ui/async-await/issue-70935-complex-spans.rs b/src/test/ui/async-await/issue-70935-complex-spans.rs
index 48847cdf9..b6d17f93a 100644
--- a/src/test/ui/async-await/issue-70935-complex-spans.rs
+++ b/src/test/ui/async-await/issue-70935-complex-spans.rs
@@ -1,5 +1,6 @@
// edition:2018
-// revisions: normal drop_tracking
+// revisions: no_drop_tracking drop_tracking
+// [no_drop_tracking]compile-flags:-Zdrop-tracking=no
// [drop_tracking]compile-flags:-Zdrop-tracking
// #70935: Check if we do not emit snippet
// with newlines which lead complex diagnostics.
@@ -10,7 +11,7 @@ async fn baz<T>(_c: impl FnMut() -> T) where T: Future<Output=()> {
}
fn foo(tx: std::sync::mpsc::Sender<i32>) -> impl Future + Send {
- //[normal]~^ ERROR future cannot be sent between threads safely
+ //[no_drop_tracking]~^ ERROR future cannot be sent between threads safely
//[drop_tracking]~^^ ERROR `Sender<i32>` cannot be shared between threads
async move {
baz(|| async{
diff --git a/src/test/ui/async-await/issue-73137.rs b/src/test/ui/async-await/issue-73137.rs
index c43ce2cad..dcbe7765a 100644
--- a/src/test/ui/async-await/issue-73137.rs
+++ b/src/test/ui/async-await/issue-73137.rs
@@ -2,6 +2,9 @@
// 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/src/test/ui/async-await/issues/issue-62009-1.stderr b/src/test/ui/async-await/issues/issue-62009-1.stderr
index 5cbbf89a2..222afb2c7 100644
--- a/src/test/ui/async-await/issues/issue-62009-1.stderr
+++ b/src/test/ui/async-await/issues/issue-62009-1.stderr
@@ -28,16 +28,14 @@ error[E0277]: `[closure@$DIR/issue-62009-1.rs:12:6: 12:9]` is not a future
--> $DIR/issue-62009-1.rs:12:15
|
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@$DIR/issue-62009-1.rs:12:6: 12:9]`
+ = 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 because of the requirements on the impl of `IntoFuture` for `[closure@$DIR/issue-62009-1.rs:12:6: 12:9]`
-help: remove the `.await`
- |
-LL - (|_| 2333).await;
-LL + (|_| 2333);
- |
+ = 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/src/test/ui/async-await/issues/issue-65436-raw-ptr-not-send.stderr b/src/test/ui/async-await/issues/issue-65436-raw-ptr-not-send.no_drop_tracking.stderr
index b23093001..a72350377 100644
--- a/src/test/ui/async-await/issues/issue-65436-raw-ptr-not-send.stderr
+++ b/src/test/ui/async-await/issues/issue-65436-raw-ptr-not-send.no_drop_tracking.stderr
@@ -1,29 +1,33 @@
error: future cannot be sent between threads safely
- --> $DIR/issue-65436-raw-ptr-not-send.rs:12:5
+ --> $DIR/issue-65436-raw-ptr-not-send.rs:16:17
|
-LL | assert_send(async {
- | ^^^^^^^^^^^ future created by async block is not `Send`
+LL | assert_send(async {
+ | _________________^
+LL | |
+LL | | bar(Foo(std::ptr::null())).await;
+LL | | })
+ | |_____^ future created by async block is not `Send`
|
= help: within `impl Future<Output = ()>`, 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:14:35
+ --> $DIR/issue-65436-raw-ptr-not-send.rs:18:35
|
LL | bar(Foo(std::ptr::null())).await;
| ---------------- ^^^^^^ await occurs here, with `std::ptr::null()` maybe used later
| |
| has type `*const u8` which is not `Send`
note: `std::ptr::null()` is later dropped here
- --> $DIR/issue-65436-raw-ptr-not-send.rs:14:41
+ --> $DIR/issue-65436-raw-ptr-not-send.rs:18:41
|
LL | bar(Foo(std::ptr::null())).await;
| ^
help: consider moving this into a `let` binding to create a shorter lived borrow
- --> $DIR/issue-65436-raw-ptr-not-send.rs:14:13
+ --> $DIR/issue-65436-raw-ptr-not-send.rs:18:13
|
LL | bar(Foo(std::ptr::null())).await;
| ^^^^^^^^^^^^^^^^^^^^^
note: required by a bound in `assert_send`
- --> $DIR/issue-65436-raw-ptr-not-send.rs:9:19
+ --> $DIR/issue-65436-raw-ptr-not-send.rs:13:19
|
LL | fn assert_send<T: Send>(_: T) {}
| ^^^^ required by this bound in `assert_send`
diff --git a/src/test/ui/async-await/issues/issue-65436-raw-ptr-not-send.rs b/src/test/ui/async-await/issues/issue-65436-raw-ptr-not-send.rs
index 3a814b475..91edbc10d 100644
--- a/src/test/ui/async-await/issues/issue-65436-raw-ptr-not-send.rs
+++ b/src/test/ui/async-await/issues/issue-65436-raw-ptr-not-send.rs
@@ -1,4 +1,8 @@
// edition:2018
+// revisions: no_drop_tracking drop_tracking
+// [drop_tracking] check-pass
+// [drop_tracking] compile-flags: -Zdrop-tracking=yes
+// [no_drop_tracking] compile-flags: -Zdrop-tracking=no
struct Foo(*const u8);
@@ -10,7 +14,7 @@ fn assert_send<T: Send>(_: T) {}
fn main() {
assert_send(async {
- //~^ ERROR future cannot be sent between threads safely
+ //[no_drop_tracking]~^ ERROR future cannot be sent between threads safely
bar(Foo(std::ptr::null())).await;
})
}
diff --git a/src/test/ui/async-await/issues/issue-95307.stderr b/src/test/ui/async-await/issues/issue-95307.stderr
index 60fca71eb..1c12f1e48 100644
--- a/src/test/ui/async-await/issues/issue-95307.stderr
+++ b/src/test/ui/async-await/issues/issue-95307.stderr
@@ -8,6 +8,14 @@ LL | async fn new() -> [u8; _];
|
= note: `async` trait functions are not currently supported
= note: consider using the `async-trait` crate: https://crates.io/crates/async-trait
+ = note: see issue #91611 <https://github.com/rust-lang/rust/issues/91611> for more information
+ = help: add `#![feature(return_position_impl_trait_in_trait)]` to the crate attributes to enable
+
+error: in expressions, `_` can only be used on the left-hand side of an assignment
+ --> $DIR/issue-95307.rs:7:28
+ |
+LL | async fn new() -> [u8; _];
+ | ^ `_` not allowed here
error[E0658]: using `_` for array lengths is unstable
--> $DIR/issue-95307.rs:7:28
@@ -18,12 +26,6 @@ LL | async fn new() -> [u8; _];
= note: see issue #85077 <https://github.com/rust-lang/rust/issues/85077> for more information
= help: add `#![feature(generic_arg_infer)]` to the crate attributes to enable
-error: in expressions, `_` can only be used on the left-hand side of an assignment
- --> $DIR/issue-95307.rs:7:28
- |
-LL | async fn new() -> [u8; _];
- | ^ `_` not allowed here
-
error: aborting due to 3 previous errors
Some errors have detailed explanations: E0658, E0706.
diff --git a/src/test/ui/async-await/partial-drop-partial-reinit.drop_tracking.stderr b/src/test/ui/async-await/partial-drop-partial-reinit.drop_tracking.stderr
new file mode 100644
index 000000000..17b4ef7bd
--- /dev/null
+++ b/src/test/ui/async-await/partial-drop-partial-reinit.drop_tracking.stderr
@@ -0,0 +1,35 @@
+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/src/test/ui/async-await/partial-drop-partial-reinit.stderr b/src/test/ui/async-await/partial-drop-partial-reinit.no_drop_tracking.stderr
index 05f535834..34d8a159f 100644
--- a/src/test/ui/async-await/partial-drop-partial-reinit.stderr
+++ b/src/test/ui/async-await/partial-drop-partial-reinit.no_drop_tracking.stderr
@@ -1,5 +1,5 @@
error[E0277]: `NotSend` cannot be sent between threads safely
- --> $DIR/partial-drop-partial-reinit.rs:6:16
+ --> $DIR/partial-drop-partial-reinit.rs:9:16
|
LL | gimme_send(foo());
| ---------- ^^^^^ `NotSend` cannot be sent between threads safely
@@ -13,7 +13,7 @@ LL | async fn foo() {
= 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:28:16
+ --> $DIR/partial-drop-partial-reinit.rs:31:16
|
LL | async fn foo() {
| ________________^
@@ -25,7 +25,7 @@ LL | | bar().await;
LL | | }
| |_^
note: required by a bound in `gimme_send`
- --> $DIR/partial-drop-partial-reinit.rs:14:18
+ --> $DIR/partial-drop-partial-reinit.rs:17:18
|
LL | fn gimme_send<T: Send>(t: T) {
| ^^^^ required by this bound in `gimme_send`
diff --git a/src/test/ui/async-await/partial-drop-partial-reinit.rs b/src/test/ui/async-await/partial-drop-partial-reinit.rs
index fe0fce7af..7d097e72f 100644
--- a/src/test/ui/async-await/partial-drop-partial-reinit.rs
+++ b/src/test/ui/async-await/partial-drop-partial-reinit.rs
@@ -1,4 +1,7 @@
// 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)]
@@ -12,8 +15,8 @@ fn main() {
}
fn gimme_send<T: Send>(t: T) {
-//~^ NOTE required by this bound
-//~| NOTE required by a bound
+ //~^ NOTE required by this bound
+ //~| NOTE required by a bound
drop(t);
}
@@ -26,8 +29,8 @@ impl Drop for NotSend {
impl !Send for NotSend {}
async fn foo() {
-//~^ NOTE used within this `async fn` body
-//~| NOTE within this `impl Future
+ //~^ NOTE used within this `async fn` body
+ //~| NOTE within this `impl Future
let mut x = (NotSend {},);
drop(x.0);
x.0 = NotSend {};
diff --git a/src/test/ui/async-await/unnecessary-await.stderr b/src/test/ui/async-await/unnecessary-await.stderr
index e7e61c2ba..dc3089336 100644
--- a/src/test/ui/async-await/unnecessary-await.stderr
+++ b/src/test/ui/async-await/unnecessary-await.stderr
@@ -8,7 +8,7 @@ LL | boo().await;
|
= help: the trait `Future` is not implemented for `()`
= note: () must be a future or must implement `IntoFuture` to be awaited
- = note: required because of the requirements on the impl of `IntoFuture` for `()`
+ = note: required for `()` to implement `IntoFuture`
help: remove the `.await`
|
LL - boo().await;