diff options
| author | Lukas Markeffsky <@> | 2022-09-12 16:54:25 +0200 |
|---|---|---|
| committer | Lukas Markeffsky <@> | 2022-09-12 16:54:25 +0200 |
| commit | 2b7fb8d9418dbf98e6ee8ed406f830b4fcbea55f (patch) | |
| tree | 35f3e3a31dca920ce3ee87779a1ddac72fa72268 /src | |
| parent | 56e7678ca97e9740f7d09206f767d5bb676917f7 (diff) | |
| download | rust-2b7fb8d9418dbf98e6ee8ed406f830b4fcbea55f.tar.gz rust-2b7fb8d9418dbf98e6ee8ed406f830b4fcbea55f.zip | |
Impove diagnostic for .await-ing non-futures
Diffstat (limited to 'src')
| -rw-r--r-- | src/test/ui/async-await/issue-101715.rs | 17 | ||||
| -rw-r--r-- | src/test/ui/async-await/issue-101715.stderr | 16 | ||||
| -rw-r--r-- | src/test/ui/async-await/issue-70594.stderr | 10 | ||||
| -rw-r--r-- | src/test/ui/async-await/issues/issue-62009-1.stderr | 10 |
4 files changed, 41 insertions, 12 deletions
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 00000000000..1be5d02482e --- /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 00000000000..a0e8d2a8943 --- /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-70594.stderr b/src/test/ui/async-await/issue-70594.stderr index f6ff52a5fd2..d3cf57d3b14 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 for `()` to implement `IntoFuture` -help: remove the `.await` - | -LL - [1; ().await]; -LL + [1; ()]; - | error: aborting due to 4 previous errors 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 0e323443ae8..222afb2c7b2 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 `[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: remove the `.await` - | -LL - (|_| 2333).await; -LL + (|_| 2333); - | error: aborting due to 4 previous errors |
