]> git.lizzy.rs Git - rust.git/blob - tests/ui/nll/user-annotations/patterns.stderr
Rollup merge of #106944 - Nilstrieb:there-once-was-a-diagnostic, r=WaffleLapkin
[rust.git] / tests / ui / nll / user-annotations / patterns.stderr
1 error[E0597]: `x` does not live long enough
2   --> $DIR/patterns.rs:6:9
3    |
4 LL |     let x = 22;
5    |         - binding `x` declared here
6 LL |     let y: &'static u32;
7    |            ------------ type annotation requires that `x` is borrowed for `'static`
8 LL |     y = &x;
9    |         ^^ borrowed value does not live long enough
10 LL | }
11    | - `x` dropped here while still borrowed
12
13 error[E0597]: `x` does not live long enough
14   --> $DIR/patterns.rs:14:9
15    |
16 LL |     let x = 22;
17    |         - binding `x` declared here
18 LL |     let (y, z): (&'static u32, &'static u32);
19    |                 ---------------------------- type annotation requires that `x` is borrowed for `'static`
20 LL |     y = &x;
21    |         ^^ borrowed value does not live long enough
22 LL | }
23    | - `x` dropped here while still borrowed
24
25 error[E0597]: `x` does not live long enough
26   --> $DIR/patterns.rs:20:13
27    |
28 LL |     let x = 22;
29    |         - binding `x` declared here
30 LL |     let y = &x;
31    |             ^^ borrowed value does not live long enough
32 LL |     let ref z: &'static u32 = y;
33    |                ------------ type annotation requires that `x` is borrowed for `'static`
34 LL |     **z
35 LL | }
36    | - `x` dropped here while still borrowed
37
38 error[E0597]: `x` does not live long enough
39   --> $DIR/patterns.rs:39:9
40    |
41 LL |     let x = 22;
42    |         - binding `x` declared here
43 LL |     let Single { value: y }: Single<&'static u32>;
44    |                              -------------------- type annotation requires that `x` is borrowed for `'static`
45 LL |     y = &x;
46    |         ^^ borrowed value does not live long enough
47 LL | }
48    | - `x` dropped here while still borrowed
49
50 error[E0597]: `x` does not live long enough
51   --> $DIR/patterns.rs:51:10
52    |
53 LL |     let x = 22;
54    |         - binding `x` declared here
55 LL |     let Single2 { value: mut _y }: Single2<StaticU32>;
56    |                                    ------------------ type annotation requires that `x` is borrowed for `'static`
57 LL |     _y = &x;
58    |          ^^ borrowed value does not live long enough
59 LL | }
60    | - `x` dropped here while still borrowed
61
62 error[E0597]: `x` does not live long enough
63   --> $DIR/patterns.rs:56:27
64    |
65 LL |     let x = 22;
66    |         - binding `x` declared here
67 LL |     let y: &'static u32 = &x;
68    |            ------------   ^^ borrowed value does not live long enough
69    |            |
70    |            type annotation requires that `x` is borrowed for `'static`
71 LL | }
72    | - `x` dropped here while still borrowed
73
74 error[E0597]: `x` does not live long enough
75   --> $DIR/patterns.rs:61:27
76    |
77 LL |     let x = 22;
78    |         - binding `x` declared here
79 LL |     let _: &'static u32 = &x;
80    |            ------------   ^^ borrowed value does not live long enough
81    |            |
82    |            type annotation requires that `x` is borrowed for `'static`
83 ...
84 LL | }
85    | - `x` dropped here while still borrowed
86
87 error[E0716]: temporary value dropped while borrowed
88   --> $DIR/patterns.rs:63:41
89    |
90 LL |     let _: Vec<&'static String> = vec![&String::new()];
91    |            --------------------         ^^^^^^^^^^^^^ - temporary value is freed at the end of this statement
92    |            |                            |
93    |            |                            creates a temporary value which is freed while still in use
94    |            type annotation requires that borrow lasts for `'static`
95
96 error[E0716]: temporary value dropped while borrowed
97   --> $DIR/patterns.rs:66:52
98    |
99 LL |     let (_, a): (Vec<&'static String>, _) = (vec![&String::new()], 44);
100    |                 -------------------------          ^^^^^^^^^^^^^      - temporary value is freed at the end of this statement
101    |                 |                                  |
102    |                 |                                  creates a temporary value which is freed while still in use
103    |                 type annotation requires that borrow lasts for `'static`
104
105 error[E0716]: temporary value dropped while borrowed
106   --> $DIR/patterns.rs:69:53
107    |
108 LL |     let (_a, b): (Vec<&'static String>, _) = (vec![&String::new()], 44);
109    |                  -------------------------          ^^^^^^^^^^^^^      - temporary value is freed at the end of this statement
110    |                  |                                  |
111    |                  |                                  creates a temporary value which is freed while still in use
112    |                  type annotation requires that borrow lasts for `'static`
113
114 error[E0597]: `x` does not live long enough
115   --> $DIR/patterns.rs:75:40
116    |
117 LL |     let x = 22;
118    |         - binding `x` declared here
119 LL |     let (_, _): (&'static u32, u32) = (&x, 44);
120    |                 -------------------    ^^ borrowed value does not live long enough
121    |                 |
122    |                 type annotation requires that `x` is borrowed for `'static`
123 LL | }
124    | - `x` dropped here while still borrowed
125
126 error[E0597]: `x` does not live long enough
127   --> $DIR/patterns.rs:80:40
128    |
129 LL |     let x = 22;
130    |         - binding `x` declared here
131 LL |     let (y, _): (&'static u32, u32) = (&x, 44);
132    |                 -------------------    ^^ borrowed value does not live long enough
133    |                 |
134    |                 type annotation requires that `x` is borrowed for `'static`
135 LL | }
136    | - `x` dropped here while still borrowed
137
138 error[E0597]: `x` does not live long enough
139   --> $DIR/patterns.rs:85:69
140    |
141 LL |     let x = 22;
142    |         - binding `x` declared here
143 LL |     let Single { value: y }: Single<&'static u32> = Single { value: &x };
144    |                              --------------------                   ^^ borrowed value does not live long enough
145    |                              |
146    |                              type annotation requires that `x` is borrowed for `'static`
147 LL | }
148    | - `x` dropped here while still borrowed
149
150 error[E0597]: `x` does not live long enough
151   --> $DIR/patterns.rs:90:69
152    |
153 LL |     let x = 22;
154    |         - binding `x` declared here
155 LL |     let Single { value: _ }: Single<&'static u32> = Single { value: &x };
156    |                              --------------------                   ^^ borrowed value does not live long enough
157    |                              |
158    |                              type annotation requires that `x` is borrowed for `'static`
159 LL | }
160    | - `x` dropped here while still borrowed
161
162 error[E0597]: `x` does not live long enough
163   --> $DIR/patterns.rs:98:17
164    |
165 LL |     let x = 22;
166    |         - binding `x` declared here
167 LL |     let Double { value1: _, value2: _ }: Double<&'static u32> = Double {
168    |                                          -------------------- type annotation requires that `x` is borrowed for `'static`
169 LL |         value1: &x,
170    |                 ^^ borrowed value does not live long enough
171 ...
172 LL | }
173    | - `x` dropped here while still borrowed
174
175 error: lifetime may not live long enough
176   --> $DIR/patterns.rs:111:5
177    |
178 LL | fn static_to_a_to_static_through_variable<'a>(x: &'a u32) -> &'static u32 {
179    |                                           -- lifetime `'a` defined here
180 ...
181 LL |     y
182    |     ^ returning this value requires that `'a` must outlive `'static`
183
184 error: lifetime may not live long enough
185   --> $DIR/patterns.rs:123:5
186    |
187 LL | fn static_to_a_to_static_through_tuple<'a>(x: &'a u32) -> &'static u32 {
188    |                                        -- lifetime `'a` defined here
189 ...
190 LL |     y
191    |     ^ returning this value requires that `'a` must outlive `'static`
192
193 error: lifetime may not live long enough
194   --> $DIR/patterns.rs:128:5
195    |
196 LL | fn static_to_a_to_static_through_struct<'a>(_x: &'a u32) -> &'static u32 {
197    |                                         -- lifetime `'a` defined here
198 LL |     let Single { value: y }: Single<&'a u32> = Single { value: &22 };
199 LL |     y
200    |     ^ returning this value requires that `'a` must outlive `'static`
201
202 error: lifetime may not live long enough
203   --> $DIR/patterns.rs:132:18
204    |
205 LL | fn a_to_static_then_static<'a>(x: &'a u32) -> &'static u32 {
206    |                            -- lifetime `'a` defined here
207 LL |     let (y, _z): (&'static u32, u32) = (x, 44);
208    |                  ^^^^^^^^^^^^^^^^^^^ type annotation requires that `'a` must outlive `'static`
209
210 error: aborting due to 19 previous errors
211
212 Some errors have detailed explanations: E0597, E0716.
213 For more information about an error, try `rustc --explain E0597`.