11error[E0716]: temporary value dropped while borrowed
2- --> $DIR/promote-not.rs:7 :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:10 :18
12+ --> $DIR/promote-not.rs:12 :18
1313 |
1414LL | let x = &mut [1,2,3];
1515 | ^^^^^^^ creates a temporary 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:19 :32
22+ --> $DIR/promote-not.rs:21 :32
2323 |
2424LL | let _x: &'static () = &foo();
2525 | ----------- ^^^^^ creates a temporary which is freed while still in use
2929 | - temporary value is freed at the end of this statement
3030
3131error[E0716]: temporary value dropped while borrowed
32- --> $DIR/promote-not.rs:27 :29
32+ --> $DIR/promote-not.rs:29 :29
3333 |
3434LL | let _x: &'static i32 = &unsafe { U { x: 0 }.x };
3535 | ------------ ^^^^^^^^^^^^^^^^^^^^^^^ creates a temporary which is freed while still in use
3939 | - temporary value is freed at the end of this statement
4040
4141error[E0716]: temporary value dropped while borrowed
42- --> $DIR/promote-not.rs:32 :29
42+ --> $DIR/promote-not.rs:34 :29
4343 |
4444LL | let _x: &'static i32 = &unsafe { U { x: 0 }.x };
4545 | ------------ ^^^^^^^^^^^^^^^^^^^^^^^ creates a temporary which is freed while still in use
@@ -48,6 +48,16 @@ LL | let _x: &'static i32 = &unsafe { U { x: 0 }.x };
4848LL | };
4949 | - temporary value is freed at the end of this statement
5050
51- error: aborting due to 5 previous errors
51+ error[E0716]: temporary value dropped while borrowed
52+ --> $DIR/promote-not.rs:39:29
53+ |
54+ LL | let _val: &'static _ = &(Cell::new(1), 2).0;
55+ | ---------- ^^^^^^^^^^^^^^^^^ creates a temporary which is freed while still in use
56+ | |
57+ | type annotation requires that borrow lasts for `'static`
58+ LL | }
59+ | - temporary value is freed at the end of this statement
60+
61+ error: aborting due to 6 previous errors
5262
5363For more information about this error, try `rustc --explain E0716`.
0 commit comments