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

20 lines
284 B
Rust

fn foo(_: impl FnOnce(&u32) -> &u32) {
}
fn baz(_: impl FnOnce(&u32, u32) -> &u32) {
}
fn bar() {
let x = 22;
foo(|a| &x)
//~^ ERROR does not live long enough
}
fn foobar() {
let y = 22;
baz(|first, second| &y)
//~^ ERROR does not live long enough
}
fn main() { }