diff options
| author | Esteban Kuber <esteban@kuber.com.ar> | 2022-01-20 04:09:46 +0000 |
|---|---|---|
| committer | Esteban Kuber <esteban@kuber.com.ar> | 2022-01-20 04:09:46 +0000 |
| commit | 7356e28abbd56ff600dff1d34553b5bebcfc8767 (patch) | |
| tree | b7af82d5852bfe08acb3569571f7e5d45c14d09b /src | |
| parent | 5e57faa78aa7661c6000204591558f6665f11abc (diff) | |
| download | rust-7356e28abbd56ff600dff1d34553b5bebcfc8767.tar.gz rust-7356e28abbd56ff600dff1d34553b5bebcfc8767.zip | |
Tweak `expr.await` desugaring `Span`
Fix #93074
Diffstat (limited to 'src')
3 files changed, 38 insertions, 0 deletions
diff --git a/src/test/ui/async-await/proper-span-for-type-error.fixed b/src/test/ui/async-await/proper-span-for-type-error.fixed new file mode 100644 index 00000000000..1f1e1184dcc --- /dev/null +++ b/src/test/ui/async-await/proper-span-for-type-error.fixed @@ -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() {} diff --git a/src/test/ui/async-await/proper-span-for-type-error.rs b/src/test/ui/async-await/proper-span-for-type-error.rs new file mode 100644 index 00000000000..00ccde1bf99 --- /dev/null +++ b/src/test/ui/async-await/proper-span-for-type-error.rs @@ -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() {} diff --git a/src/test/ui/async-await/proper-span-for-type-error.stderr b/src/test/ui/async-await/proper-span-for-type-error.stderr new file mode 100644 index 00000000000..611dc0407bf --- /dev/null +++ b/src/test/ui/async-await/proper-span-for-type-error.stderr @@ -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`. |
