@@ -40,7 +40,17 @@ LL | }
4040 | - `x` dropped here while still borrowed
4141
4242error[E0597]: `x` does not live long enough
43- --> $DIR/patterns.rs:46:27
43+ --> $DIR/patterns.rs:53:10
44+ |
45+ LL | let Single2 { value: mut _y }: Single2<StaticU32>;
46+ | ------------------ type annotation requires that `x` is borrowed for `'static`
47+ LL | _y = &x; //~ ERROR
48+ | ^^ borrowed value does not live long enough
49+ LL | }
50+ | - `x` dropped here while still borrowed
51+
52+ error[E0597]: `x` does not live long enough
53+ --> $DIR/patterns.rs:58:27
4454 |
4555LL | let y: &'static u32 = &x; //~ ERROR
4656 | ------------ ^^ borrowed value does not live long enough
5060 | - `x` dropped here while still borrowed
5161
5262error[E0597]: `x` does not live long enough
53- --> $DIR/patterns.rs:51 :27
63+ --> $DIR/patterns.rs:63 :27
5464 |
5565LL | let _: &'static u32 = &x; //~ ERROR
5666 | ------------ ^^ borrowed value does not live long enough
6171 | - `x` dropped here while still borrowed
6272
6373error[E0716]: temporary value dropped while borrowed
64- --> $DIR/patterns.rs:53 :41
74+ --> $DIR/patterns.rs:65 :41
6575 |
6676LL | let _: Vec<&'static String> = vec![&String::new()];
6777 | -------------------- ^^^^^^^^^^^^^ - temporary value is freed at the end of this statement
@@ -70,7 +80,7 @@ LL | let _: Vec<&'static String> = vec![&String::new()];
7080 | type annotation requires that borrow lasts for `'static`
7181
7282error[E0716]: temporary value dropped while borrowed
73- --> $DIR/patterns.rs:56 :52
83+ --> $DIR/patterns.rs:68 :52
7484 |
7585LL | let (_, a): (Vec<&'static String>, _) = (vec![&String::new()], 44);
7686 | ------------------------- ^^^^^^^^^^^^^ - temporary value is freed at the end of this statement
@@ -79,7 +89,7 @@ LL | let (_, a): (Vec<&'static String>, _) = (vec![&String::new()], 44);
7989 | type annotation requires that borrow lasts for `'static`
8090
8191error[E0716]: temporary value dropped while borrowed
82- --> $DIR/patterns.rs:59 :53
92+ --> $DIR/patterns.rs:71 :53
8393 |
8494LL | let (_a, b): (Vec<&'static String>, _) = (vec![&String::new()], 44);
8595 | ------------------------- ^^^^^^^^^^^^^ - temporary value is freed at the end of this statement
@@ -88,7 +98,7 @@ LL | let (_a, b): (Vec<&'static String>, _) = (vec![&String::new()], 44);
8898 | type annotation requires that borrow lasts for `'static`
8999
90100error[E0597]: `x` does not live long enough
91- --> $DIR/patterns.rs:65 :40
101+ --> $DIR/patterns.rs:77 :40
92102 |
93103LL | let (_, _): (&'static u32, u32) = (&x, 44); //~ ERROR
94104 | ------------------- ^^ borrowed value does not live long enough
@@ -98,7 +108,7 @@ LL | }
98108 | - `x` dropped here while still borrowed
99109
100110error[E0597]: `x` does not live long enough
101- --> $DIR/patterns.rs:70 :40
111+ --> $DIR/patterns.rs:82 :40
102112 |
103113LL | let (y, _): (&'static u32, u32) = (&x, 44); //~ ERROR
104114 | ------------------- ^^ borrowed value does not live long enough
@@ -108,7 +118,7 @@ LL | }
108118 | - `x` dropped here while still borrowed
109119
110120error[E0597]: `x` does not live long enough
111- --> $DIR/patterns.rs:75 :69
121+ --> $DIR/patterns.rs:87 :69
112122 |
113123LL | let Single { value: y }: Single<&'static u32> = Single { value: &x }; //~ ERROR
114124 | -------------------- ^^ borrowed value does not live long enough
@@ -118,7 +128,7 @@ LL | }
118128 | - `x` dropped here while still borrowed
119129
120130error[E0597]: `x` does not live long enough
121- --> $DIR/patterns.rs:80 :69
131+ --> $DIR/patterns.rs:92 :69
122132 |
123133LL | let Single { value: _ }: Single<&'static u32> = Single { value: &x }; //~ ERROR
124134 | -------------------- ^^ borrowed value does not live long enough
@@ -128,7 +138,7 @@ LL | }
128138 | - `x` dropped here while still borrowed
129139
130140error[E0597]: `x` does not live long enough
131- --> $DIR/patterns.rs:88 :17
141+ --> $DIR/patterns.rs:100 :17
132142 |
133143LL | let Double { value1: _, value2: _ }: Double<&'static u32> = Double {
134144 | -------------------- type annotation requires that `x` is borrowed for `'static`
@@ -139,7 +149,7 @@ LL | }
139149 | - `x` dropped here while still borrowed
140150
141151error: unsatisfied lifetime constraints
142- --> $DIR/patterns.rs:101 :5
152+ --> $DIR/patterns.rs:113 :5
143153 |
144154LL | fn static_to_a_to_static_through_variable<'a>(x: &'a u32) -> &'static u32 {
145155 | -- lifetime `'a` defined here
@@ -148,7 +158,7 @@ LL | y //~ ERROR
148158 | ^ returning this value requires that `'a` must outlive `'static`
149159
150160error: unsatisfied lifetime constraints
151- --> $DIR/patterns.rs:113 :5
161+ --> $DIR/patterns.rs:125 :5
152162 |
153163LL | fn static_to_a_to_static_through_tuple<'a>(x: &'a u32) -> &'static u32 {
154164 | -- lifetime `'a` defined here
@@ -157,14 +167,23 @@ LL | y //~ ERROR
157167 | ^ returning this value requires that `'a` must outlive `'static`
158168
159169error: unsatisfied lifetime constraints
160- --> $DIR/patterns.rs:117:18
170+ --> $DIR/patterns.rs:130:5
171+ |
172+ LL | fn static_to_a_to_static_through_struct<'a>(_x: &'a u32) -> &'static u32 {
173+ | -- lifetime `'a` defined here
174+ LL | let Single { value: y }: Single<&'a u32> = Single { value: &22 };
175+ LL | y //~ ERROR
176+ | ^ returning this value requires that `'a` must outlive `'static`
177+
178+ error: unsatisfied lifetime constraints
179+ --> $DIR/patterns.rs:134:18
161180 |
162181LL | fn a_to_static_then_static<'a>(x: &'a u32) -> &'static u32 {
163182 | -- lifetime `'a` defined here
164183LL | let (y, _z): (&'static u32, u32) = (x, 44); //~ ERROR
165184 | ^^^^^^^^^^^^^^^^^^^ type annotation requires that `'a` must outlive `'static`
166185
167- error: aborting due to 17 previous errors
186+ error: aborting due to 19 previous errors
168187
169188Some errors occurred: E0597, E0716.
170189For more information about an error, try `rustc --explain E0597`.
0 commit comments