]> git.lizzy.rs Git - rust.git/blob - src/test/ui/nll/issue-52534.stderr
Rollup merge of #105216 - GuillaumeGomez:rm-unused-gui-test, r=notriddle
[rust.git] / src / test / ui / nll / issue-52534.stderr
1 error[E0597]: `x` does not live long enough
2   --> $DIR/issue-52534.rs:9:14
3    |
4 LL |     foo(|a| &x)
5    |          -   ^ `x` would have to be valid for `'0`...
6    |          |
7    |          has type `&'0 u32`
8 LL |
9 LL | }
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
15 error[E0597]: `y` does not live long enough
16   --> $DIR/issue-52534.rs:15:26
17    |
18 LL |     baz(|first, second| &y)
19    |          -----           ^ `y` would have to be valid for `'0`...
20    |          |
21    |          has type `&'0 u32`
22 LL |
23 LL | }
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
29 error: aborting due to 2 previous errors
30
31 For more information about this error, try `rustc --explain E0597`.