error[E0716]: temporary value dropped while borrowed --> $DIR/promote-not.rs:9:50 | LL | static mut TEST1: Option<&mut [i32]> = Some(&mut [1, 2, 3]); | ----------^^^^^^^^^- | | | | | | | temporary value is freed at the end of this statement | | creates a temporary value which is freed while still in use | using this value as a static requires that borrow lasts for `'static` error[E0716]: temporary value dropped while borrowed --> $DIR/promote-not.rs:12:18 | LL | let x = &mut [1,2,3]; | ^^^^^^^ creates a temporary value which is freed while still in use LL | x | - using this value as a static requires that borrow lasts for `'static` LL | }; | - temporary value is freed at the end of this statement error[E0716]: temporary value dropped while borrowed --> $DIR/promote-not.rs:34:29 | LL | let _x: &'static i32 = &unsafe { U { x: 0 }.x }; | ------------ ^^^^^^^^^^^^^^^^^^^^^^^ creates a temporary value which is freed while still in use | | | type annotation requires that borrow lasts for `'static` LL | }; | - temporary value is freed at the end of this statement error[E0716]: temporary value dropped while borrowed --> $DIR/promote-not.rs:40:29 | LL | let _val: &'static _ = &(Cell::new(1), 2).1; | ---------- ^^^^^^^^^^^^^^^^^ creates a temporary value which is freed while still in use | | | type annotation requires that borrow lasts for `'static` LL | }; | - temporary value is freed at the end of this statement error[E0493]: destructor of `String` cannot be evaluated at compile-time --> $DIR/promote-not.rs:47:14 | LL | let x = &String::new(); | ^^^^^^^^^^^^^ the destructor for this type cannot be evaluated in constants ... LL | }; | - value is dropped here error[E0716]: temporary value dropped while borrowed --> $DIR/promote-not.rs:21:32 | LL | let _x: &'static () = &foo(); | ----------- ^^^^^ creates a temporary value which is freed while still in use | | | type annotation requires that borrow lasts for `'static` LL | } | - temporary value is freed at the end of this statement error[E0716]: temporary value dropped while borrowed --> $DIR/promote-not.rs:29:29 | LL | let _x: &'static i32 = &unsafe { U { x: 0 }.x }; | ------------ ^^^^^^^^^^^^^^^^^^^^^^^ creates a temporary value which is freed while still in use | | | type annotation requires that borrow lasts for `'static` LL | } | - temporary value is freed at the end of this statement error[E0716]: temporary value dropped while borrowed --> $DIR/promote-not.rs:56:29 | LL | let _val: &'static _ = &(Cell::new(1), 2).0; | ---------- ^^^^^^^^^^^^^^^^^ creates a temporary value which is freed while still in use | | | type annotation requires that borrow lasts for `'static` ... LL | } | - temporary value is freed at the end of this statement error[E0716]: temporary value dropped while borrowed --> $DIR/promote-not.rs:57:29 | LL | let _val: &'static _ = &(Cell::new(1), 2).1; | ---------- ^^^^^^^^^^^^^^^^^ creates a temporary value which is freed while still in use | | | type annotation requires that borrow lasts for `'static` ... LL | } | - temporary value is freed at the end of this statement error[E0716]: temporary value dropped while borrowed --> $DIR/promote-not.rs:60:29 | LL | let _val: &'static _ = &(1/0); | ---------- ^^^^^ creates a temporary value which is freed while still in use | | | type annotation requires that borrow lasts for `'static` ... LL | } | - temporary value is freed at the end of this statement error[E0716]: temporary value dropped while borrowed --> $DIR/promote-not.rs:61:29 | LL | let _val: &'static _ = &(1/(1-1)); | ---------- ^^^^^^^^^ creates a temporary value which is freed while still in use | | | type annotation requires that borrow lasts for `'static` ... LL | } | - temporary value is freed at the end of this statement error[E0716]: temporary value dropped while borrowed --> $DIR/promote-not.rs:62:29 | LL | let _val: &'static _ = &((1+1)/(1-1)); | ---------- ^^^^^^^^^^^^^ creates a temporary value which is freed while still in use | | | type annotation requires that borrow lasts for `'static` ... LL | } | - temporary value is freed at the end of this statement error[E0716]: temporary value dropped while borrowed --> $DIR/promote-not.rs:63:29 | LL | let _val: &'static _ = &(i32::MIN/-1); | ---------- ^^^^^^^^^^^^^ creates a temporary value which is freed while still in use | | | type annotation requires that borrow lasts for `'static` ... LL | } | - temporary value is freed at the end of this statement error[E0716]: temporary value dropped while borrowed --> $DIR/promote-not.rs:64:29 | LL | let _val: &'static _ = &(i32::MIN/(0-1)); | ---------- ^^^^^^^^^^^^^^^^ creates a temporary value which is freed while still in use | | | type annotation requires that borrow lasts for `'static` ... LL | } | - temporary value is freed at the end of this statement error[E0716]: temporary value dropped while borrowed --> $DIR/promote-not.rs:65:29 | LL | let _val: &'static _ = &(-128i8/-1); | ---------- ^^^^^^^^^^^ creates a temporary value which is freed while still in use | | | type annotation requires that borrow lasts for `'static` ... LL | } | - temporary value is freed at the end of this statement error[E0716]: temporary value dropped while borrowed --> $DIR/promote-not.rs:66:29 | LL | let _val: &'static _ = &(1%0); | ---------- ^^^^^ creates a temporary value which is freed while still in use | | | type annotation requires that borrow lasts for `'static` ... LL | } | - temporary value is freed at the end of this statement error[E0716]: temporary value dropped while borrowed --> $DIR/promote-not.rs:67:29 | LL | let _val: &'static _ = &(1%(1-1)); | ---------- ^^^^^^^^^ creates a temporary value which is freed while still in use | | | type annotation requires that borrow lasts for `'static` ... LL | } | - temporary value is freed at the end of this statement error[E0716]: temporary value dropped while borrowed --> $DIR/promote-not.rs:68:29 | LL | let _val: &'static _ = &([1,2,3][4]+1); | ---------- ^^^^^^^^^^^^^^ creates a temporary value which is freed while still in use | | | type annotation requires that borrow lasts for `'static` ... LL | } | - temporary value is freed at the end of this statement error[E0716]: temporary value dropped while borrowed --> $DIR/promote-not.rs:72:29 | LL | let _val: &'static _ = &TEST_DROP; | ---------- ^^^^^^^^^ creates a temporary value which is freed while still in use | | | type annotation requires that borrow lasts for `'static` ... LL | } | - temporary value is freed at the end of this statement error[E0716]: temporary value dropped while borrowed --> $DIR/promote-not.rs:74:29 | LL | let _val: &'static _ = &&TEST_DROP; | ---------- ^^^^^^^^^^ creates a temporary value which is freed while still in use | | | type annotation requires that borrow lasts for `'static` ... LL | } | - temporary value is freed at the end of this statement error[E0716]: temporary value dropped while borrowed --> $DIR/promote-not.rs:74:30 | LL | let _val: &'static _ = &&TEST_DROP; | ---------- ^^^^^^^^^ creates a temporary value which is freed while still in use | | | type annotation requires that borrow lasts for `'static` ... LL | } | - temporary value is freed at the end of this statement error[E0716]: temporary value dropped while borrowed --> $DIR/promote-not.rs:77:29 | LL | let _val: &'static _ = &(&TEST_DROP,); | ---------- ^^^^^^^^^^^^^ creates a temporary value which is freed while still in use | | | type annotation requires that borrow lasts for `'static` ... LL | } | - temporary value is freed at the end of this statement error[E0716]: temporary value dropped while borrowed --> $DIR/promote-not.rs:77:31 | LL | let _val: &'static _ = &(&TEST_DROP,); | ---------- ^^^^^^^^^ creates a temporary value which is freed while still in use | | | type annotation requires that borrow lasts for `'static` ... LL | } | - temporary value is freed at the end of this statement error[E0716]: temporary value dropped while borrowed --> $DIR/promote-not.rs:80:29 | LL | let _val: &'static _ = &[&TEST_DROP; 1]; | ---------- ^^^^^^^^^^^^^^^ creates a temporary value which is freed while still in use | | | type annotation requires that borrow lasts for `'static` ... LL | } | - temporary value is freed at the end of this statement error[E0716]: temporary value dropped while borrowed --> $DIR/promote-not.rs:80:31 | LL | let _val: &'static _ = &[&TEST_DROP; 1]; | ---------- ^^^^^^^^^ - temporary value is freed at the end of this statement | | | | | creates a temporary value which is freed while still in use | type annotation requires that borrow lasts for `'static` error[E0716]: temporary value dropped while borrowed --> $DIR/promote-not.rs:89:26 | LL | let x: &'static _ = &UnionWithCell { f1: 0 }; | ---------- ^^^^^^^^^^^^^^^^^^^^^^^ creates a temporary value which is freed while still in use | | | type annotation requires that borrow lasts for `'static` LL | LL | } | - temporary value is freed at the end of this statement error: aborting due to 26 previous errors Some errors have detailed explanations: E0493, E0716. For more information about an error, try `rustc --explain E0493`.