fork/rust
git clone https://git.julia.blue/fork/rust
73528e339aa
1.40.0
1error[E0597]: `x` does not live long enough 2 --> $DIR/issue-52534.rs:9:14 3 | 4LL | foo(|a| &x) 5 | - ^ `x` would have to be valid for `'0`... 6 | | 7 | has type `&'0 u32` 8LL | 9LL | } 10 | - ...but `x` will be dropped here, when the function `bar` returns 11 | 12 = note: functions cannot return a borrow to data owned within the function's scope, functions can only return borrows to data passed as arguments 13 = note: to learn more, visit <https://doc.rust-lang.org/book/ch04-02-references-and-borrowing.html#dangling-references> 14 15error[E0597]: `y` does not live long enough 16 --> $DIR/issue-52534.rs:15:26 17 | 18LL | baz(|first, second| &y) 19 | ----- ^ `y` would have to be valid for `'0`... 20 | | 21 | has type `&'0 u32` 22LL | 23LL | } 24 | - ...but `y` will be dropped here, when the function `foobar` returns 25 | 26 = note: functions cannot return a borrow to data owned within the function's scope, functions can only return borrows to data passed as arguments 27 = note: to learn more, visit <https://doc.rust-lang.org/book/ch04-02-references-and-borrowing.html#dangling-references> 28 29error: aborting due to 2 previous errors 30 31For more information about this error, try `rustc --explain E0597`.