1
Fork 0

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:
Manish Goregaokar 2022-11-09 15:39:02 -05:00 committed by GitHub
commit 46bc12c95a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
54 changed files with 128 additions and 128 deletions

View file

@ -1557,7 +1557,7 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> {
} }
let mut err = self.temporary_value_borrowed_for_too_long(proper_span); 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"); err.span_label(drop_span, "temporary value is freed at the end of this statement");
match explanation { match explanation {

View file

@ -1059,7 +1059,7 @@ impl<P, U> DispatchFromDyn<Pin<U>> for Pin<P> where P: DispatchFromDyn<U> {}
/// 8 | let x: Pin<&mut Foo> = { /// 8 | let x: Pin<&mut Foo> = {
/// | - borrow later stored here /// | - borrow later stored here
/// 9 | let x: Pin<&mut Foo> = pin!(Foo { /* … */ }); /// 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 /// 10 | x
/// 11 | }; // <- Foo is dropped /// 11 | }; // <- Foo is dropped
/// | - temporary value is freed at the end of this statement /// | - temporary value is freed at the end of this statement

View file

@ -4,7 +4,7 @@ error[E0716]: temporary value dropped while borrowed
LL | let x = defer(&vec!["Goodbye", "world!"]); LL | let x = defer(&vec!["Goodbye", "world!"]);
| ^^^^^^^^^^^^^^^^^^^^^^^^^ - temporary value is freed at the end of this statement | ^^^^^^^^^^^^^^^^^^^^^^^^^ - 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]; LL | x.x[0];
| ------ borrow later used here | ------ borrow later used here
| |

View file

@ -4,7 +4,7 @@ error[E0716]: temporary value dropped while borrowed
LL | buggy_map.insert(42, &*Box::new(1)); LL | buggy_map.insert(42, &*Box::new(1));
| ^^^^^^^^^^^ - temporary value is freed at the end of this statement | ^^^^^^^^^^^ - 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); LL | buggy_map.insert(43, &*tmp);
| --------------------------- borrow later used here | --------------------------- borrow later used here

View file

@ -4,7 +4,7 @@ error[E0716]: temporary value dropped while borrowed
LL | let y = x.as_ref().unwrap_or(&id(5)); LL | let y = x.as_ref().unwrap_or(&id(5));
| ^^^^^ - temporary value is freed at the end of this statement | ^^^^^ - 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; LL | let _ = &y;
| -- borrow later used here | -- borrow later used here
| |

View file

@ -5,7 +5,7 @@ LL | pub fn foo<'a, F: Fn(&'a ())>(bar: F) {
| -- lifetime `'a` defined here | -- lifetime `'a` defined here
LL | / bar.call(( LL | / bar.call((
LL | | &id(()), LL | | &id(()),
| | ^^^^^^ 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 | | -- temporary value is freed at the end of this statement
| |______| | |______|

View file

@ -10,7 +10,7 @@ fn main() {
let val: &_ = binding.0; let val: &_ = binding.0;
//~^ ERROR temporary value dropped while borrowed [E0716] //~^ ERROR temporary value dropped while borrowed [E0716]
//~| NOTE temporary value is freed at the end of this statement //~| 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 //~| HELP consider using a `let` binding to create a longer lived value
println!("{}", val); println!("{}", val);
//~^ borrow later used here //~^ borrow later used here

View file

@ -9,7 +9,7 @@ fn main() {
let val: &_ = x.borrow().0; let val: &_ = x.borrow().0;
//~^ ERROR temporary value dropped while borrowed [E0716] //~^ ERROR temporary value dropped while borrowed [E0716]
//~| NOTE temporary value is freed at the end of this statement //~| 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 //~| HELP consider using a `let` binding to create a longer lived value
println!("{}", val); println!("{}", val);
//~^ borrow later used here //~^ borrow later used here

View file

@ -4,7 +4,7 @@ error[E0716]: temporary value dropped while borrowed
LL | let val: &_ = x.borrow().0; LL | let val: &_ = x.borrow().0;
| ^^^^^^^^^^ - temporary value is freed at the end of this statement | ^^^^^^^^^^ - 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); LL | println!("{}", val);
| --- borrow later used here | --- borrow later used here

View file

@ -4,7 +4,7 @@ error[E0716]: temporary value dropped while borrowed
LL | let x1 = arg(&AddFlags(1)); LL | let x1 = arg(&AddFlags(1));
| ^^^^^^^^^^^ - temporary value is freed at the end of this statement | ^^^^^^^^^^^ - 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); LL | (x1, x2, x3, x4, x5, x6, x7);
| -- borrow later used here | -- borrow later used here
@ -21,7 +21,7 @@ error[E0716]: temporary value dropped while borrowed
LL | let x2 = AddFlags(1).get(); LL | let x2 = AddFlags(1).get();
| ^^^^^^^^^^^ - temporary value is freed at the end of this statement | ^^^^^^^^^^^ - 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); LL | (x1, x2, x3, x4, x5, x6, x7);
| -- borrow later used here | -- borrow later used here
@ -38,7 +38,7 @@ error[E0716]: temporary value dropped while borrowed
LL | let x3 = &*arg(&AddFlags(1)); LL | let x3 = &*arg(&AddFlags(1));
| ^^^^^^^^^^^ - temporary value is freed at the end of this statement | ^^^^^^^^^^^ - 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); LL | (x1, x2, x3, x4, x5, x6, x7);
| -- borrow later used here | -- borrow later used here
@ -55,7 +55,7 @@ error[E0716]: temporary value dropped while borrowed
LL | let ref x4 = *arg(&AddFlags(1)); LL | let ref x4 = *arg(&AddFlags(1));
| ^^^^^^^^^^^ - temporary value is freed at the end of this statement | ^^^^^^^^^^^ - 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); LL | (x1, x2, x3, x4, x5, x6, x7);
| -- borrow later used here | -- borrow later used here
@ -72,7 +72,7 @@ error[E0716]: temporary value dropped while borrowed
LL | let &ref x5 = arg(&AddFlags(1)); LL | let &ref x5 = arg(&AddFlags(1));
| ^^^^^^^^^^^ - temporary value is freed at the end of this statement | ^^^^^^^^^^^ - 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); LL | (x1, x2, x3, x4, x5, x6, x7);
| -- borrow later used here | -- borrow later used here
@ -89,7 +89,7 @@ error[E0716]: temporary value dropped while borrowed
LL | let x6 = AddFlags(1).get(); LL | let x6 = AddFlags(1).get();
| ^^^^^^^^^^^ - temporary value is freed at the end of this statement | ^^^^^^^^^^^ - 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); LL | (x1, x2, x3, x4, x5, x6, x7);
| -- borrow later used here | -- 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() }; LL | let StackBox { f: x7 } = StackBox { f: AddFlags(1).get() };
| ^^^^^^^^^^^ - temporary value is freed at the end of this statement | ^^^^^^^^^^^ - 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 |
LL | (x1, x2, x3, x4, x5, x6, x7); LL | (x1, x2, x3, x4, x5, x6, x7);
| -- borrow later used here | -- borrow later used here

View file

@ -4,7 +4,7 @@ error[E0716]: temporary value dropped while borrowed
LL | let x: &'static usize = LL | let x: &'static usize =
| -------------- type annotation requires that borrow lasts for `'static` | -------------- type annotation requires that borrow lasts for `'static`
LL | &std::intrinsics::size_of::<i32>(); 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 | } LL | }
| - temporary value is freed at the end of this statement | - temporary value is freed at the end of this statement

View file

@ -10,7 +10,7 @@ error[E0716]: temporary value dropped while borrowed
--> $DIR/dont_promote_unstable_const_fn.rs:17:28 --> $DIR/dont_promote_unstable_const_fn.rs:17:28
| |
LL | let _: &'static u32 = &foo(); 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` | type annotation requires that borrow lasts for `'static`
LL | } LL | }
@ -20,7 +20,7 @@ error[E0716]: temporary value dropped while borrowed
--> $DIR/dont_promote_unstable_const_fn.rs:21:28 --> $DIR/dont_promote_unstable_const_fn.rs:21:28
| |
LL | let _: &'static u32 = &meh(); 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` | 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 --> $DIR/dont_promote_unstable_const_fn.rs:22:26
| |
LL | let x: &'static _ = &std::time::Duration::from_millis(42).subsec_millis(); 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` | type annotation requires that borrow lasts for `'static`
LL | LL |

View file

@ -2,7 +2,7 @@ error[E0716]: temporary value dropped while borrowed
--> $DIR/dont_promote_unstable_const_fn_cross_crate.rs:8:28 --> $DIR/dont_promote_unstable_const_fn_cross_crate.rs:8:28
| |
LL | let _: &'static u32 = &foo(); 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` | type annotation requires that borrow lasts for `'static`
LL | let _x: &'static u32 = &foo(); 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 --> $DIR/dont_promote_unstable_const_fn_cross_crate.rs:9:29
| |
LL | let _x: &'static u32 = &foo(); 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` | type annotation requires that borrow lasts for `'static`
LL | } LL | }

View file

@ -2,7 +2,7 @@ error[E0716]: temporary value dropped while borrowed
--> $DIR/promoted_const_fn_fail.rs:17:27 --> $DIR/promoted_const_fn_fail.rs:17:27
| |
LL | let x: &'static u8 = &(bar() + 1); 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` | type annotation requires that borrow lasts for `'static`
... ...

View file

@ -2,7 +2,7 @@ error[E0716]: temporary value dropped while borrowed
--> $DIR/promoted_const_fn_fail_deny_const_err.rs:18:27 --> $DIR/promoted_const_fn_fail_deny_const_err.rs:18:27
| |
LL | let x: &'static u8 = &(bar() + 1); 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` | type annotation requires that borrow lasts for `'static`
... ...

View file

@ -2,7 +2,7 @@ error[E0716]: temporary value dropped while borrowed
--> $DIR/promoted_raw_ptr_ops.rs:2:29 --> $DIR/promoted_raw_ptr_ops.rs:2:29
| |
LL | let x: &'static bool = &(42 as *const i32 == 43 as *const i32); 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` | 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 --> $DIR/promoted_raw_ptr_ops.rs:4:30
| |
LL | let y: &'static usize = &(&1 as *const i32 as usize + 1); 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` | 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 --> $DIR/promoted_raw_ptr_ops.rs:6:28
| |
LL | let z: &'static i32 = &(unsafe { *(42 as *const i32) }); 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` | 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 --> $DIR/promoted_raw_ptr_ops.rs:8:29
| |
LL | let a: &'static bool = &(main as fn() == main as fn()); 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` | type annotation requires that borrow lasts for `'static`
LL | LL |

View file

@ -2,7 +2,7 @@ error[E0716]: temporary value dropped while borrowed
--> $DIR/transmute-const-promotion.rs:4:37 --> $DIR/transmute-const-promotion.rs:4:37
| |
LL | let x: &'static u32 = unsafe { &mem::transmute(3.0f32) }; 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` | type annotation requires that borrow lasts for `'static`
LL | LL |

View file

@ -7,7 +7,7 @@ LL | let x: &'static bool = &unsafe {
| | type annotation requires that borrow lasts for `'static` | | type annotation requires that borrow lasts for `'static`
LL | | Foo { a: &1 }.b == Foo { a: &2 }.b LL | | Foo { a: &1 }.b == Foo { a: &2 }.b
LL | | }; LL | | };
| |_____^ 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 | - temporary value is freed at the end of this statement

View file

@ -2,7 +2,7 @@ error[E0716]: temporary value dropped while borrowed
--> $DIR/const-int-conversion.rs:2:28 --> $DIR/const-int-conversion.rs:2:28
| |
LL | let x: &'static i32 = &(5_i32.reverse_bits()); 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` | 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 --> $DIR/const-int-conversion.rs:4:28
| |
LL | let y: &'static i32 = &(i32::from_be_bytes([0x12, 0x34, 0x56, 0x78])); 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` | 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 --> $DIR/const-int-conversion.rs:6:28
| |
LL | let z: &'static i32 = &(i32::from_le_bytes([0x12, 0x34, 0x56, 0x78])); 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` | 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 --> $DIR/const-int-conversion.rs:8:28
| |
LL | let a: &'static i32 = &(i32::from_be(i32::from_ne_bytes([0x80, 0, 0, 0]))); 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` | 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 --> $DIR/const-int-conversion.rs:10:29
| |
LL | let b: &'static [u8] = &(0x12_34_56_78_i32.to_be_bytes()); 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` | 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 --> $DIR/const-int-conversion.rs:12:29
| |
LL | let c: &'static [u8] = &(0x12_34_56_78_i32.to_le_bytes()); 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` | 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 --> $DIR/const-int-conversion.rs:14:29
| |
LL | let d: &'static [u8] = &(i32::MIN.to_be().to_ne_bytes()); 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` | type annotation requires that borrow lasts for `'static`
LL | LL |

View file

@ -2,7 +2,7 @@ error[E0716]: temporary value dropped while borrowed
--> $DIR/const-int-overflowing.rs:2:36 --> $DIR/const-int-overflowing.rs:2:36
| |
LL | let x: &'static (i32, bool) = &(5_i32.overflowing_add(3)); 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` | 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 --> $DIR/const-int-overflowing.rs:4:36
| |
LL | let y: &'static (i32, bool) = &(5_i32.overflowing_sub(3)); 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` | 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 --> $DIR/const-int-overflowing.rs:6:36
| |
LL | let z: &'static (i32, bool) = &(5_i32.overflowing_mul(3)); 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` | type annotation requires that borrow lasts for `'static`
LL | LL |

View file

@ -2,7 +2,7 @@ error[E0716]: temporary value dropped while borrowed
--> $DIR/const-int-rotate.rs:2:28 --> $DIR/const-int-rotate.rs:2:28
| |
LL | let x: &'static i32 = &(5_i32.rotate_left(3)); 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` | 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 --> $DIR/const-int-rotate.rs:4:28
| |
LL | let y: &'static i32 = &(5_i32.rotate_right(3)); 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` | type annotation requires that borrow lasts for `'static`
LL | LL |

View file

@ -2,7 +2,7 @@ error[E0716]: temporary value dropped while borrowed
--> $DIR/const-int-sign.rs:2:29 --> $DIR/const-int-sign.rs:2:29
| |
LL | let x: &'static bool = &(5_i32.is_negative()); 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` | 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 --> $DIR/const-int-sign.rs:4:29
| |
LL | let y: &'static bool = &(5_i32.is_positive()); 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` | type annotation requires that borrow lasts for `'static`
LL | LL |

View file

@ -2,7 +2,7 @@ error[E0716]: temporary value dropped while borrowed
--> $DIR/const-int-wrapping.rs:2:28 --> $DIR/const-int-wrapping.rs:2:28
| |
LL | let x: &'static i32 = &(5_i32.wrapping_add(3)); 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` | 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 --> $DIR/const-int-wrapping.rs:4:28
| |
LL | let y: &'static i32 = &(5_i32.wrapping_sub(3)); 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` | 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 --> $DIR/const-int-wrapping.rs:6:28
| |
LL | let z: &'static i32 = &(5_i32.wrapping_mul(3)); 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` | 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 --> $DIR/const-int-wrapping.rs:8:28
| |
LL | let a: &'static i32 = &(5_i32.wrapping_shl(3)); 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` | 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 --> $DIR/const-int-wrapping.rs:10:28
| |
LL | let b: &'static i32 = &(5_i32.wrapping_shr(3)); 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` | type annotation requires that borrow lasts for `'static`
LL | LL |

View file

@ -11,7 +11,7 @@ LL | const B3: Option<&mut i32> = Some(&mut 42);
| ----------^^- | ----------^^-
| | | | | | | |
| | | temporary value is freed at the end of this statement | | | 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` | using this value as a constant requires that borrow lasts for `'static`
error[E0716]: temporary value dropped while borrowed 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 | | | 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` | using this value as a constant requires that borrow lasts for `'static`
error[E0716]: temporary value dropped while borrowed 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 | | | 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` | using this value as a constant requires that borrow lasts for `'static`
error[E0716]: temporary value dropped while borrowed 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 | | | 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` | using this value as a static requires that borrow lasts for `'static`
error[E0716]: temporary value dropped while borrowed 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 | | | 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` | using this value as a static requires that borrow lasts for `'static`
error: aborting due to 6 previous errors error: aborting due to 6 previous errors

View file

@ -2,7 +2,7 @@ error[E0716]: temporary value dropped while borrowed
--> $DIR/const-ptr-nonnull.rs:4:37 --> $DIR/const-ptr-nonnull.rs:4:37
| |
LL | let x: &'static NonNull<u32> = &(NonNull::dangling()); 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` | 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 --> $DIR/const-ptr-nonnull.rs:9:37
| |
LL | let x: &'static NonNull<u32> = &(non_null.cast()); 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` | type annotation requires that borrow lasts for `'static`
LL | LL |

View file

@ -2,7 +2,7 @@ error[E0716]: temporary value dropped while borrowed
--> $DIR/const-ptr-unique.rs:8:33 --> $DIR/const-ptr-unique.rs:8:33
| |
LL | let x: &'static *mut u32 = &(unique.as_ptr()); 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` | type annotation requires that borrow lasts for `'static`
LL | LL |

View file

@ -2,7 +2,7 @@ error[E0716]: temporary value dropped while borrowed
--> $DIR/interior-mutability.rs:40:26 --> $DIR/interior-mutability.rs:40:26
| |
LL | let x: &'static _ = &X; 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` | 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 --> $DIR/interior-mutability.rs:41:26
| |
LL | let y: &'static _ = &Y; 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` | type annotation requires that borrow lasts for `'static`
LL | let z: &'static _ = &Z; LL | let z: &'static _ = &Z;
@ -24,7 +24,7 @@ error[E0716]: temporary value dropped while borrowed
--> $DIR/interior-mutability.rs:42:26 --> $DIR/interior-mutability.rs:42:26
| |
LL | let z: &'static _ = &Z; 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` | type annotation requires that borrow lasts for `'static`
LL | } LL | }

View file

@ -5,7 +5,7 @@ LL | const FOO: Option<&[[u8; 3]]> = Some(&[*b"foo"]);
| ------^^^^^^^^^- | ------^^^^^^^^^-
| | | | | | | |
| | | temporary value is freed at the end of this statement | | | 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` | using this value as a constant requires that borrow lasts for `'static`
error[E0716]: temporary value dropped while borrowed 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 | | | 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` | using this value as a constant requires that borrow lasts for `'static`
error: aborting due to 2 previous errors error: aborting due to 2 previous errors

View file

@ -2,7 +2,7 @@ error[E0716]: temporary value dropped while borrowed
--> $DIR/promotion.rs:11:27 --> $DIR/promotion.rs:11:27
| |
LL | let x: &'static () = &foo1(); 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` | type annotation requires that borrow lasts for `'static`
... ...
@ -13,7 +13,7 @@ error[E0716]: temporary value dropped while borrowed
--> $DIR/promotion.rs:12:28 --> $DIR/promotion.rs:12:28
| |
LL | let y: &'static i32 = &foo2(42); 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` | type annotation requires that borrow lasts for `'static`
... ...
@ -24,7 +24,7 @@ error[E0716]: temporary value dropped while borrowed
--> $DIR/promotion.rs:13:28 --> $DIR/promotion.rs:13:28
| |
LL | let z: &'static i32 = &foo3(); 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` | type annotation requires that borrow lasts for `'static`
... ...
@ -35,7 +35,7 @@ error[E0716]: temporary value dropped while borrowed
--> $DIR/promotion.rs:14:34 --> $DIR/promotion.rs:14:34
| |
LL | let a: &'static Cell<i32> = &foo4(); 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` | type annotation requires that borrow lasts for `'static`
... ...
@ -46,7 +46,7 @@ error[E0716]: temporary value dropped while borrowed
--> $DIR/promotion.rs:15:42 --> $DIR/promotion.rs:15:42
| |
LL | let a: &'static Option<Cell<i32>> = &foo5(); 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` | type annotation requires that borrow lasts for `'static`
LL | let a: &'static Option<Cell<i32>> = &foo6(); LL | let a: &'static Option<Cell<i32>> = &foo6();
@ -57,7 +57,7 @@ error[E0716]: temporary value dropped while borrowed
--> $DIR/promotion.rs:16:42 --> $DIR/promotion.rs:16:42
| |
LL | let a: &'static Option<Cell<i32>> = &foo6(); 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` | type annotation requires that borrow lasts for `'static`
LL | } LL | }

View file

@ -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 | | | 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` | using this value as a static requires that borrow lasts for `'static`
error[E0716]: temporary value dropped while borrowed error[E0716]: temporary value dropped while borrowed
--> $DIR/promote-not.rs:11:18 --> $DIR/promote-not.rs:11:18
| |
LL | let x = &mut [1,2,3]; 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 LL | x
| - using this value as a static requires that borrow lasts for `'static` | - using this value as a static requires that borrow lasts for `'static`
LL | }; LL | };
@ -22,7 +22,7 @@ error[E0716]: temporary value dropped while borrowed
--> $DIR/promote-not.rs:20:32 --> $DIR/promote-not.rs:20:32
| |
LL | let _x: &'static () = &foo(); 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` | type annotation requires that borrow lasts for `'static`
LL | } LL | }
@ -32,7 +32,7 @@ error[E0716]: temporary value dropped while borrowed
--> $DIR/promote-not.rs:28:29 --> $DIR/promote-not.rs:28:29
| |
LL | let _x: &'static i32 = &unsafe { U { x: 0 }.x }; 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` | type annotation requires that borrow lasts for `'static`
LL | } LL | }
@ -42,7 +42,7 @@ error[E0716]: temporary value dropped while borrowed
--> $DIR/promote-not.rs:33:29 --> $DIR/promote-not.rs:33:29
| |
LL | let _x: &'static i32 = &unsafe { U { x: 0 }.x }; 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` | type annotation requires that borrow lasts for `'static`
LL | }; LL | };
@ -52,7 +52,7 @@ error[E0716]: temporary value dropped while borrowed
--> $DIR/promote-not.rs:39:29 --> $DIR/promote-not.rs:39:29
| |
LL | let _val: &'static _ = &(Cell::new(1), 2).1; 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` | type annotation requires that borrow lasts for `'static`
LL | }; LL | };
@ -62,7 +62,7 @@ error[E0716]: temporary value dropped while borrowed
--> $DIR/promote-not.rs:46:29 --> $DIR/promote-not.rs:46:29
| |
LL | let _val: &'static _ = &(Cell::new(1), 2).0; 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` | 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 --> $DIR/promote-not.rs:47:29
| |
LL | let _val: &'static _ = &(Cell::new(1), 2).1; 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` | 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 --> $DIR/promote-not.rs:50:29
| |
LL | let _val: &'static _ = &(1/0); 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` | 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 --> $DIR/promote-not.rs:51:29
| |
LL | let _val: &'static _ = &(1/(1-1)); 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` | 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 --> $DIR/promote-not.rs:52:29
| |
LL | let _val: &'static _ = &(1%0); 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` | 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 --> $DIR/promote-not.rs:53:29
| |
LL | let _val: &'static _ = &(1%(1-1)); 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` | 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 --> $DIR/promote-not.rs:54:29
| |
LL | let _val: &'static _ = &([1,2,3][4]+1); 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` | 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 --> $DIR/promote-not.rs:57:29
| |
LL | let _val: &'static _ = &TEST_DROP; 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` | 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 --> $DIR/promote-not.rs:59:29
| |
LL | let _val: &'static _ = &&TEST_DROP; 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` | 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 --> $DIR/promote-not.rs:59:30
| |
LL | let _val: &'static _ = &&TEST_DROP; 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` | 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 --> $DIR/promote-not.rs:62:29
| |
LL | let _val: &'static _ = &(&TEST_DROP,); 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` | 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 --> $DIR/promote-not.rs:62:31
| |
LL | let _val: &'static _ = &(&TEST_DROP,); 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` | 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 --> $DIR/promote-not.rs:65:29
| |
LL | let _val: &'static _ = &[&TEST_DROP; 1]; 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` | 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]; LL | let _val: &'static _ = &[&TEST_DROP; 1];
| ---------- ^^^^^^^^^ - temporary value is freed at the end of this statement | ---------- ^^^^^^^^^ - 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` | type annotation requires that borrow lasts for `'static`
error: aborting due to 20 previous errors error: aborting due to 20 previous errors

View file

@ -19,7 +19,7 @@ LL | let x: &'static u32 = &{
LL | | let y = 42; LL | | let y = 42;
LL | | y LL | | y
LL | | }; LL | | };
| |_____^ 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 | - temporary value is freed at the end of this statement

View file

@ -2,7 +2,7 @@ error[E0716]: temporary value dropped while borrowed
--> $DIR/promoted-const-drop.rs:13:26 --> $DIR/promoted-const-drop.rs:13:26
| |
LL | let _: &'static A = &A(); 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` | type annotation requires that borrow lasts for `'static`
LL | let _: &'static [A] = &[C]; LL | let _: &'static [A] = &[C];
@ -13,7 +13,7 @@ error[E0716]: temporary value dropped while borrowed
--> $DIR/promoted-const-drop.rs:14:28 --> $DIR/promoted-const-drop.rs:14:28
| |
LL | let _: &'static [A] = &[C]; 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` | type annotation requires that borrow lasts for `'static`
LL | } LL | }

View file

@ -2,7 +2,7 @@ error[E0716]: temporary value dropped while borrowed
--> $DIR/qualif-union.rs:28:26 --> $DIR/qualif-union.rs:28:26
| |
LL | let _: &'static _ = &C1; 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` | 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 --> $DIR/qualif-union.rs:29:26
| |
LL | let _: &'static _ = &C2; 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` | 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 --> $DIR/qualif-union.rs:30:26
| |
LL | let _: &'static _ = &C3; 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` | 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 --> $DIR/qualif-union.rs:31:26
| |
LL | let _: &'static _ = &C4; 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` | type annotation requires that borrow lasts for `'static`
LL | let _: &'static _ = &C5; LL | let _: &'static _ = &C5;
@ -46,7 +46,7 @@ error[E0716]: temporary value dropped while borrowed
--> $DIR/qualif-union.rs:32:26 --> $DIR/qualif-union.rs:32:26
| |
LL | let _: &'static _ = &C5; 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` | type annotation requires that borrow lasts for `'static`
LL | } LL | }

View file

@ -4,7 +4,7 @@ error[E0716]: temporary value dropped while borrowed
LL | let a = A(&mut true, &mut true, No); LL | let a = A(&mut true, &mut true, No);
| ^^^^ - temporary value is freed at the end of this statement | ^^^^ - 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); LL | assert_foo(a);
| - borrow later used here | - borrow later used here
@ -17,7 +17,7 @@ error[E0716]: temporary value dropped while borrowed
LL | let a = A(&mut true, &mut true, No); LL | let a = A(&mut true, &mut true, No);
| ^^^^ - temporary value is freed at the end of this statement | ^^^^ - 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); LL | assert_foo(a);
| - borrow later used here | - borrow later used here

View file

@ -2,7 +2,7 @@ error[E0716]: temporary value dropped while borrowed
--> $DIR/hrtb-implied-1.rs:31:22 --> $DIR/hrtb-implied-1.rs:31:22
| |
LL | let slice = &mut (); 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); LL | print_items::<WindowsMut<'_>>(windows);
| -------------------------------------- argument requires that borrow lasts for `'static` | -------------------------------------- argument requires that borrow lasts for `'static`

View file

@ -4,7 +4,7 @@ error[E0716]: temporary value dropped while borrowed
LL | let _vec: Vec<&'static String> = vec![&String::new()]; LL | let _vec: Vec<&'static String> = vec![&String::new()];
| -------------------- ^^^^^^^^^^^^^ - temporary value is freed at the end of this statement | -------------------- ^^^^^^^^^^^^^ - 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` | type annotation requires that borrow lasts for `'static`
error: aborting due to previous error error: aborting due to previous error

View file

@ -4,7 +4,7 @@ error[E0716]: temporary value dropped while borrowed
LL | foo(&unpromotable(5u32)); 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` | argument requires that borrow lasts for `'static`
LL | } LL | }
| - temporary value is freed at the end of this statement | - temporary value is freed at the end of this statement

View file

@ -4,7 +4,7 @@ error[E0716]: temporary value dropped while borrowed
LL | let mut x = vec![1].iter(); LL | let mut x = vec![1].iter();
| ^^^^^^^ - temporary value is freed at the end of this statement | ^^^^^^^ - 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 |
LL | x.use_mut(); LL | x.use_mut();
| ----------- borrow later used here | ----------- borrow later used here

View file

@ -2,7 +2,7 @@ error[E0716]: temporary value dropped while borrowed
--> $DIR/borrowed-temporary-error.rs:8:10 --> $DIR/borrowed-temporary-error.rs:8:10
| |
LL | &(v,) 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 |
LL | }); LL | });
| - temporary value is freed at the end of this statement | - temporary value is freed at the end of this statement

View file

@ -4,7 +4,7 @@ error[E0716]: temporary value dropped while borrowed
LL | let (_, z) = foo(&"hello".to_string()); LL | let (_, z) = foo(&"hello".to_string());
| -----^^^^^^^^^^^^^^^^^^^-- temporary value is freed at the end of this statement | -----^^^^^^^^^^^^^^^^^^^-- 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` | argument requires that borrow lasts for `'static`
error: aborting due to previous error error: aborting due to previous error

View file

@ -76,7 +76,7 @@ error[E0716]: temporary value dropped while borrowed
LL | let _: Vec<&'static String> = vec![&String::new()]; LL | let _: Vec<&'static String> = vec![&String::new()];
| -------------------- ^^^^^^^^^^^^^ - temporary value is freed at the end of this statement | -------------------- ^^^^^^^^^^^^^ - 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` | type annotation requires that borrow lasts for `'static`
error[E0716]: temporary value dropped while borrowed 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); LL | let (_, a): (Vec<&'static String>, _) = (vec![&String::new()], 44);
| ------------------------- ^^^^^^^^^^^^^ - temporary value is freed at the end of this statement | ------------------------- ^^^^^^^^^^^^^ - 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` | type annotation requires that borrow lasts for `'static`
error[E0716]: temporary value dropped while borrowed 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); LL | let (_a, b): (Vec<&'static String>, _) = (vec![&String::new()], 44);
| ------------------------- ^^^^^^^^^^^^^ - temporary value is freed at the end of this statement | ------------------------- ^^^^^^^^^^^^^ - 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` | type annotation requires that borrow lasts for `'static`
error[E0597]: `x` does not live long enough error[E0597]: `x` does not live long enough

View file

@ -4,7 +4,7 @@ error[E0716]: temporary value dropped while borrowed
LL | let phantom_pinned = identity(pin!(PhantomPinned)); LL | let phantom_pinned = identity(pin!(PhantomPinned));
| ^^^^^^^^^^^^^^^^^^^ - temporary value is freed at the end of this statement | ^^^^^^^^^^^^^^^^^^^ - 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 |
LL | stuff(phantom_pinned) LL | stuff(phantom_pinned)
| -------------- borrow later used here | -------------- borrow later used here
@ -18,7 +18,7 @@ error[E0716]: temporary value dropped while borrowed
LL | let phantom_pinned = { LL | let phantom_pinned = {
| -------------- borrow later stored here | -------------- borrow later stored here
LL | let phantom_pinned = pin!(PhantomPinned); 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 | }; LL | };
| - temporary value is freed at the end of this statement | - temporary value is freed at the end of this statement

View file

@ -5,7 +5,7 @@ LL | fn call1<'a>(x: &'a usize) {
| -- lifetime `'a` defined here | -- lifetime `'a` defined here
... ...
LL | let z: &'a & usize = &(&y); 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` | type annotation requires that borrow lasts for `'a`
... ...

View file

@ -4,7 +4,7 @@ error[E0716]: temporary value dropped while borrowed
LL | x = &id(3); LL | x = &id(3);
| ^^^^^- temporary value is freed at the end of this statement | ^^^^^- 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); LL | assert_eq!(*x, 3);
| ----------------- borrow later used here | ----------------- borrow later used here
| |

View file

@ -18,7 +18,7 @@ fn f() {
v3.push(&id('x')); // statement 6 v3.push(&id('x')); // statement 6
//~^ ERROR temporary value dropped while borrowed //~^ 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 temporary value is freed at the end of this statement
//~| HELP consider using a `let` binding to create a longer lived value //~| HELP consider using a `let` binding to create a longer lived value
@ -28,7 +28,7 @@ fn f() {
v4.push(&id('y')); v4.push(&id('y'));
//~^ ERROR temporary value dropped while borrowed //~^ 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 temporary value is freed at the end of this statement
//~| NOTE consider using a `let` binding to create a longer lived value //~| NOTE consider using a `let` binding to create a longer lived value
v4.use_ref(); v4.use_ref();
@ -39,7 +39,7 @@ fn f() {
v5.push(&id('z')); v5.push(&id('z'));
//~^ ERROR temporary value dropped while borrowed //~^ 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 temporary value is freed at the end of this statement
//~| HELP consider using a `let` binding to create a longer lived value //~| HELP consider using a `let` binding to create a longer lived value

View file

@ -16,7 +16,7 @@ error[E0716]: temporary value dropped while borrowed
LL | v3.push(&id('x')); // statement 6 LL | v3.push(&id('x')); // statement 6
| ^^^^^^^ - temporary value is freed at the end of this statement | ^^^^^^^ - 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(); LL | (v1, v2, v3, /* v4 is above. */ v5).use_ref();
| -- borrow later used here | -- borrow later used here
@ -33,7 +33,7 @@ error[E0716]: temporary value dropped while borrowed
LL | v4.push(&id('y')); LL | v4.push(&id('y'));
| ^^^^^^^ - temporary value is freed at the end of this statement | ^^^^^^^ - 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(); LL | v4.use_ref();
| ------------ borrow later used here | ------------ borrow later used here
@ -46,7 +46,7 @@ error[E0716]: temporary value dropped while borrowed
LL | v5.push(&id('z')); LL | v5.push(&id('z'));
| ^^^^^^^ - temporary value is freed at the end of this statement | ^^^^^^^ - 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(); LL | (v1, v2, v3, /* v4 is above. */ v5).use_ref();
| -- borrow later used here | -- borrow later used here

View file

@ -2,7 +2,7 @@ error[E0716]: temporary value dropped while borrowed
--> $DIR/borrowck-ref-into-rvalue.rs:4:11 --> $DIR/borrowck-ref-into-rvalue.rs:4:11
| |
LL | match Some("Hello".to_string()) { 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 | } LL | }
| - temporary value is freed at the end of this statement | - temporary value is freed at the end of this statement

View file

@ -2,7 +2,7 @@ error[E0716]: temporary value dropped while borrowed
--> $DIR/issue-15480.rs:6:10 --> $DIR/issue-15480.rs:6:10
| |
LL | &id(3) 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 | ]; LL | ];
| - temporary value is freed at the end of this statement | - temporary value is freed at the end of this statement
... ...

View file

@ -2,7 +2,7 @@ error[E0716]: temporary value dropped while borrowed
--> $DIR/regions-close-over-borrowed-ref-in-obj.rs:12:27 --> $DIR/regions-close-over-borrowed-ref-in-obj.rs:12:27
| |
LL | let ss: &isize = &id(1); 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 | } LL | }
| - temporary value is freed at the end of this statement | - temporary value is freed at the end of this statement

View file

@ -2,7 +2,7 @@ error[E0716]: temporary value dropped while borrowed
--> $DIR/slice-borrow.rs:6:28 --> $DIR/slice-borrow.rs:6:28
| |
LL | let x: &[isize] = &vec![1, 2, 3, 4, 5]; 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 | } LL | }
| - temporary value is freed at the end of this statement | - temporary value is freed at the end of this statement

View file

@ -13,7 +13,7 @@ LL | static PROMOTION_FAIL_S: Option<&'static WithDtor> = Some(&WithDtor);
| ------^^^^^^^^- | ------^^^^^^^^-
| | | | | | | |
| | | temporary value is freed at the end of this statement | | | 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` | using this value as a static requires that borrow lasts for `'static`
error[E0493]: destructor of `WithDtor` cannot be evaluated at compile-time 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 | | | 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` | using this value as a constant requires that borrow lasts for `'static`
error[E0493]: destructor of `(WithDtor, i32)` cannot be evaluated at compile-time error[E0493]: destructor of `(WithDtor, i32)` cannot be evaluated at compile-time

View file

@ -6,7 +6,7 @@ LL | fn state1(self_: &mut StateMachineIter) -> Option<&'static str> {
LL | self_.statefn = &id(state2 as StateMachineFunc); LL | self_.statefn = &id(state2 as StateMachineFunc);
| -----------------^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^- temporary value is freed at the end of this statement | -----------------^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^- 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` | assignment requires that borrow lasts for `'1`
error[E0716]: temporary value dropped while borrowed 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); LL | self_.statefn = &id(state3 as StateMachineFunc);
| -----------------^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^- temporary value is freed at the end of this statement | -----------------^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^- 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` | assignment requires that borrow lasts for `'1`
error[E0716]: temporary value dropped while borrowed 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); LL | self_.statefn = &id(finished as StateMachineFunc);
| -----------------^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^- temporary value is freed at the end of this statement | -----------------^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^- 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` | assignment requires that borrow lasts for `'1`
error[E0515]: cannot return value referencing temporary value error[E0515]: cannot return value referencing temporary value

View file

@ -2,7 +2,7 @@ error[E0716]: temporary value dropped while borrowed
--> $DIR/static-region-bound.rs:10:14 --> $DIR/static-region-bound.rs:10:14
| |
LL | let x = &id(3); 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); LL | f(x);
| ---- argument requires that borrow lasts for `'static` | ---- argument requires that borrow lasts for `'static`
LL | } LL | }

View file

@ -2,7 +2,7 @@ error[E0716]: temporary value dropped while borrowed
--> $DIR/issue-44373.rs:4:42 --> $DIR/issue-44373.rs:4:42
| |
LL | let _val: &'static [&'static u32] = &[&FOO]; 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` | type annotation requires that borrow lasts for `'static`
LL | } LL | }