Skip to content

Commit bcc1781

Browse files
authored
Rollup merge of rust-lang#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`.
2 parents edda37a + 6cb6564 commit bcc1781

File tree

54 files changed

+128
-128
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

54 files changed

+128
-128
lines changed

compiler/rustc_borrowck/src/diagnostics/conflict_errors.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1557,7 +1557,7 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> {
15571557
}
15581558

15591559
let mut err = self.temporary_value_borrowed_for_too_long(proper_span);
1560-
err.span_label(proper_span, "creates a temporary which is freed while still in use");
1560+
err.span_label(proper_span, "creates a temporary value which is freed while still in use");
15611561
err.span_label(drop_span, "temporary value is freed at the end of this statement");
15621562

15631563
match explanation {

library/core/src/pin.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1059,7 +1059,7 @@ impl<P, U> DispatchFromDyn<Pin<U>> for Pin<P> where P: DispatchFromDyn<U> {}
10591059
/// 8 | let x: Pin<&mut Foo> = {
10601060
/// | - borrow later stored here
10611061
/// 9 | let x: Pin<&mut Foo> = pin!(Foo { /* … */ });
1062-
/// | ^^^^^^^^^^^^^^^^^^^^^ creates a temporary which is freed while still in use
1062+
/// | ^^^^^^^^^^^^^^^^^^^^^ creates a temporary value which is freed while still in use
10631063
/// 10 | x
10641064
/// 11 | }; // <- Foo is dropped
10651065
/// | - temporary value is freed at the end of this statement

src/test/ui/borrowck/borrowck-borrowed-uniq-rvalue-2.stderr

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ error[E0716]: temporary value dropped while borrowed
44
LL | let x = defer(&vec!["Goodbye", "world!"]);
55
| ^^^^^^^^^^^^^^^^^^^^^^^^^ - temporary value is freed at the end of this statement
66
| |
7-
| creates a temporary which is freed while still in use
7+
| creates a temporary value which is freed while still in use
88
LL | x.x[0];
99
| ------ borrow later used here
1010
|

src/test/ui/borrowck/borrowck-borrowed-uniq-rvalue.stderr

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ error[E0716]: temporary value dropped while borrowed
44
LL | buggy_map.insert(42, &*Box::new(1));
55
| ^^^^^^^^^^^ - temporary value is freed at the end of this statement
66
| |
7-
| creates a temporary which is freed while still in use
7+
| creates a temporary value which is freed while still in use
88
...
99
LL | buggy_map.insert(43, &*tmp);
1010
| --------------------------- borrow later used here

src/test/ui/borrowck/issue-11493.stderr

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ error[E0716]: temporary value dropped while borrowed
44
LL | let y = x.as_ref().unwrap_or(&id(5));
55
| ^^^^^ - temporary value is freed at the end of this statement
66
| |
7-
| creates a temporary which is freed while still in use
7+
| creates a temporary value which is freed while still in use
88
LL | let _ = &y;
99
| -- borrow later used here
1010
|

src/test/ui/borrowck/issue-17545.stderr

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ LL | pub fn foo<'a, F: Fn(&'a ())>(bar: F) {
55
| -- lifetime `'a` defined here
66
LL | / bar.call((
77
LL | | &id(()),
8-
| | ^^^^^^ creates a temporary which is freed while still in use
8+
| | ^^^^^^ creates a temporary value which is freed while still in use
99
LL | | ));
1010
| | -- temporary value is freed at the end of this statement
1111
| |______|

src/test/ui/borrowck/issue-36082.fixed

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ fn main() {
1010
let val: &_ = binding.0;
1111
//~^ ERROR temporary value dropped while borrowed [E0716]
1212
//~| NOTE temporary value is freed at the end of this statement
13-
//~| NOTE creates a temporary which is freed while still in use
13+
//~| NOTE creates a temporary value which is freed while still in use
1414
//~| HELP consider using a `let` binding to create a longer lived value
1515
println!("{}", val);
1616
//~^ borrow later used here

src/test/ui/borrowck/issue-36082.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ fn main() {
99
let val: &_ = x.borrow().0;
1010
//~^ ERROR temporary value dropped while borrowed [E0716]
1111
//~| NOTE temporary value is freed at the end of this statement
12-
//~| NOTE creates a temporary which is freed while still in use
12+
//~| NOTE creates a temporary value which is freed while still in use
1313
//~| HELP consider using a `let` binding to create a longer lived value
1414
println!("{}", val);
1515
//~^ borrow later used here

src/test/ui/borrowck/issue-36082.stderr

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ error[E0716]: temporary value dropped while borrowed
44
LL | let val: &_ = x.borrow().0;
55
| ^^^^^^^^^^ - temporary value is freed at the end of this statement
66
| |
7-
| creates a temporary which is freed while still in use
7+
| creates a temporary value which is freed while still in use
88
...
99
LL | println!("{}", val);
1010
| --- borrow later used here

src/test/ui/cleanup-rvalue-scopes-cf.stderr

+7-7
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ error[E0716]: temporary value dropped while borrowed
44
LL | let x1 = arg(&AddFlags(1));
55
| ^^^^^^^^^^^ - temporary value is freed at the end of this statement
66
| |
7-
| creates a temporary which is freed while still in use
7+
| creates a temporary value which is freed while still in use
88
...
99
LL | (x1, x2, x3, x4, x5, x6, x7);
1010
| -- borrow later used here
@@ -21,7 +21,7 @@ error[E0716]: temporary value dropped while borrowed
2121
LL | let x2 = AddFlags(1).get();
2222
| ^^^^^^^^^^^ - temporary value is freed at the end of this statement
2323
| |
24-
| creates a temporary which is freed while still in use
24+
| creates a temporary value which is freed while still in use
2525
...
2626
LL | (x1, x2, x3, x4, x5, x6, x7);
2727
| -- borrow later used here
@@ -38,7 +38,7 @@ error[E0716]: temporary value dropped while borrowed
3838
LL | let x3 = &*arg(&AddFlags(1));
3939
| ^^^^^^^^^^^ - temporary value is freed at the end of this statement
4040
| |
41-
| creates a temporary which is freed while still in use
41+
| creates a temporary value which is freed while still in use
4242
...
4343
LL | (x1, x2, x3, x4, x5, x6, x7);
4444
| -- borrow later used here
@@ -55,7 +55,7 @@ error[E0716]: temporary value dropped while borrowed
5555
LL | let ref x4 = *arg(&AddFlags(1));
5656
| ^^^^^^^^^^^ - temporary value is freed at the end of this statement
5757
| |
58-
| creates a temporary which is freed while still in use
58+
| creates a temporary value which is freed while still in use
5959
...
6060
LL | (x1, x2, x3, x4, x5, x6, x7);
6161
| -- borrow later used here
@@ -72,7 +72,7 @@ error[E0716]: temporary value dropped while borrowed
7272
LL | let &ref x5 = arg(&AddFlags(1));
7373
| ^^^^^^^^^^^ - temporary value is freed at the end of this statement
7474
| |
75-
| creates a temporary which is freed while still in use
75+
| creates a temporary value which is freed while still in use
7676
...
7777
LL | (x1, x2, x3, x4, x5, x6, x7);
7878
| -- borrow later used here
@@ -89,7 +89,7 @@ error[E0716]: temporary value dropped while borrowed
8989
LL | let x6 = AddFlags(1).get();
9090
| ^^^^^^^^^^^ - temporary value is freed at the end of this statement
9191
| |
92-
| creates a temporary which is freed while still in use
92+
| creates a temporary value which is freed while still in use
9393
...
9494
LL | (x1, x2, x3, x4, x5, x6, x7);
9595
| -- borrow later used here
@@ -106,7 +106,7 @@ error[E0716]: temporary value dropped while borrowed
106106
LL | let StackBox { f: x7 } = StackBox { f: AddFlags(1).get() };
107107
| ^^^^^^^^^^^ - temporary value is freed at the end of this statement
108108
| |
109-
| creates a temporary which is freed while still in use
109+
| creates a temporary value which is freed while still in use
110110
LL |
111111
LL | (x1, x2, x3, x4, x5, x6, x7);
112112
| -- borrow later used here

src/test/ui/consts/const-eval/const-eval-intrinsic-promotion.stderr

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ error[E0716]: temporary value dropped while borrowed
44
LL | let x: &'static usize =
55
| -------------- type annotation requires that borrow lasts for `'static`
66
LL | &std::intrinsics::size_of::<i32>();
7-
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ creates a temporary which is freed while still in use
7+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ creates a temporary value which is freed while still in use
88
LL | }
99
| - temporary value is freed at the end of this statement
1010

src/test/ui/consts/const-eval/dont_promote_unstable_const_fn.stderr

+3-3
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ error[E0716]: temporary value dropped while borrowed
1010
--> $DIR/dont_promote_unstable_const_fn.rs:17:28
1111
|
1212
LL | let _: &'static u32 = &foo();
13-
| ------------ ^^^^^ creates a temporary which is freed while still in use
13+
| ------------ ^^^^^ creates a temporary value which is freed while still in use
1414
| |
1515
| type annotation requires that borrow lasts for `'static`
1616
LL | }
@@ -20,7 +20,7 @@ error[E0716]: temporary value dropped while borrowed
2020
--> $DIR/dont_promote_unstable_const_fn.rs:21:28
2121
|
2222
LL | let _: &'static u32 = &meh();
23-
| ------------ ^^^^^ creates a temporary which is freed while still in use
23+
| ------------ ^^^^^ creates a temporary value which is freed while still in use
2424
| |
2525
| type annotation requires that borrow lasts for `'static`
2626
...
@@ -31,7 +31,7 @@ error[E0716]: temporary value dropped while borrowed
3131
--> $DIR/dont_promote_unstable_const_fn.rs:22:26
3232
|
3333
LL | let x: &'static _ = &std::time::Duration::from_millis(42).subsec_millis();
34-
| ---------- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ creates a temporary which is freed while still in use
34+
| ---------- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ creates a temporary value which is freed while still in use
3535
| |
3636
| type annotation requires that borrow lasts for `'static`
3737
LL |

src/test/ui/consts/const-eval/dont_promote_unstable_const_fn_cross_crate.stderr

+2-2
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ error[E0716]: temporary value dropped while borrowed
22
--> $DIR/dont_promote_unstable_const_fn_cross_crate.rs:8:28
33
|
44
LL | let _: &'static u32 = &foo();
5-
| ------------ ^^^^^ creates a temporary which is freed while still in use
5+
| ------------ ^^^^^ creates a temporary value which is freed while still in use
66
| |
77
| type annotation requires that borrow lasts for `'static`
88
LL | let _x: &'static u32 = &foo();
@@ -13,7 +13,7 @@ error[E0716]: temporary value dropped while borrowed
1313
--> $DIR/dont_promote_unstable_const_fn_cross_crate.rs:9:29
1414
|
1515
LL | let _x: &'static u32 = &foo();
16-
| ------------ ^^^^^ creates a temporary which is freed while still in use
16+
| ------------ ^^^^^ creates a temporary value which is freed while still in use
1717
| |
1818
| type annotation requires that borrow lasts for `'static`
1919
LL | }

src/test/ui/consts/const-eval/promoted_const_fn_fail.stderr

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ error[E0716]: temporary value dropped while borrowed
22
--> $DIR/promoted_const_fn_fail.rs:17:27
33
|
44
LL | let x: &'static u8 = &(bar() + 1);
5-
| ----------- ^^^^^^^^^^^ creates a temporary which is freed while still in use
5+
| ----------- ^^^^^^^^^^^ creates a temporary value which is freed while still in use
66
| |
77
| type annotation requires that borrow lasts for `'static`
88
...

src/test/ui/consts/const-eval/promoted_const_fn_fail_deny_const_err.stderr

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ error[E0716]: temporary value dropped while borrowed
22
--> $DIR/promoted_const_fn_fail_deny_const_err.rs:18:27
33
|
44
LL | let x: &'static u8 = &(bar() + 1);
5-
| ----------- ^^^^^^^^^^^ creates a temporary which is freed while still in use
5+
| ----------- ^^^^^^^^^^^ creates a temporary value which is freed while still in use
66
| |
77
| type annotation requires that borrow lasts for `'static`
88
...

src/test/ui/consts/const-eval/promoted_raw_ptr_ops.stderr

+4-4
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ error[E0716]: temporary value dropped while borrowed
22
--> $DIR/promoted_raw_ptr_ops.rs:2:29
33
|
44
LL | let x: &'static bool = &(42 as *const i32 == 43 as *const i32);
5-
| ------------- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ creates a temporary which is freed while still in use
5+
| ------------- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ creates a temporary value which is freed while still in use
66
| |
77
| type annotation requires that borrow lasts for `'static`
88
...
@@ -13,7 +13,7 @@ error[E0716]: temporary value dropped while borrowed
1313
--> $DIR/promoted_raw_ptr_ops.rs:4:30
1414
|
1515
LL | let y: &'static usize = &(&1 as *const i32 as usize + 1);
16-
| -------------- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ creates a temporary which is freed while still in use
16+
| -------------- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ creates a temporary value which is freed while still in use
1717
| |
1818
| type annotation requires that borrow lasts for `'static`
1919
...
@@ -24,7 +24,7 @@ error[E0716]: temporary value dropped while borrowed
2424
--> $DIR/promoted_raw_ptr_ops.rs:6:28
2525
|
2626
LL | let z: &'static i32 = &(unsafe { *(42 as *const i32) });
27-
| ------------ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ creates a temporary which is freed while still in use
27+
| ------------ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ creates a temporary value which is freed while still in use
2828
| |
2929
| type annotation requires that borrow lasts for `'static`
3030
...
@@ -35,7 +35,7 @@ error[E0716]: temporary value dropped while borrowed
3535
--> $DIR/promoted_raw_ptr_ops.rs:8:29
3636
|
3737
LL | let a: &'static bool = &(main as fn() == main as fn());
38-
| ------------- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ creates a temporary which is freed while still in use
38+
| ------------- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ creates a temporary value which is freed while still in use
3939
| |
4040
| type annotation requires that borrow lasts for `'static`
4141
LL |

src/test/ui/consts/const-eval/transmute-const-promotion.stderr

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ error[E0716]: temporary value dropped while borrowed
22
--> $DIR/transmute-const-promotion.rs:4:37
33
|
44
LL | let x: &'static u32 = unsafe { &mem::transmute(3.0f32) };
5-
| ------------ ^^^^^^^^^^^^^^^^^^^^^^ creates a temporary which is freed while still in use
5+
| ------------ ^^^^^^^^^^^^^^^^^^^^^^ creates a temporary value which is freed while still in use
66
| |
77
| type annotation requires that borrow lasts for `'static`
88
LL |

src/test/ui/consts/const-eval/union_promotion.stderr

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ LL | let x: &'static bool = &unsafe {
77
| | type annotation requires that borrow lasts for `'static`
88
LL | | Foo { a: &1 }.b == Foo { a: &2 }.b
99
LL | | };
10-
| |_____^ creates a temporary which is freed while still in use
10+
| |_____^ creates a temporary value which is freed while still in use
1111
LL | }
1212
| - temporary value is freed at the end of this statement
1313

src/test/ui/consts/const-int-conversion.stderr

+7-7
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ error[E0716]: temporary value dropped while borrowed
22
--> $DIR/const-int-conversion.rs:2:28
33
|
44
LL | let x: &'static i32 = &(5_i32.reverse_bits());
5-
| ------------ ^^^^^^^^^^^^^^^^^^^^^^ creates a temporary which is freed while still in use
5+
| ------------ ^^^^^^^^^^^^^^^^^^^^^^ creates a temporary value which is freed while still in use
66
| |
77
| type annotation requires that borrow lasts for `'static`
88
...
@@ -13,7 +13,7 @@ error[E0716]: temporary value dropped while borrowed
1313
--> $DIR/const-int-conversion.rs:4:28
1414
|
1515
LL | let y: &'static i32 = &(i32::from_be_bytes([0x12, 0x34, 0x56, 0x78]));
16-
| ------------ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ creates a temporary which is freed while still in use
16+
| ------------ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ creates a temporary value which is freed while still in use
1717
| |
1818
| type annotation requires that borrow lasts for `'static`
1919
...
@@ -24,7 +24,7 @@ error[E0716]: temporary value dropped while borrowed
2424
--> $DIR/const-int-conversion.rs:6:28
2525
|
2626
LL | let z: &'static i32 = &(i32::from_le_bytes([0x12, 0x34, 0x56, 0x78]));
27-
| ------------ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ creates a temporary which is freed while still in use
27+
| ------------ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ creates a temporary value which is freed while still in use
2828
| |
2929
| type annotation requires that borrow lasts for `'static`
3030
...
@@ -35,7 +35,7 @@ error[E0716]: temporary value dropped while borrowed
3535
--> $DIR/const-int-conversion.rs:8:28
3636
|
3737
LL | let a: &'static i32 = &(i32::from_be(i32::from_ne_bytes([0x80, 0, 0, 0])));
38-
| ------------ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ creates a temporary which is freed while still in use
38+
| ------------ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ creates a temporary value which is freed while still in use
3939
| |
4040
| type annotation requires that borrow lasts for `'static`
4141
...
@@ -46,7 +46,7 @@ error[E0716]: temporary value dropped while borrowed
4646
--> $DIR/const-int-conversion.rs:10:29
4747
|
4848
LL | let b: &'static [u8] = &(0x12_34_56_78_i32.to_be_bytes());
49-
| ------------- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ creates a temporary which is freed while still in use
49+
| ------------- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ creates a temporary value which is freed while still in use
5050
| |
5151
| type annotation requires that borrow lasts for `'static`
5252
...
@@ -57,7 +57,7 @@ error[E0716]: temporary value dropped while borrowed
5757
--> $DIR/const-int-conversion.rs:12:29
5858
|
5959
LL | let c: &'static [u8] = &(0x12_34_56_78_i32.to_le_bytes());
60-
| ------------- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ creates a temporary which is freed while still in use
60+
| ------------- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ creates a temporary value which is freed while still in use
6161
| |
6262
| type annotation requires that borrow lasts for `'static`
6363
...
@@ -68,7 +68,7 @@ error[E0716]: temporary value dropped while borrowed
6868
--> $DIR/const-int-conversion.rs:14:29
6969
|
7070
LL | let d: &'static [u8] = &(i32::MIN.to_be().to_ne_bytes());
71-
| ------------- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ creates a temporary which is freed while still in use
71+
| ------------- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ creates a temporary value which is freed while still in use
7272
| |
7373
| type annotation requires that borrow lasts for `'static`
7474
LL |

0 commit comments

Comments
 (0)