1+ error[E0597]: `x` does not live long enough
2+ --> $DIR/patterns.rs:15:27
3+ |
4+ LL | let y: &'static u32 = &x; //~ ERROR
5+ | ^^ borrowed value does not live long enough
6+ LL | }
7+ | - `x` dropped here while still borrowed
8+ |
9+ = note: borrowed value must be valid for the static lifetime...
10+
11+ error[E0597]: `x` does not live long enough
12+ --> $DIR/patterns.rs:20:27
13+ |
14+ LL | let _: &'static u32 = &x; //~ ERROR
15+ | ^^ borrowed value does not live long enough
16+ ...
17+ LL | }
18+ | - `x` dropped here while still borrowed
19+ |
20+ = note: borrowed value must be valid for the static lifetime...
21+
122error[E0597]: borrowed value does not live long enough
2- --> $DIR/patterns.rs:6 :41
23+ --> $DIR/patterns.rs:22 :41
324 |
425LL | let _: Vec<&'static String> = vec![&String::new()];
526 | ^^^^^^^^^^^^^ - temporary value only lives until here
@@ -9,7 +30,7 @@ LL | let _: Vec<&'static String> = vec![&String::new()];
930 = note: borrowed value must be valid for the static lifetime...
1031
1132error[E0597]: borrowed value does not live long enough
12- --> $DIR/patterns.rs:9 :52
33+ --> $DIR/patterns.rs:25 :52
1334 |
1435LL | let (_, a): (Vec<&'static String>, _) = (vec![&String::new()], 44);
1536 | ^^^^^^^^^^^^^ - temporary value only lives until here
@@ -19,7 +40,7 @@ LL | let (_, a): (Vec<&'static String>, _) = (vec![&String::new()], 44);
1940 = note: borrowed value must be valid for the static lifetime...
2041
2142error[E0597]: borrowed value does not live long enough
22- --> $DIR/patterns.rs:12 :53
43+ --> $DIR/patterns.rs:28 :53
2344 |
2445LL | let (_a, b): (Vec<&'static String>, _) = (vec![&String::new()], 44);
2546 | ^^^^^^^^^^^^^ - temporary value only lives until here
@@ -28,6 +49,74 @@ LL | let (_a, b): (Vec<&'static String>, _) = (vec![&String::new()], 44);
2849 |
2950 = note: borrowed value must be valid for the static lifetime...
3051
31- error: aborting due to 3 previous errors
52+ error[E0597]: `x` does not live long enough
53+ --> $DIR/patterns.rs:34:40
54+ |
55+ LL | let (_, _): (&'static u32, u32) = (&x, 44); //~ ERROR
56+ | ^^ borrowed value does not live long enough
57+ LL | }
58+ | - `x` dropped here while still borrowed
59+ |
60+ = note: borrowed value must be valid for the static lifetime...
61+
62+ error[E0597]: `x` does not live long enough
63+ --> $DIR/patterns.rs:39:40
64+ |
65+ LL | let (y, _): (&'static u32, u32) = (&x, 44); //~ ERROR
66+ | ^^ borrowed value does not live long enough
67+ LL | }
68+ | - `x` dropped here while still borrowed
69+ |
70+ = note: borrowed value must be valid for the static lifetime...
71+
72+ error[E0597]: `x` does not live long enough
73+ --> $DIR/patterns.rs:46:69
74+ |
75+ LL | let Single { value: y }: Single<&'static u32> = Single { value: &x }; //~ ERROR
76+ | ^^ borrowed value does not live long enough
77+ LL | }
78+ | - `x` dropped here while still borrowed
79+ |
80+ = note: borrowed value must be valid for the static lifetime...
81+
82+ error[E0597]: `x` does not live long enough
83+ --> $DIR/patterns.rs:51:69
84+ |
85+ LL | let Single { value: _ }: Single<&'static u32> = Single { value: &x }; //~ ERROR
86+ | ^^ borrowed value does not live long enough
87+ LL | }
88+ | - `x` dropped here while still borrowed
89+ |
90+ = note: borrowed value must be valid for the static lifetime...
91+
92+ error[E0597]: `x` does not live long enough
93+ --> $DIR/patterns.rs:59:17
94+ |
95+ LL | value1: &x, //~ ERROR
96+ | ^^ borrowed value does not live long enough
97+ ...
98+ LL | }
99+ | - `x` dropped here while still borrowed
100+ |
101+ = note: borrowed value must be valid for the static lifetime...
102+
103+ error: unsatisfied lifetime constraints
104+ --> $DIR/patterns.rs:72:5
105+ |
106+ LL | fn static_to_a_to_static_through_variable<'a>(x: &'a u32) -> &'static u32 {
107+ | -- lifetime `'a` defined here
108+ ...
109+ LL | y //~ ERROR
110+ | ^ returning this value requires that `'a` must outlive `'static`
111+
112+ error: unsatisfied lifetime constraints
113+ --> $DIR/patterns.rs:88:40
114+ |
115+ LL | fn a_to_static_then_static<'a>(x: &'a u32) -> &'static u32 {
116+ | -- lifetime `'a` defined here
117+ LL | let (y, _z): (&'static u32, u32) = (x, 44); //~ ERROR
118+ | ^^^^^^^ requires that `'a` must outlive `'static`
119+
120+ error: aborting due to 12 previous errors
32121
33122For more information about this error, try `rustc --explain E0597`.
0 commit comments