fork/rust

git clone https://git.julia.blue/fork/rust

borsAuto merge of #103046 - JanBeh:PR_clarify_cmp_terminology, r=workingjubilee3bcad65fbf6

master
8.3 KiB213 linesraw
1error[E0597]: `x` does not live long enough
2  --> $DIR/patterns.rs:6:9
3   |
4LL |     let x = 22;
5   |         - binding `x` declared here
6LL |     let y: &'static u32;
7   |            ------------ type annotation requires that `x` is borrowed for `'static`
8LL |     y = &x;
9   |         ^^ borrowed value does not live long enough
10LL | }
11   | - `x` dropped here while still borrowed
12
13error[E0597]: `x` does not live long enough
14  --> $DIR/patterns.rs:14:9
15   |
16LL |     let x = 22;
17   |         - binding `x` declared here
18LL |     let (y, z): (&'static u32, &'static u32);
19   |                 ---------------------------- type annotation requires that `x` is borrowed for `'static`
20LL |     y = &x;
21   |         ^^ borrowed value does not live long enough
22LL | }
23   | - `x` dropped here while still borrowed
24
25error[E0597]: `x` does not live long enough
26  --> $DIR/patterns.rs:20:13
27   |
28LL |     let x = 22;
29   |         - binding `x` declared here
30LL |     let y = &x;
31   |             ^^ borrowed value does not live long enough
32LL |     let ref z: &'static u32 = y;
33   |                ------------ type annotation requires that `x` is borrowed for `'static`
34LL |     **z
35LL | }
36   | - `x` dropped here while still borrowed
37
38error[E0597]: `x` does not live long enough
39  --> $DIR/patterns.rs:39:9
40   |
41LL |     let x = 22;
42   |         - binding `x` declared here
43LL |     let Single { value: y }: Single<&'static u32>;
44   |                              -------------------- type annotation requires that `x` is borrowed for `'static`
45LL |     y = &x;
46   |         ^^ borrowed value does not live long enough
47LL | }
48   | - `x` dropped here while still borrowed
49
50error[E0597]: `x` does not live long enough
51  --> $DIR/patterns.rs:51:10
52   |
53LL |     let x = 22;
54   |         - binding `x` declared here
55LL |     let Single2 { value: mut _y }: Single2<StaticU32>;
56   |                                    ------------------ type annotation requires that `x` is borrowed for `'static`
57LL |     _y = &x;
58   |          ^^ borrowed value does not live long enough
59LL | }
60   | - `x` dropped here while still borrowed
61
62error[E0597]: `x` does not live long enough
63  --> $DIR/patterns.rs:56:27
64   |
65LL |     let x = 22;
66   |         - binding `x` declared here
67LL |     let y: &'static u32 = &x;
68   |            ------------   ^^ borrowed value does not live long enough
69   |            |
70   |            type annotation requires that `x` is borrowed for `'static`
71LL | }
72   | - `x` dropped here while still borrowed
73
74error[E0597]: `x` does not live long enough
75  --> $DIR/patterns.rs:61:27
76   |
77LL |     let x = 22;
78   |         - binding `x` declared here
79LL |     let _: &'static u32 = &x;
80   |            ------------   ^^ borrowed value does not live long enough
81   |            |
82   |            type annotation requires that `x` is borrowed for `'static`
83...
84LL | }
85   | - `x` dropped here while still borrowed
86
87error[E0716]: temporary value dropped while borrowed
88  --> $DIR/patterns.rs:63:41
89   |
90LL |     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
96error[E0716]: temporary value dropped while borrowed
97  --> $DIR/patterns.rs:66:52
98   |
99LL |     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
105error[E0716]: temporary value dropped while borrowed
106  --> $DIR/patterns.rs:69:53
107   |
108LL |     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
114error[E0597]: `x` does not live long enough
115  --> $DIR/patterns.rs:75:40
116   |
117LL |     let x = 22;
118   |         - binding `x` declared here
119LL |     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`
123LL | }
124   | - `x` dropped here while still borrowed
125
126error[E0597]: `x` does not live long enough
127  --> $DIR/patterns.rs:80:40
128   |
129LL |     let x = 22;
130   |         - binding `x` declared here
131LL |     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`
135LL | }
136   | - `x` dropped here while still borrowed
137
138error[E0597]: `x` does not live long enough
139  --> $DIR/patterns.rs:85:69
140   |
141LL |     let x = 22;
142   |         - binding `x` declared here
143LL |     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`
147LL | }
148   | - `x` dropped here while still borrowed
149
150error[E0597]: `x` does not live long enough
151  --> $DIR/patterns.rs:90:69
152   |
153LL |     let x = 22;
154   |         - binding `x` declared here
155LL |     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`
159LL | }
160   | - `x` dropped here while still borrowed
161
162error[E0597]: `x` does not live long enough
163  --> $DIR/patterns.rs:98:17
164   |
165LL |     let x = 22;
166   |         - binding `x` declared here
167LL |     let Double { value1: _, value2: _ }: Double<&'static u32> = Double {
168   |                                          -------------------- type annotation requires that `x` is borrowed for `'static`
169LL |         value1: &x,
170   |                 ^^ borrowed value does not live long enough
171...
172LL | }
173   | - `x` dropped here while still borrowed
174
175error: lifetime may not live long enough
176  --> $DIR/patterns.rs:111:5
177   |
178LL | fn static_to_a_to_static_through_variable<'a>(x: &'a u32) -> &'static u32 {
179   |                                           -- lifetime `'a` defined here
180...
181LL |     y
182   |     ^ returning this value requires that `'a` must outlive `'static`
183
184error: lifetime may not live long enough
185  --> $DIR/patterns.rs:123:5
186   |
187LL | fn static_to_a_to_static_through_tuple<'a>(x: &'a u32) -> &'static u32 {
188   |                                        -- lifetime `'a` defined here
189...
190LL |     y
191   |     ^ returning this value requires that `'a` must outlive `'static`
192
193error: lifetime may not live long enough
194  --> $DIR/patterns.rs:128:5
195   |
196LL | fn static_to_a_to_static_through_struct<'a>(_x: &'a u32) -> &'static u32 {
197   |                                         -- lifetime `'a` defined here
198LL |     let Single { value: y }: Single<&'a u32> = Single { value: &22 };
199LL |     y
200   |     ^ returning this value requires that `'a` must outlive `'static`
201
202error: lifetime may not live long enough
203  --> $DIR/patterns.rs:132:18
204   |
205LL | fn a_to_static_then_static<'a>(x: &'a u32) -> &'static u32 {
206   |                            -- lifetime `'a` defined here
207LL |     let (y, _z): (&'static u32, u32) = (x, 44);
208   |                  ^^^^^^^^^^^^^^^^^^^ type annotation requires that `'a` must outlive `'static`
209
210error: aborting due to 19 previous errors
211
212Some errors have detailed explanations: E0597, E0716.
213For more information about an error, try `rustc --explain E0597`.