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
@@ -39,7 +39,7 @@ LL | };
3939   | - temporary value is freed at the end of this statement
4040
4141error[E0716]: temporary value dropped while borrowed
42-   --> $DIR/promote-not.rs:20 :32
42+   --> $DIR/promote-not.rs:21 :32
4343   |
4444LL |         let _x: &'static () = &foo();
4545   |                 -----------    ^^^^^ creates a temporary value which is freed while still in use
4949   |     - temporary value is freed at the end of this statement
5050
5151error[E0716]: temporary value dropped while borrowed
52-   --> $DIR/promote-not.rs:28 :29
52+   --> $DIR/promote-not.rs:29 :29
5353   |
5454LL |     let _x: &'static i32 = &unsafe { U { x: 0 }.x };
5555   |             ------------    ^^^^^^^^^^^^^^^^^^^^^^^ creates a temporary value which is freed while still in use
5959   | - temporary value is freed at the end of this statement
6060
6161error[E0716]: temporary value dropped while borrowed
62-   --> $DIR/promote-not.rs:46 :29
62+   --> $DIR/promote-not.rs:47 :29
6363   |
6464LL |     let _val: &'static _ = &(Cell::new(1), 2).0;
6565   |               ----------    ^^^^^^^^^^^^^^^^^ creates a temporary value which is freed while still in use
7070   | - temporary value is freed at the end of this statement
7171
7272error[E0716]: temporary value dropped while borrowed
73-   --> $DIR/promote-not.rs:47 :29
73+   --> $DIR/promote-not.rs:48 :29
7474   |
7575LL |     let _val: &'static _ = &(Cell::new(1), 2).1;
7676   |               ----------    ^^^^^^^^^^^^^^^^^ creates a temporary value which is freed while still in use
8181   | - temporary value is freed at the end of this statement
8282
8383error[E0716]: temporary value dropped while borrowed
84-   --> $DIR/promote-not.rs:50 :29
84+   --> $DIR/promote-not.rs:51 :29
8585   |
8686LL |     let _val: &'static _ = &(1/0);
8787   |               ----------    ^^^^^ creates a temporary value which is freed while still in use
9292   | - temporary value is freed at the end of this statement
9393
9494error[E0716]: temporary value dropped while borrowed
95-   --> $DIR/promote-not.rs:51 :29
95+   --> $DIR/promote-not.rs:52 :29
9696   |
9797LL |     let _val: &'static _ = &(1/(1-1));
9898   |               ----------    ^^^^^^^^^ creates a temporary value which is freed while still in use
@@ -103,7 +103,7 @@ LL | }
103103   | - temporary value is freed at the end of this statement
104104
105105error[E0716]: temporary value dropped while borrowed
106-   --> $DIR/promote-not.rs:52 :29
106+   --> $DIR/promote-not.rs:53 :29
107107   |
108108LL |     let _val: &'static _ = &((1+1)/(1-1));
109109   |               ----------    ^^^^^^^^^^^^^ creates a temporary value which is freed while still in use
@@ -114,7 +114,7 @@ LL | }
114114   | - temporary value is freed at the end of this statement
115115
116116error[E0716]: temporary value dropped while borrowed
117-   --> $DIR/promote-not.rs:53 :29
117+   --> $DIR/promote-not.rs:54 :29
118118   |
119119LL |     let _val: &'static _ = &(i32::MIN/-1);
120120   |               ----------    ^^^^^^^^^^^^^ creates a temporary value which is freed while still in use
@@ -125,7 +125,7 @@ LL | }
125125   | - temporary value is freed at the end of this statement
126126
127127error[E0716]: temporary value dropped while borrowed
128-   --> $DIR/promote-not.rs:54 :29
128+   --> $DIR/promote-not.rs:55 :29
129129   |
130130LL |     let _val: &'static _ = &(i32::MIN/(0-1));
131131   |               ----------    ^^^^^^^^^^^^^^^^ creates a temporary value which is freed while still in use
@@ -136,7 +136,7 @@ LL | }
136136   | - temporary value is freed at the end of this statement
137137
138138error[E0716]: temporary value dropped while borrowed
139-   --> $DIR/promote-not.rs:55 :29
139+   --> $DIR/promote-not.rs:56 :29
140140   |
141141LL |     let _val: &'static _ = &(-128i8/-1);
142142   |               ----------    ^^^^^^^^^^^ creates a temporary value which is freed while still in use
@@ -147,7 +147,7 @@ LL | }
147147   | - temporary value is freed at the end of this statement
148148
149149error[E0716]: temporary value dropped while borrowed
150-   --> $DIR/promote-not.rs:56 :29
150+   --> $DIR/promote-not.rs:57 :29
151151   |
152152LL |     let _val: &'static _ = &(1%0);
153153   |               ----------    ^^^^^ creates a temporary value which is freed while still in use
@@ -158,7 +158,7 @@ LL | }
158158   | - temporary value is freed at the end of this statement
159159
160160error[E0716]: temporary value dropped while borrowed
161-   --> $DIR/promote-not.rs:57 :29
161+   --> $DIR/promote-not.rs:58 :29
162162   |
163163LL |     let _val: &'static _ = &(1%(1-1));
164164   |               ----------    ^^^^^^^^^ creates a temporary value which is freed while still in use
@@ -169,7 +169,7 @@ LL | }
169169   | - temporary value is freed at the end of this statement
170170
171171error[E0716]: temporary value dropped while borrowed
172-   --> $DIR/promote-not.rs:58 :29
172+   --> $DIR/promote-not.rs:59 :29
173173   |
174174LL |     let _val: &'static _ = &([1,2,3][4]+1);
175175   |               ----------    ^^^^^^^^^^^^^^ creates a temporary value which is freed while still in use
@@ -180,7 +180,7 @@ LL | }
180180   | - temporary value is freed at the end of this statement
181181
182182error[E0716]: temporary value dropped while borrowed
183-   --> $DIR/promote-not.rs:61 :29
183+   --> $DIR/promote-not.rs:62 :29
184184   |
185185LL |     let _val: &'static _ = &TEST_DROP;
186186   |               ----------    ^^^^^^^^^ creates a temporary value which is freed while still in use
@@ -191,7 +191,7 @@ LL | }
191191   | - temporary value is freed at the end of this statement
192192
193193error[E0716]: temporary value dropped while borrowed
194-   --> $DIR/promote-not.rs:63 :29
194+   --> $DIR/promote-not.rs:64 :29
195195   |
196196LL |     let _val: &'static _ = &&TEST_DROP;
197197   |               ----------    ^^^^^^^^^^ creates a temporary value which is freed while still in use
@@ -202,7 +202,7 @@ LL | }
202202   | - temporary value is freed at the end of this statement
203203
204204error[E0716]: temporary value dropped while borrowed
205-   --> $DIR/promote-not.rs:63 :30
205+   --> $DIR/promote-not.rs:64 :30
206206   |
207207LL |     let _val: &'static _ = &&TEST_DROP;
208208   |               ----------     ^^^^^^^^^ creates a temporary value which is freed while still in use
@@ -213,7 +213,7 @@ LL | }
213213   | - temporary value is freed at the end of this statement
214214
215215error[E0716]: temporary value dropped while borrowed
216-   --> $DIR/promote-not.rs:66 :29
216+   --> $DIR/promote-not.rs:67 :29
217217   |
218218LL |     let _val: &'static _ = &(&TEST_DROP,);
219219   |               ----------    ^^^^^^^^^^^^^ creates a temporary value which is freed while still in use
@@ -224,7 +224,7 @@ LL | }
224224   | - temporary value is freed at the end of this statement
225225
226226error[E0716]: temporary value dropped while borrowed
227-   --> $DIR/promote-not.rs:66 :31
227+   --> $DIR/promote-not.rs:67 :31
228228   |
229229LL |     let _val: &'static _ = &(&TEST_DROP,);
230230   |               ----------      ^^^^^^^^^ creates a temporary value which is freed while still in use
@@ -235,7 +235,7 @@ LL | }
235235   | - temporary value is freed at the end of this statement
236236
237237error[E0716]: temporary value dropped while borrowed
238-   --> $DIR/promote-not.rs:69 :29
238+   --> $DIR/promote-not.rs:70 :29
239239   |
240240LL |     let _val: &'static _ = &[&TEST_DROP; 1];
241241   |               ----------    ^^^^^^^^^^^^^^^ creates a temporary value which is freed while still in use
@@ -246,14 +246,25 @@ LL | }
246246   | - temporary value is freed at the end of this statement
247247
248248error[E0716]: temporary value dropped while borrowed
249-   --> $DIR/promote-not.rs:69 :31
249+   --> $DIR/promote-not.rs:70 :31
250250   |
251251LL |     let _val: &'static _ = &[&TEST_DROP; 1];
252252   |               ----------      ^^^^^^^^^    - temporary value is freed at the end of this statement
253253   |               |               |
254254   |               |               creates a temporary value which is freed while still in use
255255   |               type annotation requires that borrow lasts for `'static`
256256
257- error: aborting due to 24 previous errors
257+ error[E0716]: temporary value dropped while borrowed
258+   --> $DIR/promote-not.rs:79:26
259+    |
260+ LL |     let x: &'static _ = &UnionWithCell { f1: 0 };
261+    |            ----------    ^^^^^^^^^^^^^^^^^^^^^^^ creates a temporary value which is freed while still in use
262+    |            |
263+    |            type annotation requires that borrow lasts for `'static`
264+ LL |
265+ LL | }
266+    | - temporary value is freed at the end of this statement
267+ 
268+ error: aborting due to 25 previous errors
258269
259270For more information about this error, try `rustc --explain E0716`.
0 commit comments