rust/tests/ui/closures/issue-87461.rs
2023-01-11 09:32:08 +00:00

30 lines
477 B
Rust

// Regression test for #87461.
// edition:2021
async fn func() -> Result<u16, u64> {
let _ = async {
Err(42u64)
}.await?;
Ok(())
//~^ ERROR: mismatched types [E0308]
}
async fn func2() -> Result<u16, u64> {
Err(42u64)?;
Ok(())
//~^ ERROR: mismatched types [E0308]
}
fn main() {
|| -> Result<u16, u64> {
if true {
return Err(42u64);
}
Ok(())
//~^ ERROR: mismatched types [E0308]
};
}