Tweak expr.await desugaring Span

Fix #93074
This commit is contained in:
Esteban Kuber 2022-01-20 04:09:46 +00:00
parent 5e57faa78a
commit 7356e28abb
4 changed files with 48 additions and 10 deletions

View file

@ -0,0 +1,11 @@
// edition:2021
// run-rustfix
#![allow(dead_code)]
async fn a() {}
async fn foo() -> Result<(), i32> {
Ok(a().await) //~ ERROR mismatched types
}
fn main() {}

View file

@ -0,0 +1,11 @@
// edition:2021
// run-rustfix
#![allow(dead_code)]
async fn a() {}
async fn foo() -> Result<(), i32> {
a().await //~ ERROR mismatched types
}
fn main() {}

View file

@ -0,0 +1,16 @@
error[E0308]: mismatched types
--> $DIR/proper-span-for-type-error.rs:8:5
|
LL | a().await
| ^^^^^^^^^ expected enum `Result`, found `()`
|
= note: expected enum `Result<(), i32>`
found unit type `()`
help: try wrapping the expression in `Ok`
|
LL | Ok(a().await)
| +++ +
error: aborting due to previous error
For more information about this error, try `rustc --explain E0308`.