forked from rust-lang/rust
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Rollup merge of rust-lang#101723 - lukas-code:await-diag, r=compiler-…
…errors Impove diagnostic for `.await`ing non-futures Strip leading whitespace from the span and use a non-verbose suggestion. fixes rust-lang#101715
- Loading branch information
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