-
Notifications
You must be signed in to change notification settings - Fork 12.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Do suggest_await_before_try with infer in self, clean up binders
- Loading branch information
1 parent
e40d5e8
commit d268b34
Showing
4 changed files
with
71 additions
and
30 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
// edition:2021 | ||
// run-rustfix | ||
|
||
#![allow(unused)] | ||
|
||
use std::future::Future; | ||
|
||
async fn foo() -> Result<(), i32> { | ||
func(async { Ok::<_, i32>(()) }).await?; | ||
//~^ ERROR the `?` operator can only be applied to values that implement `Try` | ||
|
||
Ok(()) | ||
} | ||
|
||
async fn func<T>(fut: impl Future<Output = T>) -> T { | ||
fut.await | ||
} | ||
|
||
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,19 @@ | ||
// edition:2021 | ||
// run-rustfix | ||
|
||
#![allow(unused)] | ||
|
||
use std::future::Future; | ||
|
||
async fn foo() -> Result<(), i32> { | ||
func(async { Ok::<_, i32>(()) })?; | ||
//~^ ERROR the `?` operator can only be applied to values that implement `Try` | ||
|
||
Ok(()) | ||
} | ||
|
||
async fn func<T>(fut: impl Future<Output = T>) -> T { | ||
fut.await | ||
} | ||
|
||
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,15 @@ | ||
error[E0277]: the `?` operator can only be applied to values that implement `Try` | ||
--> $DIR/issue-97704.rs:9:5 | ||
| | ||
LL | func(async { Ok::<_, i32>(()) })?; | ||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the `?` operator cannot be applied to type `impl Future<Output = Result<(), i32>>` | ||
| | ||
= help: the trait `Try` is not implemented for `impl Future<Output = Result<(), i32>>` | ||
help: consider `await`ing on the `Future` | ||
| | ||
LL | func(async { Ok::<_, i32>(()) }).await?; | ||
| ++++++ | ||
|
||
error: aborting due to previous error | ||
|
||
For more information about this error, try `rustc --explain E0277`. |