rust/tests/ui/async-await/issue-67765-async-diagnostic.rs
2023-01-11 09:32:08 +00:00

17 lines
330 B
Rust

// edition:2018
//
// Regression test for issue #67765
// Tests that we point at the proper location when giving
// a lifetime error.
fn main() {}
async fn func<'a>() -> Result<(), &'a str> {
let s = String::new();
let b = &s[..];
Err(b)?; //~ ERROR cannot return value referencing local variable `s`
Ok(())
}