Rollup merge of #72775 - JohnTitor:await-sugg, r=estebank
Return early to avoid ICE Fixes #72766
This commit is contained in:
commit
8a68fc6ff4
5 changed files with 46 additions and 7 deletions
20
src/test/ui/suggestions/issue-72766.rs
Normal file
20
src/test/ui/suggestions/issue-72766.rs
Normal file
|
|
@ -0,0 +1,20 @@
|
|||
// edition:2018
|
||||
// compile-flags: -Cincremental=tmp/issue-72766
|
||||
|
||||
pub struct SadGirl;
|
||||
|
||||
impl SadGirl {
|
||||
pub async fn call(&self) -> Result<(), ()> {
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
|
||||
async fn async_main() -> Result<(), ()> {
|
||||
// should be `.call().await?`
|
||||
SadGirl {}.call()?; //~ ERROR: the `?` operator can only be applied to values
|
||||
Ok(())
|
||||
}
|
||||
|
||||
fn main() {
|
||||
let _ = async_main();
|
||||
}
|
||||
15
src/test/ui/suggestions/issue-72766.stderr
Normal file
15
src/test/ui/suggestions/issue-72766.stderr
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
error[E0277]: the `?` operator can only be applied to values that implement `std::ops::Try`
|
||||
--> $DIR/issue-72766.rs:14:5
|
||||
|
|
||||
LL | SadGirl {}.call()?;
|
||||
| ^^^^^^^^^^^^^^^^^^
|
||||
| |
|
||||
| the `?` operator cannot be applied to type `impl std::future::Future`
|
||||
| help: consider using `.await` here: `SadGirl {}.call().await?`
|
||||
|
|
||||
= help: the trait `std::ops::Try` is not implemented for `impl std::future::Future`
|
||||
= note: required by `std::ops::Try::into_result`
|
||||
|
||||
error: aborting due to previous error
|
||||
|
||||
For more information about this error, try `rustc --explain E0277`.
|
||||
Loading…
Add table
Add a link
Reference in a new issue