1 error[E0597]: `x` does not live long enough
2 --> $DIR/issue-52534-1.rs:19:9
4 LL | fn bar(&self, x: &u32) -> &u32 {
5 | ----- ---- has type `&'0 u32`
10 | ^^ `x` would have to be valid for `'0`
12 | - ...but `x` is only valid for the duration of the `bar` function, so it is dropped here while still borrowed
14 = note: functions cannot return a borrow to data owned within the function's scope, functions can only return borrows to data passed as arguments
15 = note: to learn more, visit <https://doc.rust-lang.org/book/second-edition/ch04-02-references-and-borrowing.html#dangling-references>
17 error[E0597]: `x` does not live long enough
18 --> $DIR/issue-52534-1.rs:25:5
20 LL | fn foo(x: &u32) -> &u32 {
21 | ---- ---- also has type `&'0 u32`
26 | ^^ `x` would have to be valid for `'0`
28 | - ...but `x` is only valid for the duration of the `foo` function, so it is dropped here while still borrowed
30 = note: functions cannot return a borrow to data owned within the function's scope, functions can only return borrows to data passed as arguments
31 = note: to learn more, visit <https://doc.rust-lang.org/book/second-edition/ch04-02-references-and-borrowing.html#dangling-references>
33 error[E0597]: `x` does not live long enough
34 --> $DIR/issue-52534-1.rs:30:6
36 LL | fn baz(x: &u32) -> &&u32 {
37 | ---- ----- has type `&'0 &'0 u32`
42 | ^^ `x` would have to be valid for `'0`
44 | - ...but `x` is only valid for the duration of the `baz` function, so it is dropped here while still borrowed
46 = note: functions cannot return a borrow to data owned within the function's scope, functions can only return borrows to data passed as arguments
47 = note: to learn more, visit <https://doc.rust-lang.org/book/second-edition/ch04-02-references-and-borrowing.html#dangling-references>
49 error[E0597]: borrowed value does not live long enough
50 --> $DIR/issue-52534-1.rs:30:6
53 | ^^ temporary value does not live long enough
55 | - temporary value only lives until here
57 note: borrowed value must be valid for the anonymous lifetime #1 defined on the function body at 28:1...
58 --> $DIR/issue-52534-1.rs:28:1
60 LL | / fn baz(x: &u32) -> &&u32 {
66 error: aborting due to 4 previous errors
68 For more information about this error, try `rustc --explain E0597`.