11error[E0716]: temporary value dropped while borrowed
2-   --> $DIR/promote-not.rs:8 :50
2+   --> $DIR/promote-not.rs:9 :50
33   |
44LL | static mut TEST1: Option<&mut [i32]> = Some(&mut [1, 2, 3]);
55   |                                        ----------^^^^^^^^^-
@@ -9,7 +9,7 @@ LL | static mut TEST1: Option<&mut [i32]> = Some(&mut [1, 2, 3]);
99   |                                        using this value as a static requires that borrow lasts for `'static`
1010
1111error[E0716]: temporary value dropped while borrowed
12-   --> $DIR/promote-not.rs:11 :18
12+   --> $DIR/promote-not.rs:12 :18
1313   |
1414LL |     let x = &mut [1,2,3];
1515   |                  ^^^^^^^ creates a temporary value which is freed while still in use
@@ -19,7 +19,7 @@ LL | };
1919   | - temporary value is freed at the end of this statement
2020
2121error[E0716]: temporary value dropped while borrowed
22-   --> $DIR/promote-not.rs:33 :29
22+   --> $DIR/promote-not.rs:34 :29
2323   |
2424LL |     let _x: &'static i32 = &unsafe { U { x: 0 }.x };
2525   |             ------------    ^^^^^^^^^^^^^^^^^^^^^^^ creates a temporary value which is freed while still in use
@@ -29,7 +29,7 @@ LL | };
2929   | - temporary value is freed at the end of this statement
3030
3131error[E0716]: temporary value dropped while borrowed
32-   --> $DIR/promote-not.rs:39 :29
32+   --> $DIR/promote-not.rs:40 :29
3333   |
3434LL |     let _val: &'static _ = &(Cell::new(1), 2).1;
3535   |               ----------    ^^^^^^^^^^^^^^^^^ creates a temporary value which is freed while still in use
@@ -38,8 +38,17 @@ LL |     let _val: &'static _ = &(Cell::new(1), 2).1;
3838LL | };
3939   | - temporary value is freed at the end of this statement
4040
41+ error[E0493]: destructor of `String` cannot be evaluated at compile-time
42+   --> $DIR/promote-not.rs:47:14
43+    |
44+ LL |     let x = &String::new();
45+    |              ^^^^^^^^^^^^^ the destructor for this type cannot be evaluated in constants
46+ ...
47+ LL | };
48+    | - value is dropped here
49+ 
4150error[E0716]: temporary value dropped while borrowed
42-   --> $DIR/promote-not.rs:20 :32
51+   --> $DIR/promote-not.rs:21 :32
4352   |
4453LL |         let _x: &'static () = &foo();
4554   |                 -----------    ^^^^^ creates a temporary value which is freed while still in use
4958   |     - temporary value is freed at the end of this statement
5059
5160error[E0716]: temporary value dropped while borrowed
52-   --> $DIR/promote-not.rs:28 :29
61+   --> $DIR/promote-not.rs:29 :29
5362   |
5463LL |     let _x: &'static i32 = &unsafe { U { x: 0 }.x };
5564   |             ------------    ^^^^^^^^^^^^^^^^^^^^^^^ creates a temporary value which is freed while still in use
5968   | - temporary value is freed at the end of this statement
6069
6170error[E0716]: temporary value dropped while borrowed
62-   --> $DIR/promote-not.rs:46 :29
71+   --> $DIR/promote-not.rs:56 :29
6372   |
6473LL |     let _val: &'static _ = &(Cell::new(1), 2).0;
6574   |               ----------    ^^^^^^^^^^^^^^^^^ creates a temporary value which is freed while still in use
7079   | - temporary value is freed at the end of this statement
7180
7281error[E0716]: temporary value dropped while borrowed
73-   --> $DIR/promote-not.rs:47 :29
82+   --> $DIR/promote-not.rs:57 :29
7483   |
7584LL |     let _val: &'static _ = &(Cell::new(1), 2).1;
7685   |               ----------    ^^^^^^^^^^^^^^^^^ creates a temporary value which is freed while still in use
8190   | - temporary value is freed at the end of this statement
8291
8392error[E0716]: temporary value dropped while borrowed
84-   --> $DIR/promote-not.rs:50 :29
93+   --> $DIR/promote-not.rs:60 :29
8594   |
8695LL |     let _val: &'static _ = &(1/0);
8796   |               ----------    ^^^^^ creates a temporary value which is freed while still in use
@@ -92,7 +101,7 @@ LL | }
92101   | - temporary value is freed at the end of this statement
93102
94103error[E0716]: temporary value dropped while borrowed
95-   --> $DIR/promote-not.rs:51 :29
104+   --> $DIR/promote-not.rs:61 :29
96105   |
97106LL |     let _val: &'static _ = &(1/(1-1));
98107   |               ----------    ^^^^^^^^^ creates a temporary value which is freed while still in use
@@ -103,7 +112,7 @@ LL | }
103112   | - temporary value is freed at the end of this statement
104113
105114error[E0716]: temporary value dropped while borrowed
106-   --> $DIR/promote-not.rs:52 :29
115+   --> $DIR/promote-not.rs:62 :29
107116   |
108117LL |     let _val: &'static _ = &((1+1)/(1-1));
109118   |               ----------    ^^^^^^^^^^^^^ creates a temporary value which is freed while still in use
@@ -114,7 +123,7 @@ LL | }
114123   | - temporary value is freed at the end of this statement
115124
116125error[E0716]: temporary value dropped while borrowed
117-   --> $DIR/promote-not.rs:53 :29
126+   --> $DIR/promote-not.rs:63 :29
118127   |
119128LL |     let _val: &'static _ = &(i32::MIN/-1);
120129   |               ----------    ^^^^^^^^^^^^^ creates a temporary value which is freed while still in use
@@ -125,7 +134,7 @@ LL | }
125134   | - temporary value is freed at the end of this statement
126135
127136error[E0716]: temporary value dropped while borrowed
128-   --> $DIR/promote-not.rs:54 :29
137+   --> $DIR/promote-not.rs:64 :29
129138   |
130139LL |     let _val: &'static _ = &(i32::MIN/(0-1));
131140   |               ----------    ^^^^^^^^^^^^^^^^ creates a temporary value which is freed while still in use
@@ -136,7 +145,7 @@ LL | }
136145   | - temporary value is freed at the end of this statement
137146
138147error[E0716]: temporary value dropped while borrowed
139-   --> $DIR/promote-not.rs:55 :29
148+   --> $DIR/promote-not.rs:65 :29
140149   |
141150LL |     let _val: &'static _ = &(-128i8/-1);
142151   |               ----------    ^^^^^^^^^^^ creates a temporary value which is freed while still in use
@@ -147,7 +156,7 @@ LL | }
147156   | - temporary value is freed at the end of this statement
148157
149158error[E0716]: temporary value dropped while borrowed
150-   --> $DIR/promote-not.rs:56 :29
159+   --> $DIR/promote-not.rs:66 :29
151160   |
152161LL |     let _val: &'static _ = &(1%0);
153162   |               ----------    ^^^^^ creates a temporary value which is freed while still in use
@@ -158,7 +167,7 @@ LL | }
158167   | - temporary value is freed at the end of this statement
159168
160169error[E0716]: temporary value dropped while borrowed
161-   --> $DIR/promote-not.rs:57 :29
170+   --> $DIR/promote-not.rs:67 :29
162171   |
163172LL |     let _val: &'static _ = &(1%(1-1));
164173   |               ----------    ^^^^^^^^^ creates a temporary value which is freed while still in use
@@ -169,7 +178,7 @@ LL | }
169178   | - temporary value is freed at the end of this statement
170179
171180error[E0716]: temporary value dropped while borrowed
172-   --> $DIR/promote-not.rs:58 :29
181+   --> $DIR/promote-not.rs:68 :29
173182   |
174183LL |     let _val: &'static _ = &([1,2,3][4]+1);
175184   |               ----------    ^^^^^^^^^^^^^^ creates a temporary value which is freed while still in use
@@ -180,7 +189,7 @@ LL | }
180189   | - temporary value is freed at the end of this statement
181190
182191error[E0716]: temporary value dropped while borrowed
183-   --> $DIR/promote-not.rs:61 :29
192+   --> $DIR/promote-not.rs:72 :29
184193   |
185194LL |     let _val: &'static _ = &TEST_DROP;
186195   |               ----------    ^^^^^^^^^ creates a temporary value which is freed while still in use
@@ -191,7 +200,7 @@ LL | }
191200   | - temporary value is freed at the end of this statement
192201
193202error[E0716]: temporary value dropped while borrowed
194-   --> $DIR/promote-not.rs:63 :29
203+   --> $DIR/promote-not.rs:74 :29
195204   |
196205LL |     let _val: &'static _ = &&TEST_DROP;
197206   |               ----------    ^^^^^^^^^^ creates a temporary value which is freed while still in use
@@ -202,7 +211,7 @@ LL | }
202211   | - temporary value is freed at the end of this statement
203212
204213error[E0716]: temporary value dropped while borrowed
205-   --> $DIR/promote-not.rs:63 :30
214+   --> $DIR/promote-not.rs:74 :30
206215   |
207216LL |     let _val: &'static _ = &&TEST_DROP;
208217   |               ----------     ^^^^^^^^^ creates a temporary value which is freed while still in use
@@ -213,7 +222,7 @@ LL | }
213222   | - temporary value is freed at the end of this statement
214223
215224error[E0716]: temporary value dropped while borrowed
216-   --> $DIR/promote-not.rs:66 :29
225+   --> $DIR/promote-not.rs:77 :29
217226   |
218227LL |     let _val: &'static _ = &(&TEST_DROP,);
219228   |               ----------    ^^^^^^^^^^^^^ creates a temporary value which is freed while still in use
@@ -224,7 +233,7 @@ LL | }
224233   | - temporary value is freed at the end of this statement
225234
226235error[E0716]: temporary value dropped while borrowed
227-   --> $DIR/promote-not.rs:66 :31
236+   --> $DIR/promote-not.rs:77 :31
228237   |
229238LL |     let _val: &'static _ = &(&TEST_DROP,);
230239   |               ----------      ^^^^^^^^^ creates a temporary value which is freed while still in use
@@ -235,7 +244,7 @@ LL | }
235244   | - temporary value is freed at the end of this statement
236245
237246error[E0716]: temporary value dropped while borrowed
238-   --> $DIR/promote-not.rs:69 :29
247+   --> $DIR/promote-not.rs:80 :29
239248   |
240249LL |     let _val: &'static _ = &[&TEST_DROP; 1];
241250   |               ----------    ^^^^^^^^^^^^^^^ creates a temporary value which is freed while still in use
@@ -246,14 +255,26 @@ LL | }
246255   | - temporary value is freed at the end of this statement
247256
248257error[E0716]: temporary value dropped while borrowed
249-   --> $DIR/promote-not.rs:69 :31
258+   --> $DIR/promote-not.rs:80 :31
250259   |
251260LL |     let _val: &'static _ = &[&TEST_DROP; 1];
252261   |               ----------      ^^^^^^^^^    - temporary value is freed at the end of this statement
253262   |               |               |
254263   |               |               creates a temporary value which is freed while still in use
255264   |               type annotation requires that borrow lasts for `'static`
256265
257- error: aborting due to 24 previous errors
266+ error[E0716]: temporary value dropped while borrowed
267+   --> $DIR/promote-not.rs:89:26
268+    |
269+ LL |     let x: &'static _ = &UnionWithCell { f1: 0 };
270+    |            ----------    ^^^^^^^^^^^^^^^^^^^^^^^ creates a temporary value which is freed while still in use
271+    |            |
272+    |            type annotation requires that borrow lasts for `'static`
273+ LL |
274+ LL | }
275+    | - temporary value is freed at the end of this statement
276+ 
277+ error: aborting due to 26 previous errors
258278
259- For more information about this error, try `rustc --explain E0716`.
279+ Some errors have detailed explanations: E0493, E0716.
280+ For more information about an error, try `rustc --explain E0493`.
0 commit comments