parent
5e57faa78a
commit
7356e28abb
4 changed files with 48 additions and 10 deletions
11
src/test/ui/async-await/proper-span-for-type-error.fixed
Normal file
11
src/test/ui/async-await/proper-span-for-type-error.fixed
Normal 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() {}
|
||||
11
src/test/ui/async-await/proper-span-for-type-error.rs
Normal file
11
src/test/ui/async-await/proper-span-for-type-error.rs
Normal 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() {}
|
||||
16
src/test/ui/async-await/proper-span-for-type-error.stderr
Normal file
16
src/test/ui/async-await/proper-span-for-type-error.stderr
Normal 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`.
|
||||
Loading…
Add table
Add a link
Reference in a new issue