Rollup merge of #103307 - b4den:master, r=estebank
Add context to compiler error message Changed `creates a temporary which is freed while still in use` to `creates a temporary value which is freed while still in use`.
This commit is contained in:
commit
46bc12c95a
@ -1557,7 +1557,7 @@ fn report_temporary_value_does_not_live_long_enough(
|
||||
}
|
||||
|
||||
let mut err = self.temporary_value_borrowed_for_too_long(proper_span);
|
||||
err.span_label(proper_span, "creates a temporary which is freed while still in use");
|
||||
err.span_label(proper_span, "creates a temporary value which is freed while still in use");
|
||||
err.span_label(drop_span, "temporary value is freed at the end of this statement");
|
||||
|
||||
match explanation {
|
||||
|
@ -1059,7 +1059,7 @@ impl<P, U> DispatchFromDyn<Pin<U>> for Pin<P> where P: DispatchFromDyn<U> {}
|
||||
/// 8 | let x: Pin<&mut Foo> = {
|
||||
/// | - borrow later stored here
|
||||
/// 9 | let x: Pin<&mut Foo> = pin!(Foo { /* … */ });
|
||||
/// | ^^^^^^^^^^^^^^^^^^^^^ creates a temporary which is freed while still in use
|
||||
/// | ^^^^^^^^^^^^^^^^^^^^^ creates a temporary value which is freed while still in use
|
||||
/// 10 | x
|
||||
/// 11 | }; // <- Foo is dropped
|
||||
/// | - temporary value is freed at the end of this statement
|
||||
|
@ -4,7 +4,7 @@ error[E0716]: temporary value dropped while borrowed
|
||||
LL | let x = defer(&vec!["Goodbye", "world!"]);
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^ - temporary value is freed at the end of this statement
|
||||
| |
|
||||
| creates a temporary which is freed while still in use
|
||||
| creates a temporary value which is freed while still in use
|
||||
LL | x.x[0];
|
||||
| ------ borrow later used here
|
||||
|
|
||||
|
@ -4,7 +4,7 @@ error[E0716]: temporary value dropped while borrowed
|
||||
LL | buggy_map.insert(42, &*Box::new(1));
|
||||
| ^^^^^^^^^^^ - temporary value is freed at the end of this statement
|
||||
| |
|
||||
| creates a temporary which is freed while still in use
|
||||
| creates a temporary value which is freed while still in use
|
||||
...
|
||||
LL | buggy_map.insert(43, &*tmp);
|
||||
| --------------------------- borrow later used here
|
||||
|
@ -4,7 +4,7 @@ error[E0716]: temporary value dropped while borrowed
|
||||
LL | let y = x.as_ref().unwrap_or(&id(5));
|
||||
| ^^^^^ - temporary value is freed at the end of this statement
|
||||
| |
|
||||
| creates a temporary which is freed while still in use
|
||||
| creates a temporary value which is freed while still in use
|
||||
LL | let _ = &y;
|
||||
| -- borrow later used here
|
||||
|
|
||||
|
@ -5,7 +5,7 @@ LL | pub fn foo<'a, F: Fn(&'a ())>(bar: F) {
|
||||
| -- lifetime `'a` defined here
|
||||
LL | / bar.call((
|
||||
LL | | &id(()),
|
||||
| | ^^^^^^ creates a temporary which is freed while still in use
|
||||
| | ^^^^^^ creates a temporary value which is freed while still in use
|
||||
LL | | ));
|
||||
| | -- temporary value is freed at the end of this statement
|
||||
| |______|
|
||||
|
@ -10,7 +10,7 @@ fn main() {
|
||||
let val: &_ = binding.0;
|
||||
//~^ ERROR temporary value dropped while borrowed [E0716]
|
||||
//~| NOTE temporary value is freed at the end of this statement
|
||||
//~| NOTE creates a temporary which is freed while still in use
|
||||
//~| NOTE creates a temporary value which is freed while still in use
|
||||
//~| HELP consider using a `let` binding to create a longer lived value
|
||||
println!("{}", val);
|
||||
//~^ borrow later used here
|
||||
|
@ -9,7 +9,7 @@ fn main() {
|
||||
let val: &_ = x.borrow().0;
|
||||
//~^ ERROR temporary value dropped while borrowed [E0716]
|
||||
//~| NOTE temporary value is freed at the end of this statement
|
||||
//~| NOTE creates a temporary which is freed while still in use
|
||||
//~| NOTE creates a temporary value which is freed while still in use
|
||||
//~| HELP consider using a `let` binding to create a longer lived value
|
||||
println!("{}", val);
|
||||
//~^ borrow later used here
|
||||
|
@ -4,7 +4,7 @@ error[E0716]: temporary value dropped while borrowed
|
||||
LL | let val: &_ = x.borrow().0;
|
||||
| ^^^^^^^^^^ - temporary value is freed at the end of this statement
|
||||
| |
|
||||
| creates a temporary which is freed while still in use
|
||||
| creates a temporary value which is freed while still in use
|
||||
...
|
||||
LL | println!("{}", val);
|
||||
| --- borrow later used here
|
||||
|
@ -4,7 +4,7 @@ error[E0716]: temporary value dropped while borrowed
|
||||
LL | let x1 = arg(&AddFlags(1));
|
||||
| ^^^^^^^^^^^ - temporary value is freed at the end of this statement
|
||||
| |
|
||||
| creates a temporary which is freed while still in use
|
||||
| creates a temporary value which is freed while still in use
|
||||
...
|
||||
LL | (x1, x2, x3, x4, x5, x6, x7);
|
||||
| -- borrow later used here
|
||||
@ -21,7 +21,7 @@ error[E0716]: temporary value dropped while borrowed
|
||||
LL | let x2 = AddFlags(1).get();
|
||||
| ^^^^^^^^^^^ - temporary value is freed at the end of this statement
|
||||
| |
|
||||
| creates a temporary which is freed while still in use
|
||||
| creates a temporary value which is freed while still in use
|
||||
...
|
||||
LL | (x1, x2, x3, x4, x5, x6, x7);
|
||||
| -- borrow later used here
|
||||
@ -38,7 +38,7 @@ error[E0716]: temporary value dropped while borrowed
|
||||
LL | let x3 = &*arg(&AddFlags(1));
|
||||
| ^^^^^^^^^^^ - temporary value is freed at the end of this statement
|
||||
| |
|
||||
| creates a temporary which is freed while still in use
|
||||
| creates a temporary value which is freed while still in use
|
||||
...
|
||||
LL | (x1, x2, x3, x4, x5, x6, x7);
|
||||
| -- borrow later used here
|
||||
@ -55,7 +55,7 @@ error[E0716]: temporary value dropped while borrowed
|
||||
LL | let ref x4 = *arg(&AddFlags(1));
|
||||
| ^^^^^^^^^^^ - temporary value is freed at the end of this statement
|
||||
| |
|
||||
| creates a temporary which is freed while still in use
|
||||
| creates a temporary value which is freed while still in use
|
||||
...
|
||||
LL | (x1, x2, x3, x4, x5, x6, x7);
|
||||
| -- borrow later used here
|
||||
@ -72,7 +72,7 @@ error[E0716]: temporary value dropped while borrowed
|
||||
LL | let &ref x5 = arg(&AddFlags(1));
|
||||
| ^^^^^^^^^^^ - temporary value is freed at the end of this statement
|
||||
| |
|
||||
| creates a temporary which is freed while still in use
|
||||
| creates a temporary value which is freed while still in use
|
||||
...
|
||||
LL | (x1, x2, x3, x4, x5, x6, x7);
|
||||
| -- borrow later used here
|
||||
@ -89,7 +89,7 @@ error[E0716]: temporary value dropped while borrowed
|
||||
LL | let x6 = AddFlags(1).get();
|
||||
| ^^^^^^^^^^^ - temporary value is freed at the end of this statement
|
||||
| |
|
||||
| creates a temporary which is freed while still in use
|
||||
| creates a temporary value which is freed while still in use
|
||||
...
|
||||
LL | (x1, x2, x3, x4, x5, x6, x7);
|
||||
| -- borrow later used here
|
||||
@ -106,7 +106,7 @@ error[E0716]: temporary value dropped while borrowed
|
||||
LL | let StackBox { f: x7 } = StackBox { f: AddFlags(1).get() };
|
||||
| ^^^^^^^^^^^ - temporary value is freed at the end of this statement
|
||||
| |
|
||||
| creates a temporary which is freed while still in use
|
||||
| creates a temporary value which is freed while still in use
|
||||
LL |
|
||||
LL | (x1, x2, x3, x4, x5, x6, x7);
|
||||
| -- borrow later used here
|
||||
|
@ -4,7 +4,7 @@ error[E0716]: temporary value dropped while borrowed
|
||||
LL | let x: &'static usize =
|
||||
| -------------- type annotation requires that borrow lasts for `'static`
|
||||
LL | &std::intrinsics::size_of::<i32>();
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ creates a temporary which is freed while still in use
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ creates a temporary value which is freed while still in use
|
||||
LL | }
|
||||
| - temporary value is freed at the end of this statement
|
||||
|
||||
|
@ -10,7 +10,7 @@ error[E0716]: temporary value dropped while borrowed
|
||||
--> $DIR/dont_promote_unstable_const_fn.rs:17:28
|
||||
|
|
||||
LL | let _: &'static u32 = &foo();
|
||||
| ------------ ^^^^^ creates a temporary which is freed while still in use
|
||||
| ------------ ^^^^^ creates a temporary value which is freed while still in use
|
||||
| |
|
||||
| type annotation requires that borrow lasts for `'static`
|
||||
LL | }
|
||||
@ -20,7 +20,7 @@ error[E0716]: temporary value dropped while borrowed
|
||||
--> $DIR/dont_promote_unstable_const_fn.rs:21:28
|
||||
|
|
||||
LL | let _: &'static u32 = &meh();
|
||||
| ------------ ^^^^^ creates a temporary which is freed while still in use
|
||||
| ------------ ^^^^^ creates a temporary value which is freed while still in use
|
||||
| |
|
||||
| type annotation requires that borrow lasts for `'static`
|
||||
...
|
||||
@ -31,7 +31,7 @@ error[E0716]: temporary value dropped while borrowed
|
||||
--> $DIR/dont_promote_unstable_const_fn.rs:22:26
|
||||
|
|
||||
LL | let x: &'static _ = &std::time::Duration::from_millis(42).subsec_millis();
|
||||
| ---------- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ creates a temporary which is freed while still in use
|
||||
| ---------- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ creates a temporary value which is freed while still in use
|
||||
| |
|
||||
| type annotation requires that borrow lasts for `'static`
|
||||
LL |
|
||||
|
@ -2,7 +2,7 @@ error[E0716]: temporary value dropped while borrowed
|
||||
--> $DIR/dont_promote_unstable_const_fn_cross_crate.rs:8:28
|
||||
|
|
||||
LL | let _: &'static u32 = &foo();
|
||||
| ------------ ^^^^^ creates a temporary which is freed while still in use
|
||||
| ------------ ^^^^^ creates a temporary value which is freed while still in use
|
||||
| |
|
||||
| type annotation requires that borrow lasts for `'static`
|
||||
LL | let _x: &'static u32 = &foo();
|
||||
@ -13,7 +13,7 @@ error[E0716]: temporary value dropped while borrowed
|
||||
--> $DIR/dont_promote_unstable_const_fn_cross_crate.rs:9:29
|
||||
|
|
||||
LL | let _x: &'static u32 = &foo();
|
||||
| ------------ ^^^^^ creates a temporary which is freed while still in use
|
||||
| ------------ ^^^^^ creates a temporary value which is freed while still in use
|
||||
| |
|
||||
| type annotation requires that borrow lasts for `'static`
|
||||
LL | }
|
||||
|
@ -2,7 +2,7 @@ error[E0716]: temporary value dropped while borrowed
|
||||
--> $DIR/promoted_const_fn_fail.rs:17:27
|
||||
|
|
||||
LL | let x: &'static u8 = &(bar() + 1);
|
||||
| ----------- ^^^^^^^^^^^ creates a temporary which is freed while still in use
|
||||
| ----------- ^^^^^^^^^^^ creates a temporary value which is freed while still in use
|
||||
| |
|
||||
| type annotation requires that borrow lasts for `'static`
|
||||
...
|
||||
|
@ -2,7 +2,7 @@ error[E0716]: temporary value dropped while borrowed
|
||||
--> $DIR/promoted_const_fn_fail_deny_const_err.rs:18:27
|
||||
|
|
||||
LL | let x: &'static u8 = &(bar() + 1);
|
||||
| ----------- ^^^^^^^^^^^ creates a temporary which is freed while still in use
|
||||
| ----------- ^^^^^^^^^^^ creates a temporary value which is freed while still in use
|
||||
| |
|
||||
| type annotation requires that borrow lasts for `'static`
|
||||
...
|
||||
|
@ -2,7 +2,7 @@ error[E0716]: temporary value dropped while borrowed
|
||||
--> $DIR/promoted_raw_ptr_ops.rs:2:29
|
||||
|
|
||||
LL | let x: &'static bool = &(42 as *const i32 == 43 as *const i32);
|
||||
| ------------- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ creates a temporary which is freed while still in use
|
||||
| ------------- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ creates a temporary value which is freed while still in use
|
||||
| |
|
||||
| type annotation requires that borrow lasts for `'static`
|
||||
...
|
||||
@ -13,7 +13,7 @@ error[E0716]: temporary value dropped while borrowed
|
||||
--> $DIR/promoted_raw_ptr_ops.rs:4:30
|
||||
|
|
||||
LL | let y: &'static usize = &(&1 as *const i32 as usize + 1);
|
||||
| -------------- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ creates a temporary which is freed while still in use
|
||||
| -------------- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ creates a temporary value which is freed while still in use
|
||||
| |
|
||||
| type annotation requires that borrow lasts for `'static`
|
||||
...
|
||||
@ -24,7 +24,7 @@ error[E0716]: temporary value dropped while borrowed
|
||||
--> $DIR/promoted_raw_ptr_ops.rs:6:28
|
||||
|
|
||||
LL | let z: &'static i32 = &(unsafe { *(42 as *const i32) });
|
||||
| ------------ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ creates a temporary which is freed while still in use
|
||||
| ------------ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ creates a temporary value which is freed while still in use
|
||||
| |
|
||||
| type annotation requires that borrow lasts for `'static`
|
||||
...
|
||||
@ -35,7 +35,7 @@ error[E0716]: temporary value dropped while borrowed
|
||||
--> $DIR/promoted_raw_ptr_ops.rs:8:29
|
||||
|
|
||||
LL | let a: &'static bool = &(main as fn() == main as fn());
|
||||
| ------------- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ creates a temporary which is freed while still in use
|
||||
| ------------- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ creates a temporary value which is freed while still in use
|
||||
| |
|
||||
| type annotation requires that borrow lasts for `'static`
|
||||
LL |
|
||||
|
@ -2,7 +2,7 @@ error[E0716]: temporary value dropped while borrowed
|
||||
--> $DIR/transmute-const-promotion.rs:4:37
|
||||
|
|
||||
LL | let x: &'static u32 = unsafe { &mem::transmute(3.0f32) };
|
||||
| ------------ ^^^^^^^^^^^^^^^^^^^^^^ creates a temporary which is freed while still in use
|
||||
| ------------ ^^^^^^^^^^^^^^^^^^^^^^ creates a temporary value which is freed while still in use
|
||||
| |
|
||||
| type annotation requires that borrow lasts for `'static`
|
||||
LL |
|
||||
|
@ -7,7 +7,7 @@ LL | let x: &'static bool = &unsafe {
|
||||
| | type annotation requires that borrow lasts for `'static`
|
||||
LL | | Foo { a: &1 }.b == Foo { a: &2 }.b
|
||||
LL | | };
|
||||
| |_____^ creates a temporary which is freed while still in use
|
||||
| |_____^ creates a temporary value which is freed while still in use
|
||||
LL | }
|
||||
| - temporary value is freed at the end of this statement
|
||||
|
||||
|
@ -2,7 +2,7 @@ error[E0716]: temporary value dropped while borrowed
|
||||
--> $DIR/const-int-conversion.rs:2:28
|
||||
|
|
||||
LL | let x: &'static i32 = &(5_i32.reverse_bits());
|
||||
| ------------ ^^^^^^^^^^^^^^^^^^^^^^ creates a temporary which is freed while still in use
|
||||
| ------------ ^^^^^^^^^^^^^^^^^^^^^^ creates a temporary value which is freed while still in use
|
||||
| |
|
||||
| type annotation requires that borrow lasts for `'static`
|
||||
...
|
||||
@ -13,7 +13,7 @@ error[E0716]: temporary value dropped while borrowed
|
||||
--> $DIR/const-int-conversion.rs:4:28
|
||||
|
|
||||
LL | let y: &'static i32 = &(i32::from_be_bytes([0x12, 0x34, 0x56, 0x78]));
|
||||
| ------------ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ creates a temporary which is freed while still in use
|
||||
| ------------ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ creates a temporary value which is freed while still in use
|
||||
| |
|
||||
| type annotation requires that borrow lasts for `'static`
|
||||
...
|
||||
@ -24,7 +24,7 @@ error[E0716]: temporary value dropped while borrowed
|
||||
--> $DIR/const-int-conversion.rs:6:28
|
||||
|
|
||||
LL | let z: &'static i32 = &(i32::from_le_bytes([0x12, 0x34, 0x56, 0x78]));
|
||||
| ------------ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ creates a temporary which is freed while still in use
|
||||
| ------------ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ creates a temporary value which is freed while still in use
|
||||
| |
|
||||
| type annotation requires that borrow lasts for `'static`
|
||||
...
|
||||
@ -35,7 +35,7 @@ error[E0716]: temporary value dropped while borrowed
|
||||
--> $DIR/const-int-conversion.rs:8:28
|
||||
|
|
||||
LL | let a: &'static i32 = &(i32::from_be(i32::from_ne_bytes([0x80, 0, 0, 0])));
|
||||
| ------------ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ creates a temporary which is freed while still in use
|
||||
| ------------ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ creates a temporary value which is freed while still in use
|
||||
| |
|
||||
| type annotation requires that borrow lasts for `'static`
|
||||
...
|
||||
@ -46,7 +46,7 @@ error[E0716]: temporary value dropped while borrowed
|
||||
--> $DIR/const-int-conversion.rs:10:29
|
||||
|
|
||||
LL | let b: &'static [u8] = &(0x12_34_56_78_i32.to_be_bytes());
|
||||
| ------------- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ creates a temporary which is freed while still in use
|
||||
| ------------- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ creates a temporary value which is freed while still in use
|
||||
| |
|
||||
| type annotation requires that borrow lasts for `'static`
|
||||
...
|
||||
@ -57,7 +57,7 @@ error[E0716]: temporary value dropped while borrowed
|
||||
--> $DIR/const-int-conversion.rs:12:29
|
||||
|
|
||||
LL | let c: &'static [u8] = &(0x12_34_56_78_i32.to_le_bytes());
|
||||
| ------------- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ creates a temporary which is freed while still in use
|
||||
| ------------- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ creates a temporary value which is freed while still in use
|
||||
| |
|
||||
| type annotation requires that borrow lasts for `'static`
|
||||
...
|
||||
@ -68,7 +68,7 @@ error[E0716]: temporary value dropped while borrowed
|
||||
--> $DIR/const-int-conversion.rs:14:29
|
||||
|
|
||||
LL | let d: &'static [u8] = &(i32::MIN.to_be().to_ne_bytes());
|
||||
| ------------- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ creates a temporary which is freed while still in use
|
||||
| ------------- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ creates a temporary value which is freed while still in use
|
||||
| |
|
||||
| type annotation requires that borrow lasts for `'static`
|
||||
LL |
|
||||
|
@ -2,7 +2,7 @@ error[E0716]: temporary value dropped while borrowed
|
||||
--> $DIR/const-int-overflowing.rs:2:36
|
||||
|
|
||||
LL | let x: &'static (i32, bool) = &(5_i32.overflowing_add(3));
|
||||
| -------------------- ^^^^^^^^^^^^^^^^^^^^^^^^^^ creates a temporary which is freed while still in use
|
||||
| -------------------- ^^^^^^^^^^^^^^^^^^^^^^^^^^ creates a temporary value which is freed while still in use
|
||||
| |
|
||||
| type annotation requires that borrow lasts for `'static`
|
||||
...
|
||||
@ -13,7 +13,7 @@ error[E0716]: temporary value dropped while borrowed
|
||||
--> $DIR/const-int-overflowing.rs:4:36
|
||||
|
|
||||
LL | let y: &'static (i32, bool) = &(5_i32.overflowing_sub(3));
|
||||
| -------------------- ^^^^^^^^^^^^^^^^^^^^^^^^^^ creates a temporary which is freed while still in use
|
||||
| -------------------- ^^^^^^^^^^^^^^^^^^^^^^^^^^ creates a temporary value which is freed while still in use
|
||||
| |
|
||||
| type annotation requires that borrow lasts for `'static`
|
||||
...
|
||||
@ -24,7 +24,7 @@ error[E0716]: temporary value dropped while borrowed
|
||||
--> $DIR/const-int-overflowing.rs:6:36
|
||||
|
|
||||
LL | let z: &'static (i32, bool) = &(5_i32.overflowing_mul(3));
|
||||
| -------------------- ^^^^^^^^^^^^^^^^^^^^^^^^^^ creates a temporary which is freed while still in use
|
||||
| -------------------- ^^^^^^^^^^^^^^^^^^^^^^^^^^ creates a temporary value which is freed while still in use
|
||||
| |
|
||||
| type annotation requires that borrow lasts for `'static`
|
||||
LL |
|
||||
|
@ -2,7 +2,7 @@ error[E0716]: temporary value dropped while borrowed
|
||||
--> $DIR/const-int-rotate.rs:2:28
|
||||
|
|
||||
LL | let x: &'static i32 = &(5_i32.rotate_left(3));
|
||||
| ------------ ^^^^^^^^^^^^^^^^^^^^^^ creates a temporary which is freed while still in use
|
||||
| ------------ ^^^^^^^^^^^^^^^^^^^^^^ creates a temporary value which is freed while still in use
|
||||
| |
|
||||
| type annotation requires that borrow lasts for `'static`
|
||||
...
|
||||
@ -13,7 +13,7 @@ error[E0716]: temporary value dropped while borrowed
|
||||
--> $DIR/const-int-rotate.rs:4:28
|
||||
|
|
||||
LL | let y: &'static i32 = &(5_i32.rotate_right(3));
|
||||
| ------------ ^^^^^^^^^^^^^^^^^^^^^^^ creates a temporary which is freed while still in use
|
||||
| ------------ ^^^^^^^^^^^^^^^^^^^^^^^ creates a temporary value which is freed while still in use
|
||||
| |
|
||||
| type annotation requires that borrow lasts for `'static`
|
||||
LL |
|
||||
|
@ -2,7 +2,7 @@ error[E0716]: temporary value dropped while borrowed
|
||||
--> $DIR/const-int-sign.rs:2:29
|
||||
|
|
||||
LL | let x: &'static bool = &(5_i32.is_negative());
|
||||
| ------------- ^^^^^^^^^^^^^^^^^^^^^ creates a temporary which is freed while still in use
|
||||
| ------------- ^^^^^^^^^^^^^^^^^^^^^ creates a temporary value which is freed while still in use
|
||||
| |
|
||||
| type annotation requires that borrow lasts for `'static`
|
||||
...
|
||||
@ -13,7 +13,7 @@ error[E0716]: temporary value dropped while borrowed
|
||||
--> $DIR/const-int-sign.rs:4:29
|
||||
|
|
||||
LL | let y: &'static bool = &(5_i32.is_positive());
|
||||
| ------------- ^^^^^^^^^^^^^^^^^^^^^ creates a temporary which is freed while still in use
|
||||
| ------------- ^^^^^^^^^^^^^^^^^^^^^ creates a temporary value which is freed while still in use
|
||||
| |
|
||||
| type annotation requires that borrow lasts for `'static`
|
||||
LL |
|
||||
|
@ -2,7 +2,7 @@ error[E0716]: temporary value dropped while borrowed
|
||||
--> $DIR/const-int-wrapping.rs:2:28
|
||||
|
|
||||
LL | let x: &'static i32 = &(5_i32.wrapping_add(3));
|
||||
| ------------ ^^^^^^^^^^^^^^^^^^^^^^^ creates a temporary which is freed while still in use
|
||||
| ------------ ^^^^^^^^^^^^^^^^^^^^^^^ creates a temporary value which is freed while still in use
|
||||
| |
|
||||
| type annotation requires that borrow lasts for `'static`
|
||||
...
|
||||
@ -13,7 +13,7 @@ error[E0716]: temporary value dropped while borrowed
|
||||
--> $DIR/const-int-wrapping.rs:4:28
|
||||
|
|
||||
LL | let y: &'static i32 = &(5_i32.wrapping_sub(3));
|
||||
| ------------ ^^^^^^^^^^^^^^^^^^^^^^^ creates a temporary which is freed while still in use
|
||||
| ------------ ^^^^^^^^^^^^^^^^^^^^^^^ creates a temporary value which is freed while still in use
|
||||
| |
|
||||
| type annotation requires that borrow lasts for `'static`
|
||||
...
|
||||
@ -24,7 +24,7 @@ error[E0716]: temporary value dropped while borrowed
|
||||
--> $DIR/const-int-wrapping.rs:6:28
|
||||
|
|
||||
LL | let z: &'static i32 = &(5_i32.wrapping_mul(3));
|
||||
| ------------ ^^^^^^^^^^^^^^^^^^^^^^^ creates a temporary which is freed while still in use
|
||||
| ------------ ^^^^^^^^^^^^^^^^^^^^^^^ creates a temporary value which is freed while still in use
|
||||
| |
|
||||
| type annotation requires that borrow lasts for `'static`
|
||||
...
|
||||
@ -35,7 +35,7 @@ error[E0716]: temporary value dropped while borrowed
|
||||
--> $DIR/const-int-wrapping.rs:8:28
|
||||
|
|
||||
LL | let a: &'static i32 = &(5_i32.wrapping_shl(3));
|
||||
| ------------ ^^^^^^^^^^^^^^^^^^^^^^^ creates a temporary which is freed while still in use
|
||||
| ------------ ^^^^^^^^^^^^^^^^^^^^^^^ creates a temporary value which is freed while still in use
|
||||
| |
|
||||
| type annotation requires that borrow lasts for `'static`
|
||||
...
|
||||
@ -46,7 +46,7 @@ error[E0716]: temporary value dropped while borrowed
|
||||
--> $DIR/const-int-wrapping.rs:10:28
|
||||
|
|
||||
LL | let b: &'static i32 = &(5_i32.wrapping_shr(3));
|
||||
| ------------ ^^^^^^^^^^^^^^^^^^^^^^^ creates a temporary which is freed while still in use
|
||||
| ------------ ^^^^^^^^^^^^^^^^^^^^^^^ creates a temporary value which is freed while still in use
|
||||
| |
|
||||
| type annotation requires that borrow lasts for `'static`
|
||||
LL |
|
||||
|
@ -11,7 +11,7 @@ LL | const B3: Option<&mut i32> = Some(&mut 42);
|
||||
| ----------^^-
|
||||
| | | |
|
||||
| | | temporary value is freed at the end of this statement
|
||||
| | creates a temporary which is freed while still in use
|
||||
| | creates a temporary value which is freed while still in use
|
||||
| using this value as a constant requires that borrow lasts for `'static`
|
||||
|
||||
error[E0716]: temporary value dropped while borrowed
|
||||
@ -21,7 +21,7 @@ LL | const B4: Option<&mut i32> = helper(&mut 42);
|
||||
| ------------^^-
|
||||
| | | |
|
||||
| | | temporary value is freed at the end of this statement
|
||||
| | creates a temporary which is freed while still in use
|
||||
| | creates a temporary value which is freed while still in use
|
||||
| using this value as a constant requires that borrow lasts for `'static`
|
||||
|
||||
error[E0716]: temporary value dropped while borrowed
|
||||
@ -31,7 +31,7 @@ LL | const FOO: NotAMutex<&mut i32> = NotAMutex(UnsafeCell::new(&mut 42));
|
||||
| -------------------------------^^--
|
||||
| | | |
|
||||
| | | temporary value is freed at the end of this statement
|
||||
| | creates a temporary which is freed while still in use
|
||||
| | creates a temporary value which is freed while still in use
|
||||
| using this value as a constant requires that borrow lasts for `'static`
|
||||
|
||||
error[E0716]: temporary value dropped while borrowed
|
||||
@ -41,7 +41,7 @@ LL | static FOO2: NotAMutex<&mut i32> = NotAMutex(UnsafeCell::new(&mut 42));
|
||||
| -------------------------------^^--
|
||||
| | | |
|
||||
| | | temporary value is freed at the end of this statement
|
||||
| | creates a temporary which is freed while still in use
|
||||
| | 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
|
||||
@ -51,7 +51,7 @@ LL | static mut FOO3: NotAMutex<&mut i32> = NotAMutex(UnsafeCell::new(&mut 42));
|
||||
| -------------------------------^^--
|
||||
| | | |
|
||||
| | | temporary value is freed at the end of this statement
|
||||
| | creates a temporary which is freed while still in use
|
||||
| | creates a temporary value which is freed while still in use
|
||||
| using this value as a static requires that borrow lasts for `'static`
|
||||
|
||||
error: aborting due to 6 previous errors
|
||||
|
@ -2,7 +2,7 @@ error[E0716]: temporary value dropped while borrowed
|
||||
--> $DIR/const-ptr-nonnull.rs:4:37
|
||||
|
|
||||
LL | let x: &'static NonNull<u32> = &(NonNull::dangling());
|
||||
| --------------------- ^^^^^^^^^^^^^^^^^^^^^ creates a temporary which is freed while still in use
|
||||
| --------------------- ^^^^^^^^^^^^^^^^^^^^^ creates a temporary value which is freed while still in use
|
||||
| |
|
||||
| type annotation requires that borrow lasts for `'static`
|
||||
...
|
||||
@ -13,7 +13,7 @@ error[E0716]: temporary value dropped while borrowed
|
||||
--> $DIR/const-ptr-nonnull.rs:9:37
|
||||
|
|
||||
LL | let x: &'static NonNull<u32> = &(non_null.cast());
|
||||
| --------------------- ^^^^^^^^^^^^^^^^^ creates a temporary which is freed while still in use
|
||||
| --------------------- ^^^^^^^^^^^^^^^^^ creates a temporary value which is freed while still in use
|
||||
| |
|
||||
| type annotation requires that borrow lasts for `'static`
|
||||
LL |
|
||||
|
@ -2,7 +2,7 @@ error[E0716]: temporary value dropped while borrowed
|
||||
--> $DIR/const-ptr-unique.rs:8:33
|
||||
|
|
||||
LL | let x: &'static *mut u32 = &(unique.as_ptr());
|
||||
| ----------------- ^^^^^^^^^^^^^^^^^ creates a temporary which is freed while still in use
|
||||
| ----------------- ^^^^^^^^^^^^^^^^^ creates a temporary value which is freed while still in use
|
||||
| |
|
||||
| type annotation requires that borrow lasts for `'static`
|
||||
LL |
|
||||
|
@ -2,7 +2,7 @@ error[E0716]: temporary value dropped while borrowed
|
||||
--> $DIR/interior-mutability.rs:40:26
|
||||
|
|
||||
LL | let x: &'static _ = &X;
|
||||
| ---------- ^ creates a temporary which is freed while still in use
|
||||
| ---------- ^ creates a temporary value which is freed while still in use
|
||||
| |
|
||||
| type annotation requires that borrow lasts for `'static`
|
||||
...
|
||||
@ -13,7 +13,7 @@ error[E0716]: temporary value dropped while borrowed
|
||||
--> $DIR/interior-mutability.rs:41:26
|
||||
|
|
||||
LL | let y: &'static _ = &Y;
|
||||
| ---------- ^ creates a temporary which is freed while still in use
|
||||
| ---------- ^ creates a temporary value which is freed while still in use
|
||||
| |
|
||||
| type annotation requires that borrow lasts for `'static`
|
||||
LL | let z: &'static _ = &Z;
|
||||
@ -24,7 +24,7 @@ error[E0716]: temporary value dropped while borrowed
|
||||
--> $DIR/interior-mutability.rs:42:26
|
||||
|
|
||||
LL | let z: &'static _ = &Z;
|
||||
| ---------- ^ creates a temporary which is freed while still in use
|
||||
| ---------- ^ creates a temporary value which is freed while still in use
|
||||
| |
|
||||
| type annotation requires that borrow lasts for `'static`
|
||||
LL | }
|
||||
|
@ -5,7 +5,7 @@ LL | const FOO: Option<&[[u8; 3]]> = Some(&[*b"foo"]);
|
||||
| ------^^^^^^^^^-
|
||||
| | | |
|
||||
| | | temporary value is freed at the end of this statement
|
||||
| | creates a temporary which is freed while still in use
|
||||
| | creates a temporary value which is freed while still in use
|
||||
| using this value as a constant requires that borrow lasts for `'static`
|
||||
|
||||
error[E0716]: temporary value dropped while borrowed
|
||||
@ -15,7 +15,7 @@ LL | pub const Z: Cow<'static, [ [u8; 3] ]> = Cow::Borrowed(&[*b"ABC"]);
|
||||
| ---------------^^^^^^^^^-
|
||||
| | | |
|
||||
| | | temporary value is freed at the end of this statement
|
||||
| | creates a temporary which is freed while still in use
|
||||
| | creates a temporary value which is freed while still in use
|
||||
| using this value as a constant requires that borrow lasts for `'static`
|
||||
|
||||
error: aborting due to 2 previous errors
|
||||
|
@ -2,7 +2,7 @@ error[E0716]: temporary value dropped while borrowed
|
||||
--> $DIR/promotion.rs:11:27
|
||||
|
|
||||
LL | let x: &'static () = &foo1();
|
||||
| ----------- ^^^^^^ creates a temporary which is freed while still in use
|
||||
| ----------- ^^^^^^ creates a temporary value which is freed while still in use
|
||||
| |
|
||||
| type annotation requires that borrow lasts for `'static`
|
||||
...
|
||||
@ -13,7 +13,7 @@ error[E0716]: temporary value dropped while borrowed
|
||||
--> $DIR/promotion.rs:12:28
|
||||
|
|
||||
LL | let y: &'static i32 = &foo2(42);
|
||||
| ------------ ^^^^^^^^ creates a temporary which is freed while still in use
|
||||
| ------------ ^^^^^^^^ creates a temporary value which is freed while still in use
|
||||
| |
|
||||
| type annotation requires that borrow lasts for `'static`
|
||||
...
|
||||
@ -24,7 +24,7 @@ error[E0716]: temporary value dropped while borrowed
|
||||
--> $DIR/promotion.rs:13:28
|
||||
|
|
||||
LL | let z: &'static i32 = &foo3();
|
||||
| ------------ ^^^^^^ creates a temporary which is freed while still in use
|
||||
| ------------ ^^^^^^ creates a temporary value which is freed while still in use
|
||||
| |
|
||||
| type annotation requires that borrow lasts for `'static`
|
||||
...
|
||||
@ -35,7 +35,7 @@ error[E0716]: temporary value dropped while borrowed
|
||||
--> $DIR/promotion.rs:14:34
|
||||
|
|
||||
LL | let a: &'static Cell<i32> = &foo4();
|
||||
| ------------------ ^^^^^^ creates a temporary which is freed while still in use
|
||||
| ------------------ ^^^^^^ creates a temporary value which is freed while still in use
|
||||
| |
|
||||
| type annotation requires that borrow lasts for `'static`
|
||||
...
|
||||
@ -46,7 +46,7 @@ error[E0716]: temporary value dropped while borrowed
|
||||
--> $DIR/promotion.rs:15:42
|
||||
|
|
||||
LL | let a: &'static Option<Cell<i32>> = &foo5();
|
||||
| -------------------------- ^^^^^^ creates a temporary which is freed while still in use
|
||||
| -------------------------- ^^^^^^ creates a temporary value which is freed while still in use
|
||||
| |
|
||||
| type annotation requires that borrow lasts for `'static`
|
||||
LL | let a: &'static Option<Cell<i32>> = &foo6();
|
||||
@ -57,7 +57,7 @@ error[E0716]: temporary value dropped while borrowed
|
||||
--> $DIR/promotion.rs:16:42
|
||||
|
|
||||
LL | let a: &'static Option<Cell<i32>> = &foo6();
|
||||
| -------------------------- ^^^^^^ creates a temporary which is freed while still in use
|
||||
| -------------------------- ^^^^^^ creates a temporary value which is freed while still in use
|
||||
| |
|
||||
| type annotation requires that borrow lasts for `'static`
|
||||
LL | }
|
||||
|
@ -5,14 +5,14 @@ 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 which is freed while still in use
|
||||
| | 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:11:18
|
||||
|
|
||||
LL | let x = &mut [1,2,3];
|
||||
| ^^^^^^^ creates a temporary which is freed while still in use
|
||||
| ^^^^^^^ 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 | };
|
||||
@ -22,7 +22,7 @@ error[E0716]: temporary value dropped while borrowed
|
||||
--> $DIR/promote-not.rs:20:32
|
||||
|
|
||||
LL | let _x: &'static () = &foo();
|
||||
| ----------- ^^^^^ creates a temporary which is freed while still in use
|
||||
| ----------- ^^^^^ creates a temporary value which is freed while still in use
|
||||
| |
|
||||
| type annotation requires that borrow lasts for `'static`
|
||||
LL | }
|
||||
@ -32,7 +32,7 @@ error[E0716]: temporary value dropped while borrowed
|
||||
--> $DIR/promote-not.rs:28:29
|
||||
|
|
||||
LL | let _x: &'static i32 = &unsafe { U { x: 0 }.x };
|
||||
| ------------ ^^^^^^^^^^^^^^^^^^^^^^^ creates a temporary which is freed while still in use
|
||||
| ------------ ^^^^^^^^^^^^^^^^^^^^^^^ creates a temporary value which is freed while still in use
|
||||
| |
|
||||
| type annotation requires that borrow lasts for `'static`
|
||||
LL | }
|
||||
@ -42,7 +42,7 @@ error[E0716]: temporary value dropped while borrowed
|
||||
--> $DIR/promote-not.rs:33:29
|
||||
|
|
||||
LL | let _x: &'static i32 = &unsafe { U { x: 0 }.x };
|
||||
| ------------ ^^^^^^^^^^^^^^^^^^^^^^^ creates a temporary which is freed while still in use
|
||||
| ------------ ^^^^^^^^^^^^^^^^^^^^^^^ creates a temporary value which is freed while still in use
|
||||
| |
|
||||
| type annotation requires that borrow lasts for `'static`
|
||||
LL | };
|
||||
@ -52,7 +52,7 @@ error[E0716]: temporary value dropped while borrowed
|
||||
--> $DIR/promote-not.rs:39:29
|
||||
|
|
||||
LL | let _val: &'static _ = &(Cell::new(1), 2).1;
|
||||
| ---------- ^^^^^^^^^^^^^^^^^ creates a temporary which is freed while still in use
|
||||
| ---------- ^^^^^^^^^^^^^^^^^ creates a temporary value which is freed while still in use
|
||||
| |
|
||||
| type annotation requires that borrow lasts for `'static`
|
||||
LL | };
|
||||
@ -62,7 +62,7 @@ error[E0716]: temporary value dropped while borrowed
|
||||
--> $DIR/promote-not.rs:46:29
|
||||
|
|
||||
LL | let _val: &'static _ = &(Cell::new(1), 2).0;
|
||||
| ---------- ^^^^^^^^^^^^^^^^^ creates a temporary which is freed while still in use
|
||||
| ---------- ^^^^^^^^^^^^^^^^^ creates a temporary value which is freed while still in use
|
||||
| |
|
||||
| type annotation requires that borrow lasts for `'static`
|
||||
...
|
||||
@ -73,7 +73,7 @@ error[E0716]: temporary value dropped while borrowed
|
||||
--> $DIR/promote-not.rs:47:29
|
||||
|
|
||||
LL | let _val: &'static _ = &(Cell::new(1), 2).1;
|
||||
| ---------- ^^^^^^^^^^^^^^^^^ creates a temporary which is freed while still in use
|
||||
| ---------- ^^^^^^^^^^^^^^^^^ creates a temporary value which is freed while still in use
|
||||
| |
|
||||
| type annotation requires that borrow lasts for `'static`
|
||||
...
|
||||
@ -84,7 +84,7 @@ error[E0716]: temporary value dropped while borrowed
|
||||
--> $DIR/promote-not.rs:50:29
|
||||
|
|
||||
LL | let _val: &'static _ = &(1/0);
|
||||
| ---------- ^^^^^ creates a temporary which is freed while still in use
|
||||
| ---------- ^^^^^ creates a temporary value which is freed while still in use
|
||||
| |
|
||||
| type annotation requires that borrow lasts for `'static`
|
||||
...
|
||||
@ -95,7 +95,7 @@ error[E0716]: temporary value dropped while borrowed
|
||||
--> $DIR/promote-not.rs:51:29
|
||||
|
|
||||
LL | let _val: &'static _ = &(1/(1-1));
|
||||
| ---------- ^^^^^^^^^ creates a temporary which is freed while still in use
|
||||
| ---------- ^^^^^^^^^ creates a temporary value which is freed while still in use
|
||||
| |
|
||||
| type annotation requires that borrow lasts for `'static`
|
||||
...
|
||||
@ -106,7 +106,7 @@ error[E0716]: temporary value dropped while borrowed
|
||||
--> $DIR/promote-not.rs:52:29
|
||||
|
|
||||
LL | let _val: &'static _ = &(1%0);
|
||||
| ---------- ^^^^^ creates a temporary which is freed while still in use
|
||||
| ---------- ^^^^^ creates a temporary value which is freed while still in use
|
||||
| |
|
||||
| type annotation requires that borrow lasts for `'static`
|
||||
...
|
||||
@ -117,7 +117,7 @@ error[E0716]: temporary value dropped while borrowed
|
||||
--> $DIR/promote-not.rs:53:29
|
||||
|
|
||||
LL | let _val: &'static _ = &(1%(1-1));
|
||||
| ---------- ^^^^^^^^^ creates a temporary which is freed while still in use
|
||||
| ---------- ^^^^^^^^^ creates a temporary value which is freed while still in use
|
||||
| |
|
||||
| type annotation requires that borrow lasts for `'static`
|
||||
...
|
||||
@ -128,7 +128,7 @@ error[E0716]: temporary value dropped while borrowed
|
||||
--> $DIR/promote-not.rs:54:29
|
||||
|
|
||||
LL | let _val: &'static _ = &([1,2,3][4]+1);
|
||||
| ---------- ^^^^^^^^^^^^^^ creates a temporary which is freed while still in use
|
||||
| ---------- ^^^^^^^^^^^^^^ creates a temporary value which is freed while still in use
|
||||
| |
|
||||
| type annotation requires that borrow lasts for `'static`
|
||||
...
|
||||
@ -139,7 +139,7 @@ error[E0716]: temporary value dropped while borrowed
|
||||
--> $DIR/promote-not.rs:57:29
|
||||
|
|
||||
LL | let _val: &'static _ = &TEST_DROP;
|
||||
| ---------- ^^^^^^^^^ creates a temporary which is freed while still in use
|
||||
| ---------- ^^^^^^^^^ creates a temporary value which is freed while still in use
|
||||
| |
|
||||
| type annotation requires that borrow lasts for `'static`
|
||||
...
|
||||
@ -150,7 +150,7 @@ error[E0716]: temporary value dropped while borrowed
|
||||
--> $DIR/promote-not.rs:59:29
|
||||
|
|
||||
LL | let _val: &'static _ = &&TEST_DROP;
|
||||
| ---------- ^^^^^^^^^^ creates a temporary which is freed while still in use
|
||||
| ---------- ^^^^^^^^^^ creates a temporary value which is freed while still in use
|
||||
| |
|
||||
| type annotation requires that borrow lasts for `'static`
|
||||
...
|
||||
@ -161,7 +161,7 @@ error[E0716]: temporary value dropped while borrowed
|
||||
--> $DIR/promote-not.rs:59:30
|
||||
|
|
||||
LL | let _val: &'static _ = &&TEST_DROP;
|
||||
| ---------- ^^^^^^^^^ creates a temporary which is freed while still in use
|
||||
| ---------- ^^^^^^^^^ creates a temporary value which is freed while still in use
|
||||
| |
|
||||
| type annotation requires that borrow lasts for `'static`
|
||||
...
|
||||
@ -172,7 +172,7 @@ error[E0716]: temporary value dropped while borrowed
|
||||
--> $DIR/promote-not.rs:62:29
|
||||
|
|
||||
LL | let _val: &'static _ = &(&TEST_DROP,);
|
||||
| ---------- ^^^^^^^^^^^^^ creates a temporary which is freed while still in use
|
||||
| ---------- ^^^^^^^^^^^^^ creates a temporary value which is freed while still in use
|
||||
| |
|
||||
| type annotation requires that borrow lasts for `'static`
|
||||
...
|
||||
@ -183,7 +183,7 @@ error[E0716]: temporary value dropped while borrowed
|
||||
--> $DIR/promote-not.rs:62:31
|
||||
|
|
||||
LL | let _val: &'static _ = &(&TEST_DROP,);
|
||||
| ---------- ^^^^^^^^^ creates a temporary which is freed while still in use
|
||||
| ---------- ^^^^^^^^^ creates a temporary value which is freed while still in use
|
||||
| |
|
||||
| type annotation requires that borrow lasts for `'static`
|
||||
...
|
||||
@ -194,7 +194,7 @@ error[E0716]: temporary value dropped while borrowed
|
||||
--> $DIR/promote-not.rs:65:29
|
||||
|
|
||||
LL | let _val: &'static _ = &[&TEST_DROP; 1];
|
||||
| ---------- ^^^^^^^^^^^^^^^ creates a temporary which is freed while still in use
|
||||
| ---------- ^^^^^^^^^^^^^^^ creates a temporary value which is freed while still in use
|
||||
| |
|
||||
| type annotation requires that borrow lasts for `'static`
|
||||
...
|
||||
@ -207,7 +207,7 @@ error[E0716]: temporary value dropped while borrowed
|
||||
LL | let _val: &'static _ = &[&TEST_DROP; 1];
|
||||
| ---------- ^^^^^^^^^ - temporary value is freed at the end of this statement
|
||||
| | |
|
||||
| | creates a temporary which is freed while still in use
|
||||
| | creates a temporary value which is freed while still in use
|
||||
| type annotation requires that borrow lasts for `'static`
|
||||
|
||||
error: aborting due to 20 previous errors
|
||||
|
@ -19,7 +19,7 @@ LL | let x: &'static u32 = &{
|
||||
LL | | let y = 42;
|
||||
LL | | y
|
||||
LL | | };
|
||||
| |_____^ creates a temporary which is freed while still in use
|
||||
| |_____^ creates a temporary value which is freed while still in use
|
||||
LL | }
|
||||
| - temporary value is freed at the end of this statement
|
||||
|
||||
|
@ -2,7 +2,7 @@ error[E0716]: temporary value dropped while borrowed
|
||||
--> $DIR/promoted-const-drop.rs:13:26
|
||||
|
|
||||
LL | let _: &'static A = &A();
|
||||
| ---------- ^^^ creates a temporary which is freed while still in use
|
||||
| ---------- ^^^ creates a temporary value which is freed while still in use
|
||||
| |
|
||||
| type annotation requires that borrow lasts for `'static`
|
||||
LL | let _: &'static [A] = &[C];
|
||||
@ -13,7 +13,7 @@ error[E0716]: temporary value dropped while borrowed
|
||||
--> $DIR/promoted-const-drop.rs:14:28
|
||||
|
|
||||
LL | let _: &'static [A] = &[C];
|
||||
| ------------ ^^^ creates a temporary which is freed while still in use
|
||||
| ------------ ^^^ creates a temporary value which is freed while still in use
|
||||
| |
|
||||
| type annotation requires that borrow lasts for `'static`
|
||||
LL | }
|
||||
|
@ -2,7 +2,7 @@ error[E0716]: temporary value dropped while borrowed
|
||||
--> $DIR/qualif-union.rs:28:26
|
||||
|
|
||||
LL | let _: &'static _ = &C1;
|
||||
| ---------- ^^ creates a temporary which is freed while still in use
|
||||
| ---------- ^^ creates a temporary value which is freed while still in use
|
||||
| |
|
||||
| type annotation requires that borrow lasts for `'static`
|
||||
...
|
||||
@ -13,7 +13,7 @@ error[E0716]: temporary value dropped while borrowed
|
||||
--> $DIR/qualif-union.rs:29:26
|
||||
|
|
||||
LL | let _: &'static _ = &C2;
|
||||
| ---------- ^^ creates a temporary which is freed while still in use
|
||||
| ---------- ^^ creates a temporary value which is freed while still in use
|
||||
| |
|
||||
| type annotation requires that borrow lasts for `'static`
|
||||
...
|
||||
@ -24,7 +24,7 @@ error[E0716]: temporary value dropped while borrowed
|
||||
--> $DIR/qualif-union.rs:30:26
|
||||
|
|
||||
LL | let _: &'static _ = &C3;
|
||||
| ---------- ^^ creates a temporary which is freed while still in use
|
||||
| ---------- ^^ creates a temporary value which is freed while still in use
|
||||
| |
|
||||
| type annotation requires that borrow lasts for `'static`
|
||||
...
|
||||
@ -35,7 +35,7 @@ error[E0716]: temporary value dropped while borrowed
|
||||
--> $DIR/qualif-union.rs:31:26
|
||||
|
|
||||
LL | let _: &'static _ = &C4;
|
||||
| ---------- ^^ creates a temporary which is freed while still in use
|
||||
| ---------- ^^ creates a temporary value which is freed while still in use
|
||||
| |
|
||||
| type annotation requires that borrow lasts for `'static`
|
||||
LL | let _: &'static _ = &C5;
|
||||
@ -46,7 +46,7 @@ error[E0716]: temporary value dropped while borrowed
|
||||
--> $DIR/qualif-union.rs:32:26
|
||||
|
|
||||
LL | let _: &'static _ = &C5;
|
||||
| ---------- ^^ creates a temporary which is freed while still in use
|
||||
| ---------- ^^ creates a temporary value which is freed while still in use
|
||||
| |
|
||||
| type annotation requires that borrow lasts for `'static`
|
||||
LL | }
|
||||
|
@ -4,7 +4,7 @@ error[E0716]: temporary value dropped while borrowed
|
||||
LL | let a = A(&mut true, &mut true, No);
|
||||
| ^^^^ - temporary value is freed at the end of this statement
|
||||
| |
|
||||
| creates a temporary which is freed while still in use
|
||||
| creates a temporary value which is freed while still in use
|
||||
...
|
||||
LL | assert_foo(a);
|
||||
| - borrow later used here
|
||||
@ -17,7 +17,7 @@ error[E0716]: temporary value dropped while borrowed
|
||||
LL | let a = A(&mut true, &mut true, No);
|
||||
| ^^^^ - temporary value is freed at the end of this statement
|
||||
| |
|
||||
| creates a temporary which is freed while still in use
|
||||
| creates a temporary value which is freed while still in use
|
||||
...
|
||||
LL | assert_foo(a);
|
||||
| - borrow later used here
|
||||
|
@ -2,7 +2,7 @@ error[E0716]: temporary value dropped while borrowed
|
||||
--> $DIR/hrtb-implied-1.rs:31:22
|
||||
|
|
||||
LL | let slice = &mut ();
|
||||
| ^^ creates a temporary which is freed while still in use
|
||||
| ^^ creates a temporary value which is freed while still in use
|
||||
...
|
||||
LL | print_items::<WindowsMut<'_>>(windows);
|
||||
| -------------------------------------- argument requires that borrow lasts for `'static`
|
||||
|
@ -4,7 +4,7 @@ error[E0716]: temporary value dropped while borrowed
|
||||
LL | let _vec: Vec<&'static String> = vec![&String::new()];
|
||||
| -------------------- ^^^^^^^^^^^^^ - temporary value is freed at the end of this statement
|
||||
| | |
|
||||
| | creates a temporary which is freed while still in use
|
||||
| | creates a temporary value which is freed while still in use
|
||||
| type annotation requires that borrow lasts for `'static`
|
||||
|
||||
error: aborting due to previous error
|
||||
|
@ -4,7 +4,7 @@ error[E0716]: temporary value dropped while borrowed
|
||||
LL | foo(&unpromotable(5u32));
|
||||
| -----^^^^^^^^^^^^^^^^^^-
|
||||
| | |
|
||||
| | creates a temporary which is freed while still in use
|
||||
| | creates a temporary value which is freed while still in use
|
||||
| argument requires that borrow lasts for `'static`
|
||||
LL | }
|
||||
| - temporary value is freed at the end of this statement
|
||||
|
@ -4,7 +4,7 @@ error[E0716]: temporary value dropped while borrowed
|
||||
LL | let mut x = vec![1].iter();
|
||||
| ^^^^^^^ - temporary value is freed at the end of this statement
|
||||
| |
|
||||
| creates a temporary which is freed while still in use
|
||||
| creates a temporary value which is freed while still in use
|
||||
LL |
|
||||
LL | x.use_mut();
|
||||
| ----------- borrow later used here
|
||||
|
@ -2,7 +2,7 @@ error[E0716]: temporary value dropped while borrowed
|
||||
--> $DIR/borrowed-temporary-error.rs:8:10
|
||||
|
|
||||
LL | &(v,)
|
||||
| ^^^^ creates a temporary which is freed while still in use
|
||||
| ^^^^ creates a temporary value which is freed while still in use
|
||||
LL |
|
||||
LL | });
|
||||
| - temporary value is freed at the end of this statement
|
||||
|
@ -4,7 +4,7 @@ error[E0716]: temporary value dropped while borrowed
|
||||
LL | let (_, z) = foo(&"hello".to_string());
|
||||
| -----^^^^^^^^^^^^^^^^^^^-- temporary value is freed at the end of this statement
|
||||
| | |
|
||||
| | creates a temporary which is freed while still in use
|
||||
| | creates a temporary value which is freed while still in use
|
||||
| argument requires that borrow lasts for `'static`
|
||||
|
||||
error: aborting due to previous error
|
||||
|
@ -76,7 +76,7 @@ error[E0716]: temporary value dropped while borrowed
|
||||
LL | let _: Vec<&'static String> = vec![&String::new()];
|
||||
| -------------------- ^^^^^^^^^^^^^ - temporary value is freed at the end of this statement
|
||||
| | |
|
||||
| | creates a temporary which is freed while still in use
|
||||
| | 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
|
||||
@ -85,7 +85,7 @@ error[E0716]: temporary value dropped while borrowed
|
||||
LL | let (_, a): (Vec<&'static String>, _) = (vec![&String::new()], 44);
|
||||
| ------------------------- ^^^^^^^^^^^^^ - temporary value is freed at the end of this statement
|
||||
| | |
|
||||
| | creates a temporary which is freed while still in use
|
||||
| | 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
|
||||
@ -94,7 +94,7 @@ error[E0716]: temporary value dropped while borrowed
|
||||
LL | let (_a, b): (Vec<&'static String>, _) = (vec![&String::new()], 44);
|
||||
| ------------------------- ^^^^^^^^^^^^^ - temporary value is freed at the end of this statement
|
||||
| | |
|
||||
| | creates a temporary which is freed while still in use
|
||||
| | creates a temporary value which is freed while still in use
|
||||
| type annotation requires that borrow lasts for `'static`
|
||||
|
||||
error[E0597]: `x` does not live long enough
|
||||
|
@ -4,7 +4,7 @@ error[E0716]: temporary value dropped while borrowed
|
||||
LL | let phantom_pinned = identity(pin!(PhantomPinned));
|
||||
| ^^^^^^^^^^^^^^^^^^^ - temporary value is freed at the end of this statement
|
||||
| |
|
||||
| creates a temporary which is freed while still in use
|
||||
| creates a temporary value which is freed while still in use
|
||||
LL |
|
||||
LL | stuff(phantom_pinned)
|
||||
| -------------- borrow later used here
|
||||
@ -18,7 +18,7 @@ error[E0716]: temporary value dropped while borrowed
|
||||
LL | let phantom_pinned = {
|
||||
| -------------- borrow later stored here
|
||||
LL | let phantom_pinned = pin!(PhantomPinned);
|
||||
| ^^^^^^^^^^^^^^^^^^^ creates a temporary which is freed while still in use
|
||||
| ^^^^^^^^^^^^^^^^^^^ creates a temporary value which is freed while still in use
|
||||
...
|
||||
LL | };
|
||||
| - temporary value is freed at the end of this statement
|
||||
|
@ -5,7 +5,7 @@ LL | fn call1<'a>(x: &'a usize) {
|
||||
| -- lifetime `'a` defined here
|
||||
...
|
||||
LL | let z: &'a & usize = &(&y);
|
||||
| ----------- ^^^^ creates a temporary which is freed while still in use
|
||||
| ----------- ^^^^ creates a temporary value which is freed while still in use
|
||||
| |
|
||||
| type annotation requires that borrow lasts for `'a`
|
||||
...
|
||||
|
@ -4,7 +4,7 @@ error[E0716]: temporary value dropped while borrowed
|
||||
LL | x = &id(3);
|
||||
| ^^^^^- temporary value is freed at the end of this statement
|
||||
| |
|
||||
| creates a temporary which is freed while still in use
|
||||
| creates a temporary value which is freed while still in use
|
||||
LL | assert_eq!(*x, 3);
|
||||
| ----------------- borrow later used here
|
||||
|
|
||||
|
@ -18,7 +18,7 @@ fn f() {
|
||||
|
||||
v3.push(&id('x')); // statement 6
|
||||
//~^ ERROR temporary value dropped while borrowed
|
||||
//~| NOTE creates a temporary which is freed while still in use
|
||||
//~| NOTE creates a temporary value which is freed while still in use
|
||||
//~| NOTE temporary value is freed at the end of this statement
|
||||
//~| HELP consider using a `let` binding to create a longer lived value
|
||||
|
||||
@ -28,7 +28,7 @@ fn f() {
|
||||
|
||||
v4.push(&id('y'));
|
||||
//~^ ERROR temporary value dropped while borrowed
|
||||
//~| NOTE creates a temporary which is freed while still in use
|
||||
//~| NOTE creates a temporary value which is freed while still in use
|
||||
//~| NOTE temporary value is freed at the end of this statement
|
||||
//~| NOTE consider using a `let` binding to create a longer lived value
|
||||
v4.use_ref();
|
||||
@ -39,7 +39,7 @@ fn f() {
|
||||
|
||||
v5.push(&id('z'));
|
||||
//~^ ERROR temporary value dropped while borrowed
|
||||
//~| NOTE creates a temporary which is freed while still in use
|
||||
//~| NOTE creates a temporary value which is freed while still in use
|
||||
//~| NOTE temporary value is freed at the end of this statement
|
||||
//~| HELP consider using a `let` binding to create a longer lived value
|
||||
|
||||
|
@ -16,7 +16,7 @@ error[E0716]: temporary value dropped while borrowed
|
||||
LL | v3.push(&id('x')); // statement 6
|
||||
| ^^^^^^^ - temporary value is freed at the end of this statement
|
||||
| |
|
||||
| creates a temporary which is freed while still in use
|
||||
| creates a temporary value which is freed while still in use
|
||||
...
|
||||
LL | (v1, v2, v3, /* v4 is above. */ v5).use_ref();
|
||||
| -- borrow later used here
|
||||
@ -33,7 +33,7 @@ error[E0716]: temporary value dropped while borrowed
|
||||
LL | v4.push(&id('y'));
|
||||
| ^^^^^^^ - temporary value is freed at the end of this statement
|
||||
| |
|
||||
| creates a temporary which is freed while still in use
|
||||
| creates a temporary value which is freed while still in use
|
||||
...
|
||||
LL | v4.use_ref();
|
||||
| ------------ borrow later used here
|
||||
@ -46,7 +46,7 @@ error[E0716]: temporary value dropped while borrowed
|
||||
LL | v5.push(&id('z'));
|
||||
| ^^^^^^^ - temporary value is freed at the end of this statement
|
||||
| |
|
||||
| creates a temporary which is freed while still in use
|
||||
| creates a temporary value which is freed while still in use
|
||||
...
|
||||
LL | (v1, v2, v3, /* v4 is above. */ v5).use_ref();
|
||||
| -- borrow later used here
|
||||
|
@ -2,7 +2,7 @@ error[E0716]: temporary value dropped while borrowed
|
||||
--> $DIR/borrowck-ref-into-rvalue.rs:4:11
|
||||
|
|
||||
LL | match Some("Hello".to_string()) {
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^ creates a temporary which is freed while still in use
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^ creates a temporary value which is freed while still in use
|
||||
...
|
||||
LL | }
|
||||
| - temporary value is freed at the end of this statement
|
||||
|
@ -2,7 +2,7 @@ error[E0716]: temporary value dropped while borrowed
|
||||
--> $DIR/issue-15480.rs:6:10
|
||||
|
|
||||
LL | &id(3)
|
||||
| ^^^^^ creates a temporary which is freed while still in use
|
||||
| ^^^^^ creates a temporary value which is freed while still in use
|
||||
LL | ];
|
||||
| - temporary value is freed at the end of this statement
|
||||
...
|
||||
|
@ -2,7 +2,7 @@ error[E0716]: temporary value dropped while borrowed
|
||||
--> $DIR/regions-close-over-borrowed-ref-in-obj.rs:12:27
|
||||
|
|
||||
LL | let ss: &isize = &id(1);
|
||||
| ^^^^^ creates a temporary which is freed while still in use
|
||||
| ^^^^^ creates a temporary value which is freed while still in use
|
||||
...
|
||||
LL | }
|
||||
| - temporary value is freed at the end of this statement
|
||||
|
@ -2,7 +2,7 @@ error[E0716]: temporary value dropped while borrowed
|
||||
--> $DIR/slice-borrow.rs:6:28
|
||||
|
|
||||
LL | let x: &[isize] = &vec![1, 2, 3, 4, 5];
|
||||
| ^^^^^^^^^^^^^^^^^^^ creates a temporary which is freed while still in use
|
||||
| ^^^^^^^^^^^^^^^^^^^ creates a temporary value which is freed while still in use
|
||||
...
|
||||
LL | }
|
||||
| - temporary value is freed at the end of this statement
|
||||
|
@ -13,7 +13,7 @@ LL | static PROMOTION_FAIL_S: Option<&'static WithDtor> = Some(&WithDtor);
|
||||
| ------^^^^^^^^-
|
||||
| | | |
|
||||
| | | temporary value is freed at the end of this statement
|
||||
| | creates a temporary which is freed while still in use
|
||||
| | creates a temporary value which is freed while still in use
|
||||
| using this value as a static requires that borrow lasts for `'static`
|
||||
|
||||
error[E0493]: destructor of `WithDtor` cannot be evaluated at compile-time
|
||||
@ -31,7 +31,7 @@ LL | const PROMOTION_FAIL_C: Option<&'static WithDtor> = Some(&WithDtor);
|
||||
| ------^^^^^^^^-
|
||||
| | | |
|
||||
| | | temporary value is freed at the end of this statement
|
||||
| | creates a temporary which is freed while still in use
|
||||
| | creates a temporary value which is freed while still in use
|
||||
| using this value as a constant requires that borrow lasts for `'static`
|
||||
|
||||
error[E0493]: destructor of `(WithDtor, i32)` cannot be evaluated at compile-time
|
||||
|
@ -6,7 +6,7 @@ LL | fn state1(self_: &mut StateMachineIter) -> Option<&'static str> {
|
||||
LL | self_.statefn = &id(state2 as StateMachineFunc);
|
||||
| -----------------^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^- temporary value is freed at the end of this statement
|
||||
| | |
|
||||
| | creates a temporary which is freed while still in use
|
||||
| | creates a temporary value which is freed while still in use
|
||||
| assignment requires that borrow lasts for `'1`
|
||||
|
||||
error[E0716]: temporary value dropped while borrowed
|
||||
@ -17,7 +17,7 @@ LL | fn state2(self_: &mut StateMachineIter) -> Option<(&'static str)> {
|
||||
LL | self_.statefn = &id(state3 as StateMachineFunc);
|
||||
| -----------------^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^- temporary value is freed at the end of this statement
|
||||
| | |
|
||||
| | creates a temporary which is freed while still in use
|
||||
| | creates a temporary value which is freed while still in use
|
||||
| assignment requires that borrow lasts for `'1`
|
||||
|
||||
error[E0716]: temporary value dropped while borrowed
|
||||
@ -28,7 +28,7 @@ LL | fn state3(self_: &mut StateMachineIter) -> Option<(&'static str)> {
|
||||
LL | self_.statefn = &id(finished as StateMachineFunc);
|
||||
| -----------------^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^- temporary value is freed at the end of this statement
|
||||
| | |
|
||||
| | creates a temporary which is freed while still in use
|
||||
| | creates a temporary value which is freed while still in use
|
||||
| assignment requires that borrow lasts for `'1`
|
||||
|
||||
error[E0515]: cannot return value referencing temporary value
|
||||
|
@ -2,7 +2,7 @@ error[E0716]: temporary value dropped while borrowed
|
||||
--> $DIR/static-region-bound.rs:10:14
|
||||
|
|
||||
LL | let x = &id(3);
|
||||
| ^^^^^ creates a temporary which is freed while still in use
|
||||
| ^^^^^ creates a temporary value which is freed while still in use
|
||||
LL | f(x);
|
||||
| ---- argument requires that borrow lasts for `'static`
|
||||
LL | }
|
||||
|
@ -2,7 +2,7 @@ error[E0716]: temporary value dropped while borrowed
|
||||
--> $DIR/issue-44373.rs:4:42
|
||||
|
|
||||
LL | let _val: &'static [&'static u32] = &[&FOO];
|
||||
| ----------------------- ^^^^^^ creates a temporary which is freed while still in use
|
||||
| ----------------------- ^^^^^^ creates a temporary value which is freed while still in use
|
||||
| |
|
||||
| type annotation requires that borrow lasts for `'static`
|
||||
LL | }
|
||||
|
Loading…
Reference in New Issue
Block a user