-
Notifications
You must be signed in to change notification settings - Fork 12.7k
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 #90933 - compiler-errors:master, r=estebank
Fix await suggestion on non-future type Remove a match block that would suggest to add `.await` in the case where the expected type's `Future::Output` equals the found type. We only want to suggest `.await`ing in the opposite case (the found type's `Future::Output` equals the expected type). The code sample is here: https://play.rust-lang.org/?version=stable&mode=debug&edition=2021&gist=6ba6b83d4dddda263553b79dca9f6bcb Before: ``` ➜ ~ rustc --edition=2021 --crate-type=lib test.rs error[E0308]: `match` arms have incompatible types --> test.rs:4:14 | 2 | let x = match 1 { | _____________- 3 | | 1 => other(), | | ------- this is found to be of type `impl Future` 4 | | 2 => other().await, | | ^^^^^^^^^^^^^ expected opaque type, found enum `Result` 5 | | }; | |_____- `match` arms have incompatible types | = note: expected type `impl Future` found enum `Result<(), ()>` help: consider `await`ing on the `Future` | 4 | 2 => other().await.await, | ++++++ error: aborting due to previous error For more information about this error, try `rustc --explain E0308`. ``` After: ``` ➜ ~ rustc +stage1 --edition=2021 --crate-type=lib test.rs error[E0308]: `match` arms have incompatible types --> test.rs:4:14 | 2 | let x = match 1 { | _____________- 3 | | 1 => other(), | | ------- this is found to be of type `impl Future` 4 | | 2 => other().await, | | ^^^^^^^^^^^^^ expected opaque type, found enum `Result` 5 | | }; | |_____- `match` arms have incompatible types | = note: expected type `impl Future` found enum `Result<(), ()>` error: aborting due to previous error For more information about this error, try `rustc --explain E0308`. ``` Fixes #90931
- Loading branch information
Showing
3 changed files
with
123 additions
and
20 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