@@ -40,7 +40,17 @@ LL | }
40
40
| - `x` dropped here while still borrowed
41
41
42
42
error[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
44
54
|
45
55
LL | let y: &'static u32 = &x; //~ ERROR
46
56
| ------------ ^^ borrowed value does not live long enough
50
60
| - `x` dropped here while still borrowed
51
61
52
62
error[E0597]: `x` does not live long enough
53
- --> $DIR/patterns.rs:51 :27
63
+ --> $DIR/patterns.rs:63 :27
54
64
|
55
65
LL | let _: &'static u32 = &x; //~ ERROR
56
66
| ------------ ^^ borrowed value does not live long enough
61
71
| - `x` dropped here while still borrowed
62
72
63
73
error[E0716]: temporary value dropped while borrowed
64
- --> $DIR/patterns.rs:53 :41
74
+ --> $DIR/patterns.rs:65 :41
65
75
|
66
76
LL | let _: Vec<&'static String> = vec![&String::new()];
67
77
| -------------------- ^^^^^^^^^^^^^ - temporary value is freed at the end of this statement
@@ -70,7 +80,7 @@ LL | let _: Vec<&'static String> = vec![&String::new()];
70
80
| type annotation requires that borrow lasts for `'static`
71
81
72
82
error[E0716]: temporary value dropped while borrowed
73
- --> $DIR/patterns.rs:56 :52
83
+ --> $DIR/patterns.rs:68 :52
74
84
|
75
85
LL | let (_, a): (Vec<&'static String>, _) = (vec![&String::new()], 44);
76
86
| ------------------------- ^^^^^^^^^^^^^ - temporary value is freed at the end of this statement
@@ -79,7 +89,7 @@ LL | let (_, a): (Vec<&'static String>, _) = (vec![&String::new()], 44);
79
89
| type annotation requires that borrow lasts for `'static`
80
90
81
91
error[E0716]: temporary value dropped while borrowed
82
- --> $DIR/patterns.rs:59 :53
92
+ --> $DIR/patterns.rs:71 :53
83
93
|
84
94
LL | let (_a, b): (Vec<&'static String>, _) = (vec![&String::new()], 44);
85
95
| ------------------------- ^^^^^^^^^^^^^ - 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);
88
98
| type annotation requires that borrow lasts for `'static`
89
99
90
100
error[E0597]: `x` does not live long enough
91
- --> $DIR/patterns.rs:65 :40
101
+ --> $DIR/patterns.rs:77 :40
92
102
|
93
103
LL | let (_, _): (&'static u32, u32) = (&x, 44); //~ ERROR
94
104
| ------------------- ^^ borrowed value does not live long enough
@@ -98,7 +108,7 @@ LL | }
98
108
| - `x` dropped here while still borrowed
99
109
100
110
error[E0597]: `x` does not live long enough
101
- --> $DIR/patterns.rs:70 :40
111
+ --> $DIR/patterns.rs:82 :40
102
112
|
103
113
LL | let (y, _): (&'static u32, u32) = (&x, 44); //~ ERROR
104
114
| ------------------- ^^ borrowed value does not live long enough
@@ -108,7 +118,7 @@ LL | }
108
118
| - `x` dropped here while still borrowed
109
119
110
120
error[E0597]: `x` does not live long enough
111
- --> $DIR/patterns.rs:75 :69
121
+ --> $DIR/patterns.rs:87 :69
112
122
|
113
123
LL | let Single { value: y }: Single<&'static u32> = Single { value: &x }; //~ ERROR
114
124
| -------------------- ^^ borrowed value does not live long enough
@@ -118,7 +128,7 @@ LL | }
118
128
| - `x` dropped here while still borrowed
119
129
120
130
error[E0597]: `x` does not live long enough
121
- --> $DIR/patterns.rs:80 :69
131
+ --> $DIR/patterns.rs:92 :69
122
132
|
123
133
LL | let Single { value: _ }: Single<&'static u32> = Single { value: &x }; //~ ERROR
124
134
| -------------------- ^^ borrowed value does not live long enough
@@ -128,7 +138,7 @@ LL | }
128
138
| - `x` dropped here while still borrowed
129
139
130
140
error[E0597]: `x` does not live long enough
131
- --> $DIR/patterns.rs:88 :17
141
+ --> $DIR/patterns.rs:100 :17
132
142
|
133
143
LL | let Double { value1: _, value2: _ }: Double<&'static u32> = Double {
134
144
| -------------------- type annotation requires that `x` is borrowed for `'static`
@@ -139,7 +149,7 @@ LL | }
139
149
| - `x` dropped here while still borrowed
140
150
141
151
error: unsatisfied lifetime constraints
142
- --> $DIR/patterns.rs:101 :5
152
+ --> $DIR/patterns.rs:113 :5
143
153
|
144
154
LL | fn static_to_a_to_static_through_variable<'a>(x: &'a u32) -> &'static u32 {
145
155
| -- lifetime `'a` defined here
@@ -148,7 +158,7 @@ LL | y //~ ERROR
148
158
| ^ returning this value requires that `'a` must outlive `'static`
149
159
150
160
error: unsatisfied lifetime constraints
151
- --> $DIR/patterns.rs:113 :5
161
+ --> $DIR/patterns.rs:125 :5
152
162
|
153
163
LL | fn static_to_a_to_static_through_tuple<'a>(x: &'a u32) -> &'static u32 {
154
164
| -- lifetime `'a` defined here
@@ -157,14 +167,23 @@ LL | y //~ ERROR
157
167
| ^ returning this value requires that `'a` must outlive `'static`
158
168
159
169
error: 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
161
180
|
162
181
LL | fn a_to_static_then_static<'a>(x: &'a u32) -> &'static u32 {
163
182
| -- lifetime `'a` defined here
164
183
LL | let (y, _z): (&'static u32, u32) = (x, 44); //~ ERROR
165
184
| ^^^^^^^^^^^^^^^^^^^ type annotation requires that `'a` must outlive `'static`
166
185
167
- error: aborting due to 17 previous errors
186
+ error: aborting due to 19 previous errors
168
187
169
188
Some errors occurred: E0597, E0716.
170
189
For more information about an error, try `rustc --explain E0597`.
0 commit comments