fork/rust

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

borsAuto merge of #68568 - pietroalbini:stable-next, r=pietroalbini5e1a799842b

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