]> git.lizzy.rs Git - rust.git/blob - src/test/ui/nll/issue-52534-1.stderr
7b89336dabf220c0343f398e46e8159a0ad4f950
[rust.git] / src / test / ui / nll / issue-52534-1.stderr
1 error[E0597]: `x` does not live long enough
2   --> $DIR/issue-52534-1.rs:19:9
3    |
4 LL |     fn bar(&self, x: &u32) -> &u32 {
5    |            -----              ---- has type `&'0 u32`
6    |            |
7    |            has type `&'0 Test`
8 LL |         let x = 22;
9 LL |         &x
10    |         ^^ `x` would have to be valid for `'0`
11 LL |     }
12    |     - but `x` dropped here while still borrowed
13
14 error[E0597]: `x` does not live long enough
15   --> $DIR/issue-52534-1.rs:25:5
16    |
17 LL | fn foo(x: &u32) -> &u32 {
18    |           ----     ---- also has type `&'0 u32`
19    |           |
20    |           has type `&'0 u32`
21 LL |     let x = 22;
22 LL |     &x
23    |     ^^ `x` would have to be valid for `'0`
24 LL | }
25    | - but `x` dropped here while still borrowed
26
27 error[E0597]: `x` does not live long enough
28   --> $DIR/issue-52534-1.rs:30:6
29    |
30 LL | fn baz(x: &u32) -> &&u32 {
31    |           ----     ----- has type `&'0 &'0 u32`
32    |           |
33    |           has type `&'0 u32`
34 LL |     let x = 22;
35 LL |     &&x
36    |      ^^ `x` would have to be valid for `'0`
37 LL | }
38    | - but `x` dropped here while still borrowed
39
40 error[E0597]: borrowed value does not live long enough
41   --> $DIR/issue-52534-1.rs:30:6
42    |
43 LL |     &&x
44    |      ^^ temporary value does not live long enough
45 LL | }
46    | - temporary value only lives until here
47    |
48 note: borrowed value must be valid for the anonymous lifetime #1 defined on the function body at 28:1...
49   --> $DIR/issue-52534-1.rs:28:1
50    |
51 LL | / fn baz(x: &u32) -> &&u32 {
52 LL | |     let x = 22;
53 LL | |     &&x
54 LL | | }
55    | |_^
56
57 error: aborting due to 4 previous errors
58
59 For more information about this error, try `rustc --explain E0597`.