-
Notifications
You must be signed in to change notification settings - Fork 13.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Impove diagnostic for .await-ing non-futures
- Loading branch information
Lukas Markeffsky
committed
Sep 12, 2022
1 parent
56e7678
commit 2b7fb8d
Showing
6 changed files
with
52 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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() {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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`. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters