From 5fc0b743d752f57d39cbd7ff10450211affe79a0 Mon Sep 17 00:00:00 2001 From: Mikhail Modin Date: Sun, 23 Sep 2018 16:30:46 +0100 Subject: [PATCH 1/3] add "temporary value dropped while borrowed" error Issue #54131 --- .../borrow_check/error_reporting.rs | 6 +- src/librustc_mir/diagnostics.rs | 85 +++++++++++++++++++ src/librustc_mir/util/borrowck_errors.rs | 16 ++++ .../borrowck-borrow-from-temporary.nll.stderr | 18 ++++ ...borrowck-borrowed-uniq-rvalue-2.nll.stderr | 8 +- .../borrowck-borrowed-uniq-rvalue.nll.stderr | 8 +- ...mote-ref-mut-in-let-issue-46557.nll.stderr | 32 +++---- .../dont_promote_unstable_const_fn.nll.stderr | 43 ++++++++++ ...e_unstable_const_fn_cross_crate.nll.stderr | 24 ++++++ .../promoted_raw_ptr_ops.nll.stderr | 35 ++++++++ .../transmute-const-promotion.nll.stderr | 14 +++ .../const-eval/union_promotion.nll.stderr | 16 ++++ .../ui/consts/const-int-conversion.nll.stderr | 80 +++++++++++++++++ .../consts/const-int-overflowing.nll.stderr | 35 ++++++++ .../ui/consts/const-int-rotate.nll.stderr | 24 ++++++ src/test/ui/consts/const-int-sign.nll.stderr | 24 ++++++ .../ui/consts/const-int-wrapping.nll.stderr | 57 +++++++++++++ .../min_const_fn/min_const_fn.nll.stderr | 8 +- .../min_const_fn/min_const_fn_dyn.nll.stderr | 8 +- src/test/ui/issues/issue-11681.nll.stderr | 18 ++++ src/test/ui/issues/issue-17545.nll.stderr | 8 +- ...ssue-17718-constants-not-static.nll.stderr | 13 +++ src/test/ui/issues/issue-27592.nll.stderr | 14 +-- src/test/ui/issues/issue-30438-a.nll.stderr | 8 +- src/test/ui/issues/issue-30438-b.nll.stderr | 21 +++++ src/test/ui/issues/issue-36082.ast.nll.stderr | 8 +- src/test/ui/issues/issue-36082.mir.stderr | 8 +- src/test/ui/issues/issue-36082.rs | 6 +- src/test/ui/issues/issue-44373.nll.stderr | 13 +++ src/test/ui/issues/issue-46472.rs | 2 +- src/test/ui/issues/issue-46472.stderr | 9 +- src/test/ui/issues/issue-47184.rs | 2 +- src/test/ui/issues/issue-47184.stderr | 8 +- src/test/ui/issues/issue-52049.nll.stderr | 8 +- .../borrowck-let-suggestion.nll.stderr | 8 +- src/test/ui/nll/borrowed-temporary-error.rs | 2 +- .../ui/nll/borrowed-temporary-error.stderr | 10 +-- src/test/ui/nll/borrowed-universal-error.rs | 2 +- .../ui/nll/borrowed-universal-error.stderr | 10 +-- src/test/ui/nll/issue-52534-1.stderr | 9 +- src/test/ui/nll/return-ref-mut-issue-46557.rs | 2 +- .../ui/nll/return-ref-mut-issue-46557.stderr | 10 +-- src/test/ui/nll/user-annotations/patterns.rs | 6 +- .../ui/nll/user-annotations/patterns.stderr | 21 ++--- .../regions/regions-creating-enums.nll.stderr | 14 +-- ...ns-free-region-ordering-caller1.nll.stderr | 8 +- ...etime-of-struct-or-enum-variant.nll.stderr | 33 +++++++ .../regions/regions-ref-in-fn-arg.nll.stderr | 14 +-- src/test/ui/regions/regions-ret.nll.stderr | 8 +- ...ions-return-stack-allocated-vec.nll.stderr | 13 +++ .../regions-var-type-out-of-scope.nll.stderr | 8 +- ...orrowck-let-suggestion-suffixes.nll.stderr | 20 ++--- src/test/ui/span/issue-15480.nll.stderr | 8 +- ...-close-over-borrowed-ref-in-obj.nll.stderr | 8 +- src/test/ui/span/slice-borrow.nll.stderr | 8 +- .../ui/static/static-drop-scope.nll.stderr | 60 +++++++++++++ .../static-reference-to-fn-2.nll.stderr | 26 +++--- .../ui/static/static-region-bound.nll.stderr | 14 +++ .../wf/wf-misc-methods-issue-28609.nll.stderr | 27 +++--- 59 files changed, 848 insertions(+), 188 deletions(-) create mode 100644 src/test/ui/borrowck/borrowck-borrow-from-temporary.nll.stderr create mode 100644 src/test/ui/consts/const-eval/dont_promote_unstable_const_fn.nll.stderr create mode 100644 src/test/ui/consts/const-eval/dont_promote_unstable_const_fn_cross_crate.nll.stderr create mode 100644 src/test/ui/consts/const-eval/promoted_raw_ptr_ops.nll.stderr create mode 100644 src/test/ui/consts/const-eval/transmute-const-promotion.nll.stderr create mode 100644 src/test/ui/consts/const-eval/union_promotion.nll.stderr create mode 100644 src/test/ui/consts/const-int-conversion.nll.stderr create mode 100644 src/test/ui/consts/const-int-overflowing.nll.stderr create mode 100644 src/test/ui/consts/const-int-rotate.nll.stderr create mode 100644 src/test/ui/consts/const-int-sign.nll.stderr create mode 100644 src/test/ui/consts/const-int-wrapping.nll.stderr create mode 100644 src/test/ui/issues/issue-11681.nll.stderr create mode 100644 src/test/ui/issues/issue-17718-constants-not-static.nll.stderr create mode 100644 src/test/ui/issues/issue-30438-b.nll.stderr create mode 100644 src/test/ui/issues/issue-44373.nll.stderr create mode 100644 src/test/ui/regions/regions-lifetime-of-struct-or-enum-variant.nll.stderr create mode 100644 src/test/ui/regions/regions-return-stack-allocated-vec.nll.stderr create mode 100644 src/test/ui/static/static-drop-scope.nll.stderr create mode 100644 src/test/ui/static/static-region-bound.nll.stderr diff --git a/src/librustc_mir/borrow_check/error_reporting.rs b/src/librustc_mir/borrow_check/error_reporting.rs index b775fc81d4f61..f29870623a9ee 100644 --- a/src/librustc_mir/borrow_check/error_reporting.rs +++ b/src/librustc_mir/borrow_check/error_reporting.rs @@ -694,9 +694,9 @@ impl<'cx, 'gcx, 'tcx> MirBorrowckCtxt<'cx, 'gcx, 'tcx> { let tcx = self.infcx.tcx; let mut err = - tcx.path_does_not_live_long_enough(proper_span, "borrowed value", Origin::Mir); - err.span_label(proper_span, "temporary value does not live long enough"); - err.span_label(drop_span, "temporary value only lives until here"); + tcx.temporary_value_borrowed_for_too_long(proper_span, Origin::Mir); + err.span_label(proper_span, "creates a temporary which is freed while still in use"); + err.span_label(drop_span, "temporary value is freed at the end of this statement"); let explanation = self.explain_why_borrow_contains_point(context, borrow, None); match explanation { diff --git a/src/librustc_mir/diagnostics.rs b/src/librustc_mir/diagnostics.rs index 0c31e5c4da8ac..aac5fc5ed7e91 100644 --- a/src/librustc_mir/diagnostics.rs +++ b/src/librustc_mir/diagnostics.rs @@ -2261,7 +2261,92 @@ that after `demo` finishes excuting, something else (such as the destructor!) could access `s.data` after the end of that shorter lifetime, which would again violate the `&mut`-borrow's exclusive access. +"##, + +E0714: r##" +This error indicates that a temporary value is being dropped +while a borrow is still in active use. + +Erroneous code example: + +```compile_fail,E0714 +# #![feature(nll)] +fn foo() -> i32 { 22 } +fn bar(x: &i32) -> &i32 { x } +let p = bar(&foo()); + // ------ creates a temporary +let q = *p; +``` + +Here, the expression `&foo()` is borrowing the expression +`foo()`. As `foo()` is call to a function, and not the name of +a variable, this creates a **temporary** -- that temporary stores +the return value from `foo()` so that it can be borrowed. +So you might imagine that `let p = bar(&foo())` is equivalent +to this: + +```compile_fail,E0597 +# fn foo() -> i32 { 22 } +# fn bar(x: &i32) -> &i32 { x } +let p = { + let tmp = foo(); // the temporary + bar(&tmp) +}; // <-- tmp is freed as we exit this block +let q = p; +``` + +Whenever a temporary is created, it is automatically dropped (freed) +according to fixed rules. Ordinarily, the temporary is dropped +at the end of the enclosing statement -- in this case, after the `let`. +This is illustrated in the example above by showing that `tmp` would +be freed as we exit the block. + +To fix this problem, you need to create a local variable +to store the value in rather than relying on a temporary. +For example, you might change the original program to +the following: +``` +fn foo() -> i32 { 22 } +fn bar(x: &i32) -> &i32 { x } +let value = foo(); // dropped at the end of the enclosing block +let p = bar(&value); +let q = *p; +``` + +By introducing the explicit `let value`, we allocate storage +that will last until the end of the enclosing block (when `value` +goes out of scope). When we borrow `&value`, we are borrowing a +local variable that already exists, and hence no temporary is created. + +Temporaries are not always dropped at the end of the enclosing +statement. In simple cases where the `&` expression is immediately +stored into a variable, the compiler will automatically extend +the lifetime of the temporary until the end of the enclosinb +block. Therefore, an alternative way to fix the original +program is to write `let tmp = &foo()` and not `let tmp = foo()`: + +``` +fn foo() -> i32 { 22 } +fn bar(x: &i32) -> &i32 { x } +let value = &foo(); +let p = bar(value); +let q = *p; +``` + +Here, we are still borrowing `foo()`, but as the borrow is assigned +directly into a variable, the temporary will not be dropped until +the end of the enclosing block. Similar rules apply when temporaries +are stored into aggregate structures like a tuple or struct: + +``` +// Here, two temporaries are created, but +// as they are stored directly into `value`, +// they are not dropped until the end of the +// enclosing block. +fn foo() -> i32 { 22 } +let value = (&foo(), &foo()); +``` "##, } diff --git a/src/librustc_mir/util/borrowck_errors.rs b/src/librustc_mir/util/borrowck_errors.rs index 6d5d3ba88f2f6..c78020a260979 100644 --- a/src/librustc_mir/util/borrowck_errors.rs +++ b/src/librustc_mir/util/borrowck_errors.rs @@ -730,6 +730,22 @@ pub trait BorrowckErrors<'cx>: Sized + Copy { self.cancel_if_wrong_origin(err, o) } + + fn temporary_value_borrowed_for_too_long( + self, + span: Span, + o: Origin, + ) -> DiagnosticBuilder<'cx> { + let err = struct_span_err!( + self, + span, + E0714, + "temporary value dropped while borrowed{OGN}", + OGN = o + ); + + self.cancel_if_wrong_origin(err, o) + } } impl<'cx, 'gcx, 'tcx> BorrowckErrors<'cx> for TyCtxt<'cx, 'gcx, 'tcx> { diff --git a/src/test/ui/borrowck/borrowck-borrow-from-temporary.nll.stderr b/src/test/ui/borrowck/borrowck-borrow-from-temporary.nll.stderr new file mode 100644 index 0000000000000..894eb4cc4a2ee --- /dev/null +++ b/src/test/ui/borrowck/borrowck-borrow-from-temporary.nll.stderr @@ -0,0 +1,18 @@ +error[E0714]: temporary value dropped while borrowed + --> $DIR/borrowck-borrow-from-temporary.rs:19:24 + | +LL | let &Foo(ref x) = &id(Foo(3)); //~ ERROR borrowed value does not live long enough + | ^^^^^^^^^^ creates a temporary which is freed while still in use +LL | x +LL | } + | - temporary value is freed at the end of this statement + | +note: borrowed value must be valid for the lifetime 'a as defined on the function body at 18:8... + --> $DIR/borrowck-borrow-from-temporary.rs:18:8 + | +LL | fn foo<'a>() -> &'a isize { + | ^^ + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0714`. diff --git a/src/test/ui/borrowck/borrowck-borrowed-uniq-rvalue-2.nll.stderr b/src/test/ui/borrowck/borrowck-borrowed-uniq-rvalue-2.nll.stderr index eee3f9bd5c130..1b5a1f4b29bf0 100644 --- a/src/test/ui/borrowck/borrowck-borrowed-uniq-rvalue-2.nll.stderr +++ b/src/test/ui/borrowck/borrowck-borrowed-uniq-rvalue-2.nll.stderr @@ -1,10 +1,10 @@ -error[E0597]: borrowed value does not live long enough +error[E0714]: temporary value dropped while borrowed --> $DIR/borrowck-borrowed-uniq-rvalue-2.rs:32:20 | LL | let x = defer(&vec!["Goodbye", "world!"]); - | ^^^^^^^^^^^^^^^^^^^^^^^^^ - temporary value only lives until here + | ^^^^^^^^^^^^^^^^^^^^^^^^^ - temporary value is freed at the end of this statement | | - | temporary value does not live long enough + | creates a temporary which is freed while still in use LL | x.x[0]; | ------ borrow later used here | @@ -13,4 +13,4 @@ LL | x.x[0]; error: aborting due to previous error -For more information about this error, try `rustc --explain E0597`. +For more information about this error, try `rustc --explain E0714`. diff --git a/src/test/ui/borrowck/borrowck-borrowed-uniq-rvalue.nll.stderr b/src/test/ui/borrowck/borrowck-borrowed-uniq-rvalue.nll.stderr index ebf229696d8a9..9236e9e228833 100644 --- a/src/test/ui/borrowck/borrowck-borrowed-uniq-rvalue.nll.stderr +++ b/src/test/ui/borrowck/borrowck-borrowed-uniq-rvalue.nll.stderr @@ -1,10 +1,10 @@ -error[E0597]: borrowed value does not live long enough +error[E0714]: temporary value dropped while borrowed --> $DIR/borrowck-borrowed-uniq-rvalue.rs:20:28 | LL | buggy_map.insert(42, &*Box::new(1)); //~ ERROR borrowed value does not live long enough - | ^^^^^^^^^^^ - temporary value only lives until here + | ^^^^^^^^^^^ - temporary value is freed at the end of this statement | | - | temporary value does not live long enough + | creates a temporary which is freed while still in use ... LL | buggy_map.insert(43, &*tmp); | --------- borrow later used here @@ -13,4 +13,4 @@ LL | buggy_map.insert(43, &*tmp); error: aborting due to previous error -For more information about this error, try `rustc --explain E0597`. +For more information about this error, try `rustc --explain E0714`. diff --git a/src/test/ui/borrowck/promote-ref-mut-in-let-issue-46557.nll.stderr b/src/test/ui/borrowck/promote-ref-mut-in-let-issue-46557.nll.stderr index 52f1547bce6f8..a4fc91f208df4 100644 --- a/src/test/ui/borrowck/promote-ref-mut-in-let-issue-46557.nll.stderr +++ b/src/test/ui/borrowck/promote-ref-mut-in-let-issue-46557.nll.stderr @@ -1,57 +1,57 @@ -error[E0597]: borrowed value does not live long enough +error[E0714]: temporary value dropped while borrowed --> $DIR/promote-ref-mut-in-let-issue-46557.rs:15:21 | LL | let ref mut x = 1234543; //~ ERROR - | ^^^^^^^ temporary value does not live long enough + | ^^^^^^^ creates a temporary which is freed while still in use LL | x LL | } - | - temporary value only lives until here + | - temporary value is freed at the end of this statement | = note: borrowed value must be valid for the static lifetime... -error[E0597]: borrowed value does not live long enough +error[E0714]: temporary value dropped while borrowed --> $DIR/promote-ref-mut-in-let-issue-46557.rs:20:25 | LL | let (ref mut x, ) = (1234543, ); //~ ERROR - | ^^^^^^^^^^^ temporary value does not live long enough + | ^^^^^^^^^^^ creates a temporary which is freed while still in use LL | x LL | } - | - temporary value only lives until here + | - temporary value is freed at the end of this statement | = note: borrowed value must be valid for the static lifetime... -error[E0597]: borrowed value does not live long enough +error[E0714]: temporary value dropped while borrowed --> $DIR/promote-ref-mut-in-let-issue-46557.rs:25:11 | LL | match 1234543 { - | ^^^^^^^ temporary value does not live long enough + | ^^^^^^^ creates a temporary which is freed while still in use ... LL | } - | - temporary value only lives until here + | - temporary value is freed at the end of this statement | = note: borrowed value must be valid for the static lifetime... -error[E0597]: borrowed value does not live long enough +error[E0714]: temporary value dropped while borrowed --> $DIR/promote-ref-mut-in-let-issue-46557.rs:31:11 | LL | match (123443,) { - | ^^^^^^^^^ temporary value does not live long enough + | ^^^^^^^^^ creates a temporary which is freed while still in use ... LL | } - | - temporary value only lives until here + | - temporary value is freed at the end of this statement | = note: borrowed value must be valid for the static lifetime... -error[E0597]: borrowed value does not live long enough +error[E0714]: temporary value dropped while borrowed --> $DIR/promote-ref-mut-in-let-issue-46557.rs:37:10 | LL | &mut 1234543 //~ ERROR - | ^^^^^^^ temporary value does not live long enough + | ^^^^^^^ creates a temporary which is freed while still in use LL | } - | - temporary value only lives until here + | - temporary value is freed at the end of this statement | = note: borrowed value must be valid for the static lifetime... error: aborting due to 5 previous errors -For more information about this error, try `rustc --explain E0597`. +For more information about this error, try `rustc --explain E0714`. diff --git a/src/test/ui/consts/const-eval/dont_promote_unstable_const_fn.nll.stderr b/src/test/ui/consts/const-eval/dont_promote_unstable_const_fn.nll.stderr new file mode 100644 index 0000000000000..e257fdb31e767 --- /dev/null +++ b/src/test/ui/consts/const-eval/dont_promote_unstable_const_fn.nll.stderr @@ -0,0 +1,43 @@ +error: `foo` is not yet stable as a const fn + --> $DIR/dont_promote_unstable_const_fn.rs:25:25 + | +LL | const fn bar() -> u32 { foo() } //~ ERROR `foo` is not yet stable as a const fn + | ^^^^^ + | + = help: in Nightly builds, add `#![feature(foo)]` to the crate attributes to enable + +error[E0714]: temporary value dropped while borrowed + --> $DIR/dont_promote_unstable_const_fn.rs:28:28 + | +LL | let _: &'static u32 = &foo(); //~ ERROR does not live long enough + | ^^^^^ creates a temporary which is freed while still in use +LL | } + | - temporary value is freed at the end of this statement + | + = note: borrowed value must be valid for the static lifetime... + +error[E0714]: temporary value dropped while borrowed + --> $DIR/dont_promote_unstable_const_fn.rs:32:28 + | +LL | let _: &'static u32 = &meh(); //~ ERROR does not live long enough + | ^^^^^ creates a temporary which is freed while still in use +... +LL | } + | - temporary value is freed at the end of this statement + | + = note: borrowed value must be valid for the static lifetime... + +error[E0714]: temporary value dropped while borrowed + --> $DIR/dont_promote_unstable_const_fn.rs:33:26 + | +LL | let x: &'static _ = &std::time::Duration::from_millis(42).subsec_millis(); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ creates a temporary which is freed while still in use +LL | //~^ does not live long enough +LL | } + | - temporary value is freed at the end of this statement + | + = note: borrowed value must be valid for the static lifetime... + +error: aborting due to 4 previous errors + +For more information about this error, try `rustc --explain E0714`. diff --git a/src/test/ui/consts/const-eval/dont_promote_unstable_const_fn_cross_crate.nll.stderr b/src/test/ui/consts/const-eval/dont_promote_unstable_const_fn_cross_crate.nll.stderr new file mode 100644 index 0000000000000..6ec0733640961 --- /dev/null +++ b/src/test/ui/consts/const-eval/dont_promote_unstable_const_fn_cross_crate.nll.stderr @@ -0,0 +1,24 @@ +error[E0714]: temporary value dropped while borrowed + --> $DIR/dont_promote_unstable_const_fn_cross_crate.rs:18:28 + | +LL | let _: &'static u32 = &foo(); //~ ERROR does not live long enough + | ^^^^^ creates a temporary which is freed while still in use +LL | let _x: &'static u32 = &foo(); //~ ERROR does not live long enough +LL | } + | - temporary value is freed at the end of this statement + | + = note: borrowed value must be valid for the static lifetime... + +error[E0714]: temporary value dropped while borrowed + --> $DIR/dont_promote_unstable_const_fn_cross_crate.rs:19:29 + | +LL | let _x: &'static u32 = &foo(); //~ ERROR does not live long enough + | ^^^^^ creates a temporary which is freed while still in use +LL | } + | - temporary value is freed at the end of this statement + | + = note: borrowed value must be valid for the static lifetime... + +error: aborting due to 2 previous errors + +For more information about this error, try `rustc --explain E0714`. diff --git a/src/test/ui/consts/const-eval/promoted_raw_ptr_ops.nll.stderr b/src/test/ui/consts/const-eval/promoted_raw_ptr_ops.nll.stderr new file mode 100644 index 0000000000000..acc6104d9e21c --- /dev/null +++ b/src/test/ui/consts/const-eval/promoted_raw_ptr_ops.nll.stderr @@ -0,0 +1,35 @@ +error[E0714]: temporary value dropped while borrowed + --> $DIR/promoted_raw_ptr_ops.rs:14:29 + | +LL | let x: &'static bool = &(42 as *const i32 == 43 as *const i32); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ creates a temporary which is freed while still in use +... +LL | } + | - temporary value is freed at the end of this statement + | + = note: borrowed value must be valid for the static lifetime... + +error[E0714]: temporary value dropped while borrowed + --> $DIR/promoted_raw_ptr_ops.rs:16:30 + | +LL | let y: &'static usize = &(&1 as *const i32 as usize + 1); //~ ERROR does not live long enough + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ creates a temporary which is freed while still in use +LL | let z: &'static i32 = &(unsafe { *(42 as *const i32) }); //~ ERROR does not live long enough +LL | } + | - temporary value is freed at the end of this statement + | + = note: borrowed value must be valid for the static lifetime... + +error[E0714]: temporary value dropped while borrowed + --> $DIR/promoted_raw_ptr_ops.rs:17:28 + | +LL | let z: &'static i32 = &(unsafe { *(42 as *const i32) }); //~ ERROR does not live long enough + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ creates a temporary which is freed while still in use +LL | } + | - temporary value is freed at the end of this statement + | + = note: borrowed value must be valid for the static lifetime... + +error: aborting due to 3 previous errors + +For more information about this error, try `rustc --explain E0714`. diff --git a/src/test/ui/consts/const-eval/transmute-const-promotion.nll.stderr b/src/test/ui/consts/const-eval/transmute-const-promotion.nll.stderr new file mode 100644 index 0000000000000..e11f589b1052d --- /dev/null +++ b/src/test/ui/consts/const-eval/transmute-const-promotion.nll.stderr @@ -0,0 +1,14 @@ +error[E0714]: temporary value dropped while borrowed + --> $DIR/transmute-const-promotion.rs:16:37 + | +LL | let x: &'static u32 = unsafe { &mem::transmute(3.0f32) }; + | ^^^^^^^^^^^^^^^^^^^^^^ creates a temporary which is freed while still in use +LL | //~^ ERROR value does not live long enough +LL | } + | - temporary value is freed at the end of this statement + | + = note: borrowed value must be valid for the static lifetime... + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0714`. diff --git a/src/test/ui/consts/const-eval/union_promotion.nll.stderr b/src/test/ui/consts/const-eval/union_promotion.nll.stderr new file mode 100644 index 0000000000000..9437cacd7734c --- /dev/null +++ b/src/test/ui/consts/const-eval/union_promotion.nll.stderr @@ -0,0 +1,16 @@ +error[E0714]: temporary value dropped while borrowed + --> $DIR/union_promotion.rs:19:29 + | +LL | let x: &'static bool = &unsafe { //~ borrowed value does not live long enough + | _____________________________^ +LL | | Foo { a: &1 }.b == Foo { a: &2 }.b +LL | | }; + | |_____^ creates a temporary which is freed while still in use +LL | } + | - temporary value is freed at the end of this statement + | + = note: borrowed value must be valid for the static lifetime... + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0714`. diff --git a/src/test/ui/consts/const-int-conversion.nll.stderr b/src/test/ui/consts/const-int-conversion.nll.stderr new file mode 100644 index 0000000000000..922905477f380 --- /dev/null +++ b/src/test/ui/consts/const-int-conversion.nll.stderr @@ -0,0 +1,80 @@ +error[E0714]: temporary value dropped while borrowed + --> $DIR/const-int-conversion.rs:14:28 + | +LL | let x: &'static i32 = &(5_i32.reverse_bits()); + | ^^^^^^^^^^^^^^^^^^^^^^ creates a temporary which is freed while still in use +... +LL | } + | - temporary value is freed at the end of this statement + | + = note: borrowed value must be valid for the static lifetime... + +error[E0714]: temporary value dropped while borrowed + --> $DIR/const-int-conversion.rs:16:28 + | +LL | let y: &'static i32 = &(i32::from_be_bytes([0x12, 0x34, 0x56, 0x78])); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ creates a temporary which is freed while still in use +... +LL | } + | - temporary value is freed at the end of this statement + | + = note: borrowed value must be valid for the static lifetime... + +error[E0714]: temporary value dropped while borrowed + --> $DIR/const-int-conversion.rs:18:28 + | +LL | let z: &'static i32 = &(i32::from_le_bytes([0x12, 0x34, 0x56, 0x78])); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ creates a temporary which is freed while still in use +... +LL | } + | - temporary value is freed at the end of this statement + | + = note: borrowed value must be valid for the static lifetime... + +error[E0714]: temporary value dropped while borrowed + --> $DIR/const-int-conversion.rs:20:28 + | +LL | let a: &'static i32 = &(i32::from_be(i32::from_ne_bytes([0x80, 0, 0, 0]))); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ creates a temporary which is freed while still in use +... +LL | } + | - temporary value is freed at the end of this statement + | + = note: borrowed value must be valid for the static lifetime... + +error[E0714]: temporary value dropped while borrowed + --> $DIR/const-int-conversion.rs:22:29 + | +LL | let b: &'static [u8] = &(0x12_34_56_78_i32.to_be_bytes()); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ creates a temporary which is freed while still in use +... +LL | } + | - temporary value is freed at the end of this statement + | + = note: borrowed value must be valid for the static lifetime... + +error[E0714]: temporary value dropped while borrowed + --> $DIR/const-int-conversion.rs:24:29 + | +LL | let c: &'static [u8] = &(0x12_34_56_78_i32.to_le_bytes()); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ creates a temporary which is freed while still in use +... +LL | } + | - temporary value is freed at the end of this statement + | + = note: borrowed value must be valid for the static lifetime... + +error[E0714]: temporary value dropped while borrowed + --> $DIR/const-int-conversion.rs:26:29 + | +LL | let d: &'static [u8] = &(i32::min_value().to_be().to_ne_bytes()); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ creates a temporary which is freed while still in use +LL | //~^ ERROR does not live long enough +LL | } + | - temporary value is freed at the end of this statement + | + = note: borrowed value must be valid for the static lifetime... + +error: aborting due to 7 previous errors + +For more information about this error, try `rustc --explain E0714`. diff --git a/src/test/ui/consts/const-int-overflowing.nll.stderr b/src/test/ui/consts/const-int-overflowing.nll.stderr new file mode 100644 index 0000000000000..fd420658c7ad4 --- /dev/null +++ b/src/test/ui/consts/const-int-overflowing.nll.stderr @@ -0,0 +1,35 @@ +error[E0714]: temporary value dropped while borrowed + --> $DIR/const-int-overflowing.rs:12:36 + | +LL | let x: &'static (i32, bool) = &(5_i32.overflowing_add(3)); //~ ERROR does not live long enough + | ^^^^^^^^^^^^^^^^^^^^^^^^^^ creates a temporary which is freed while still in use +... +LL | } + | - temporary value is freed at the end of this statement + | + = note: borrowed value must be valid for the static lifetime... + +error[E0714]: temporary value dropped while borrowed + --> $DIR/const-int-overflowing.rs:13:36 + | +LL | let y: &'static (i32, bool) = &(5_i32.overflowing_sub(3)); //~ ERROR does not live long enough + | ^^^^^^^^^^^^^^^^^^^^^^^^^^ creates a temporary which is freed while still in use +LL | let z: &'static (i32, bool) = &(5_i32.overflowing_mul(3)); //~ ERROR does not live long enough +LL | } + | - temporary value is freed at the end of this statement + | + = note: borrowed value must be valid for the static lifetime... + +error[E0714]: temporary value dropped while borrowed + --> $DIR/const-int-overflowing.rs:14:36 + | +LL | let z: &'static (i32, bool) = &(5_i32.overflowing_mul(3)); //~ ERROR does not live long enough + | ^^^^^^^^^^^^^^^^^^^^^^^^^^ creates a temporary which is freed while still in use +LL | } + | - temporary value is freed at the end of this statement + | + = note: borrowed value must be valid for the static lifetime... + +error: aborting due to 3 previous errors + +For more information about this error, try `rustc --explain E0714`. diff --git a/src/test/ui/consts/const-int-rotate.nll.stderr b/src/test/ui/consts/const-int-rotate.nll.stderr new file mode 100644 index 0000000000000..d66017a289bca --- /dev/null +++ b/src/test/ui/consts/const-int-rotate.nll.stderr @@ -0,0 +1,24 @@ +error[E0714]: temporary value dropped while borrowed + --> $DIR/const-int-rotate.rs:12:28 + | +LL | let x: &'static i32 = &(5_i32.rotate_left(3)); //~ ERROR does not live long enough + | ^^^^^^^^^^^^^^^^^^^^^^ creates a temporary which is freed while still in use +LL | let y: &'static i32 = &(5_i32.rotate_right(3)); //~ ERROR does not live long enough +LL | } + | - temporary value is freed at the end of this statement + | + = note: borrowed value must be valid for the static lifetime... + +error[E0714]: temporary value dropped while borrowed + --> $DIR/const-int-rotate.rs:13:28 + | +LL | let y: &'static i32 = &(5_i32.rotate_right(3)); //~ ERROR does not live long enough + | ^^^^^^^^^^^^^^^^^^^^^^^ creates a temporary which is freed while still in use +LL | } + | - temporary value is freed at the end of this statement + | + = note: borrowed value must be valid for the static lifetime... + +error: aborting due to 2 previous errors + +For more information about this error, try `rustc --explain E0714`. diff --git a/src/test/ui/consts/const-int-sign.nll.stderr b/src/test/ui/consts/const-int-sign.nll.stderr new file mode 100644 index 0000000000000..62a2b111ed9c3 --- /dev/null +++ b/src/test/ui/consts/const-int-sign.nll.stderr @@ -0,0 +1,24 @@ +error[E0714]: temporary value dropped while borrowed + --> $DIR/const-int-sign.rs:12:29 + | +LL | let x: &'static bool = &(5_i32.is_negative()); //~ ERROR does not live long enough + | ^^^^^^^^^^^^^^^^^^^^^ creates a temporary which is freed while still in use +LL | let y: &'static bool = &(5_i32.is_positive()); //~ ERROR does not live long enough +LL | } + | - temporary value is freed at the end of this statement + | + = note: borrowed value must be valid for the static lifetime... + +error[E0714]: temporary value dropped while borrowed + --> $DIR/const-int-sign.rs:13:29 + | +LL | let y: &'static bool = &(5_i32.is_positive()); //~ ERROR does not live long enough + | ^^^^^^^^^^^^^^^^^^^^^ creates a temporary which is freed while still in use +LL | } + | - temporary value is freed at the end of this statement + | + = note: borrowed value must be valid for the static lifetime... + +error: aborting due to 2 previous errors + +For more information about this error, try `rustc --explain E0714`. diff --git a/src/test/ui/consts/const-int-wrapping.nll.stderr b/src/test/ui/consts/const-int-wrapping.nll.stderr new file mode 100644 index 0000000000000..4c6c98188dccb --- /dev/null +++ b/src/test/ui/consts/const-int-wrapping.nll.stderr @@ -0,0 +1,57 @@ +error[E0714]: temporary value dropped while borrowed + --> $DIR/const-int-wrapping.rs:12:28 + | +LL | let x: &'static i32 = &(5_i32.wrapping_add(3)); //~ ERROR does not live long enough + | ^^^^^^^^^^^^^^^^^^^^^^^ creates a temporary which is freed while still in use +... +LL | } + | - temporary value is freed at the end of this statement + | + = note: borrowed value must be valid for the static lifetime... + +error[E0714]: temporary value dropped while borrowed + --> $DIR/const-int-wrapping.rs:13:28 + | +LL | let y: &'static i32 = &(5_i32.wrapping_sub(3)); //~ ERROR does not live long enough + | ^^^^^^^^^^^^^^^^^^^^^^^ creates a temporary which is freed while still in use +... +LL | } + | - temporary value is freed at the end of this statement + | + = note: borrowed value must be valid for the static lifetime... + +error[E0714]: temporary value dropped while borrowed + --> $DIR/const-int-wrapping.rs:14:28 + | +LL | let z: &'static i32 = &(5_i32.wrapping_mul(3)); //~ ERROR does not live long enough + | ^^^^^^^^^^^^^^^^^^^^^^^ creates a temporary which is freed while still in use +... +LL | } + | - temporary value is freed at the end of this statement + | + = note: borrowed value must be valid for the static lifetime... + +error[E0714]: temporary value dropped while borrowed + --> $DIR/const-int-wrapping.rs:15:28 + | +LL | let a: &'static i32 = &(5_i32.wrapping_shl(3)); //~ ERROR does not live long enough + | ^^^^^^^^^^^^^^^^^^^^^^^ creates a temporary which is freed while still in use +LL | let b: &'static i32 = &(5_i32.wrapping_shr(3)); //~ ERROR does not live long enough +LL | } + | - temporary value is freed at the end of this statement + | + = note: borrowed value must be valid for the static lifetime... + +error[E0714]: temporary value dropped while borrowed + --> $DIR/const-int-wrapping.rs:16:28 + | +LL | let b: &'static i32 = &(5_i32.wrapping_shr(3)); //~ ERROR does not live long enough + | ^^^^^^^^^^^^^^^^^^^^^^^ creates a temporary which is freed while still in use +LL | } + | - temporary value is freed at the end of this statement + | + = note: borrowed value must be valid for the static lifetime... + +error: aborting due to 5 previous errors + +For more information about this error, try `rustc --explain E0714`. diff --git a/src/test/ui/consts/min_const_fn/min_const_fn.nll.stderr b/src/test/ui/consts/min_const_fn/min_const_fn.nll.stderr index 5803b5e355a2c..d79fd6571192e 100644 --- a/src/test/ui/consts/min_const_fn/min_const_fn.nll.stderr +++ b/src/test/ui/consts/min_const_fn/min_const_fn.nll.stderr @@ -190,13 +190,13 @@ error: trait bounds other than `Sized` on const fn parameters are unstable LL | const fn no_dyn_trait_ret() -> &'static dyn std::fmt::Debug { &() } | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -error[E0597]: borrowed value does not live long enough +error[E0714]: temporary value dropped while borrowed --> $DIR/min_const_fn.rs:144:64 | LL | const fn no_dyn_trait_ret() -> &'static dyn std::fmt::Debug { &() } - | ^^ - temporary value only lives until here + | ^^ - temporary value is freed at the end of this statement | | - | temporary value does not live long enough + | creates a temporary which is freed while still in use | = note: borrowed value must be valid for the static lifetime... @@ -220,5 +220,5 @@ LL | const fn no_fn_ptrs2() -> fn() { fn foo() {} foo } error: aborting due to 36 previous errors -Some errors occurred: E0493, E0597. +Some errors occurred: E0493, E0714. For more information about an error, try `rustc --explain E0493`. diff --git a/src/test/ui/consts/min_const_fn/min_const_fn_dyn.nll.stderr b/src/test/ui/consts/min_const_fn/min_const_fn_dyn.nll.stderr index cfcc7990fb30d..8d8fe7cfbebf6 100644 --- a/src/test/ui/consts/min_const_fn/min_const_fn_dyn.nll.stderr +++ b/src/test/ui/consts/min_const_fn/min_const_fn_dyn.nll.stderr @@ -10,16 +10,16 @@ error: trait bounds other than `Sized` on const fn parameters are unstable LL | const fn no_inner_dyn_trait_ret() -> Hide { Hide(HasDyn { field: &0 }) } | ^^ -error[E0597]: borrowed value does not live long enough +error[E0714]: temporary value dropped while borrowed --> $DIR/min_const_fn_dyn.rs:24:67 | LL | const fn no_inner_dyn_trait_ret() -> Hide { Hide(HasDyn { field: &0 }) } - | ^ - temporary value only lives until here + | ^ - temporary value is freed at the end of this statement | | - | temporary value does not live long enough + | creates a temporary which is freed while still in use | = note: borrowed value must be valid for the static lifetime... error: aborting due to 3 previous errors -For more information about this error, try `rustc --explain E0597`. +For more information about this error, try `rustc --explain E0714`. diff --git a/src/test/ui/issues/issue-11681.nll.stderr b/src/test/ui/issues/issue-11681.nll.stderr new file mode 100644 index 0000000000000..8ded4f6e76879 --- /dev/null +++ b/src/test/ui/issues/issue-11681.nll.stderr @@ -0,0 +1,18 @@ +error[E0714]: temporary value dropped while borrowed + --> $DIR/issue-11681.rs:22:20 + | +LL | let testValue = &Test; //~ ERROR borrowed value does not live long enough + | ^^^^ creates a temporary which is freed while still in use +LL | return testValue; +LL | } + | - temporary value is freed at the end of this statement + | +note: borrowed value must be valid for the lifetime 'a as defined on the function body at 21:15... + --> $DIR/issue-11681.rs:21:15 + | +LL | fn createTest<'a>() -> &'a Test { + | ^^ + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0714`. diff --git a/src/test/ui/issues/issue-17545.nll.stderr b/src/test/ui/issues/issue-17545.nll.stderr index 50a4b3f7f3e82..3f9fa694c349e 100644 --- a/src/test/ui/issues/issue-17545.nll.stderr +++ b/src/test/ui/issues/issue-17545.nll.stderr @@ -1,10 +1,10 @@ -error[E0597]: borrowed value does not live long enough +error[E0714]: temporary value dropped while borrowed --> $DIR/issue-17545.rs:17:10 | LL | &id(()), //~ ERROR borrowed value does not live long enough - | ^^^^^^ temporary value does not live long enough + | ^^^^^^ creates a temporary which is freed while still in use LL | )); - | - temporary value only lives until here + | - temporary value is freed at the end of this statement | note: borrowed value must be valid for the lifetime 'a as defined on the function body at 15:12... --> $DIR/issue-17545.rs:15:12 @@ -14,4 +14,4 @@ LL | pub fn foo<'a, F: Fn(&'a ())>(bar: F) { error: aborting due to previous error -For more information about this error, try `rustc --explain E0597`. +For more information about this error, try `rustc --explain E0714`. diff --git a/src/test/ui/issues/issue-17718-constants-not-static.nll.stderr b/src/test/ui/issues/issue-17718-constants-not-static.nll.stderr new file mode 100644 index 0000000000000..c0795acbbb9d0 --- /dev/null +++ b/src/test/ui/issues/issue-17718-constants-not-static.nll.stderr @@ -0,0 +1,13 @@ +error[E0714]: temporary value dropped while borrowed + --> $DIR/issue-17718-constants-not-static.rs:15:31 + | +LL | fn foo() -> &'static usize { &id(FOO) } + | ^^^^^^^ - temporary value is freed at the end of this statement + | | + | creates a temporary which is freed while still in use + | + = note: borrowed value must be valid for the static lifetime... + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0714`. diff --git a/src/test/ui/issues/issue-27592.nll.stderr b/src/test/ui/issues/issue-27592.nll.stderr index 36a15e79ac825..a41b3f8201893 100644 --- a/src/test/ui/issues/issue-27592.nll.stderr +++ b/src/test/ui/issues/issue-27592.nll.stderr @@ -1,19 +1,19 @@ -error[E0597]: borrowed value does not live long enough +error[E0714]: temporary value dropped while borrowed --> $DIR/issue-27592.rs:26:27 | LL | write(|| format_args!("{}", String::from("Hello world"))); - | ^^^^ - temporary value only lives until here + | ^^^^ - temporary value is freed at the end of this statement | | - | temporary value does not live long enough + | creates a temporary which is freed while still in use -error[E0597]: borrowed value does not live long enough +error[E0714]: temporary value dropped while borrowed --> $DIR/issue-27592.rs:26:33 | LL | write(|| format_args!("{}", String::from("Hello world"))); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^- temporary value only lives until here + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^- temporary value is freed at the end of this statement | | - | temporary value does not live long enough + | creates a temporary which is freed while still in use error: aborting due to 2 previous errors -For more information about this error, try `rustc --explain E0597`. +For more information about this error, try `rustc --explain E0714`. diff --git a/src/test/ui/issues/issue-30438-a.nll.stderr b/src/test/ui/issues/issue-30438-a.nll.stderr index 2d27cd55e019a..9acaaaa274709 100644 --- a/src/test/ui/issues/issue-30438-a.nll.stderr +++ b/src/test/ui/issues/issue-30438-a.nll.stderr @@ -1,10 +1,10 @@ -error[E0597]: borrowed value does not live long enough +error[E0714]: temporary value dropped while borrowed --> $DIR/issue-30438-a.rs:22:17 | LL | return &Test { s: &self.s}; - | ^^^^^^^^^^^^^^^^^^- temporary value only lives until here + | ^^^^^^^^^^^^^^^^^^- temporary value is freed at the end of this statement | | - | temporary value does not live long enough + | creates a temporary which is freed while still in use | note: borrowed value must be valid for the anonymous lifetime #1 defined on the method body at 21:5... --> $DIR/issue-30438-a.rs:21:5 @@ -17,4 +17,4 @@ LL | | } error: aborting due to previous error -For more information about this error, try `rustc --explain E0597`. +For more information about this error, try `rustc --explain E0714`. diff --git a/src/test/ui/issues/issue-30438-b.nll.stderr b/src/test/ui/issues/issue-30438-b.nll.stderr new file mode 100644 index 0000000000000..02344c50a38ad --- /dev/null +++ b/src/test/ui/issues/issue-30438-b.nll.stderr @@ -0,0 +1,21 @@ +error[E0714]: temporary value dropped while borrowed + --> $DIR/issue-30438-b.rs:23:10 + | +LL | &Test { s: &self.s} + | ^^^^^^^^^^^^^^^^^^ creates a temporary which is freed while still in use +LL | //~^ ERROR: borrowed value does not live long enough +LL | } + | - temporary value is freed at the end of this statement + | +note: borrowed value must be valid for the anonymous lifetime #1 defined on the method body at 22:5... + --> $DIR/issue-30438-b.rs:22:5 + | +LL | / fn index(&self, _: usize) -> &Self::Output { +LL | | &Test { s: &self.s} +LL | | //~^ ERROR: borrowed value does not live long enough +LL | | } + | |_____^ + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0714`. diff --git a/src/test/ui/issues/issue-36082.ast.nll.stderr b/src/test/ui/issues/issue-36082.ast.nll.stderr index e02f21f6e1247..4a481da6522ce 100644 --- a/src/test/ui/issues/issue-36082.ast.nll.stderr +++ b/src/test/ui/issues/issue-36082.ast.nll.stderr @@ -1,10 +1,10 @@ -error[E0597]: borrowed value does not live long enough +error[E0714]: temporary value dropped while borrowed --> $DIR/issue-36082.rs:23:19 | LL | let val: &_ = x.borrow().0; - | ^^^^^^^^^^ - temporary value only lives until here + | ^^^^^^^^^^ - temporary value is freed at the end of this statement | | - | temporary value does not live long enough + | creates a temporary which is freed while still in use ... LL | println!("{}", val); | --- borrow later used here @@ -13,4 +13,4 @@ LL | println!("{}", val); error: aborting due to previous error -For more information about this error, try `rustc --explain E0597`. +For more information about this error, try `rustc --explain E0714`. diff --git a/src/test/ui/issues/issue-36082.mir.stderr b/src/test/ui/issues/issue-36082.mir.stderr index e02f21f6e1247..4a481da6522ce 100644 --- a/src/test/ui/issues/issue-36082.mir.stderr +++ b/src/test/ui/issues/issue-36082.mir.stderr @@ -1,10 +1,10 @@ -error[E0597]: borrowed value does not live long enough +error[E0714]: temporary value dropped while borrowed --> $DIR/issue-36082.rs:23:19 | LL | let val: &_ = x.borrow().0; - | ^^^^^^^^^^ - temporary value only lives until here + | ^^^^^^^^^^ - temporary value is freed at the end of this statement | | - | temporary value does not live long enough + | creates a temporary which is freed while still in use ... LL | println!("{}", val); | --- borrow later used here @@ -13,4 +13,4 @@ LL | println!("{}", val); error: aborting due to previous error -For more information about this error, try `rustc --explain E0597`. +For more information about this error, try `rustc --explain E0714`. diff --git a/src/test/ui/issues/issue-36082.rs b/src/test/ui/issues/issue-36082.rs index 579ec4d923be1..018d5bf091885 100644 --- a/src/test/ui/issues/issue-36082.rs +++ b/src/test/ui/issues/issue-36082.rs @@ -25,9 +25,9 @@ fn main() { //[ast]~| NOTE temporary value dropped here while still borrowed //[ast]~| NOTE temporary value does not live long enough //[ast]~| NOTE consider using a `let` binding to increase its lifetime - //[mir]~^^^^^ ERROR borrowed value does not live long enough [E0597] - //[mir]~| NOTE temporary value does not live long enough - //[mir]~| NOTE temporary value only lives until here + //[mir]~^^^^^ ERROR temporary value dropped while borrowed [E0714] + //[mir]~| NOTE temporary value is freed at the end of this statement + //[mir]~| NOTE creates a temporary which is freed while still in use //[mir]~| NOTE consider using a `let` binding to create a longer lived value println!("{}", val); //[mir]~^ borrow later used here diff --git a/src/test/ui/issues/issue-44373.nll.stderr b/src/test/ui/issues/issue-44373.nll.stderr new file mode 100644 index 0000000000000..9a6c59aaa20d6 --- /dev/null +++ b/src/test/ui/issues/issue-44373.nll.stderr @@ -0,0 +1,13 @@ +error[E0714]: temporary value dropped while borrowed + --> $DIR/issue-44373.rs:15:42 + | +LL | let _val: &'static [&'static u32] = &[&FOO]; //~ ERROR borrowed value does not live long enough + | ^^^^^^ creates a temporary which is freed while still in use +LL | } + | - temporary value is freed at the end of this statement + | + = note: borrowed value must be valid for the static lifetime... + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0714`. diff --git a/src/test/ui/issues/issue-46472.rs b/src/test/ui/issues/issue-46472.rs index 02c4dd7cb21d8..79e805c5356c5 100644 --- a/src/test/ui/issues/issue-46472.rs +++ b/src/test/ui/issues/issue-46472.rs @@ -13,7 +13,7 @@ fn bar<'a>() -> &'a mut u32 { &mut 4 //~^ ERROR borrowed value does not live long enough (Ast) [E0597] - //~| ERROR borrowed value does not live long enough (Mir) [E0597] + //~| ERROR temporary value dropped while borrowed (Mir) [E0714] } fn main() { } diff --git a/src/test/ui/issues/issue-46472.stderr b/src/test/ui/issues/issue-46472.stderr index 9e5acf56d26ca..39c4e091fd2a1 100644 --- a/src/test/ui/issues/issue-46472.stderr +++ b/src/test/ui/issues/issue-46472.stderr @@ -13,14 +13,14 @@ note: borrowed value must be valid for the lifetime 'a as defined on the functio LL | fn bar<'a>() -> &'a mut u32 { | ^^ -error[E0597]: borrowed value does not live long enough (Mir) +error[E0714]: temporary value dropped while borrowed (Mir) --> $DIR/issue-46472.rs:14:10 | LL | &mut 4 - | ^ temporary value does not live long enough + | ^ creates a temporary which is freed while still in use ... LL | } - | - temporary value only lives until here + | - temporary value is freed at the end of this statement | note: borrowed value must be valid for the lifetime 'a as defined on the function body at 13:8... --> $DIR/issue-46472.rs:13:8 @@ -30,4 +30,5 @@ LL | fn bar<'a>() -> &'a mut u32 { error: aborting due to 2 previous errors -For more information about this error, try `rustc --explain E0597`. +Some errors occurred: E0597, E0714. +For more information about an error, try `rustc --explain E0597`. diff --git a/src/test/ui/issues/issue-47184.rs b/src/test/ui/issues/issue-47184.rs index 0831b7e0af8e2..fbf67a3b4fc08 100644 --- a/src/test/ui/issues/issue-47184.rs +++ b/src/test/ui/issues/issue-47184.rs @@ -12,5 +12,5 @@ fn main() { let _vec: Vec<&'static String> = vec![&String::new()]; - //~^ ERROR borrowed value does not live long enough [E0597] + //~^ ERROR temporary value dropped while borrowed [E0714] } diff --git a/src/test/ui/issues/issue-47184.stderr b/src/test/ui/issues/issue-47184.stderr index 32a9783e9c213..1a4b7ae16bffd 100644 --- a/src/test/ui/issues/issue-47184.stderr +++ b/src/test/ui/issues/issue-47184.stderr @@ -1,13 +1,13 @@ -error[E0597]: borrowed value does not live long enough +error[E0714]: temporary value dropped while borrowed --> $DIR/issue-47184.rs:14:44 | LL | let _vec: Vec<&'static String> = vec![&String::new()]; - | ^^^^^^^^^^^^^ - temporary value only lives until here + | ^^^^^^^^^^^^^ - temporary value is freed at the end of this statement | | - | temporary value does not live long enough + | creates a temporary which is freed while still in use | = note: borrowed value must be valid for the static lifetime... error: aborting due to previous error -For more information about this error, try `rustc --explain E0597`. +For more information about this error, try `rustc --explain E0714`. diff --git a/src/test/ui/issues/issue-52049.nll.stderr b/src/test/ui/issues/issue-52049.nll.stderr index 6f71f1676119a..ad4cd48c9deb9 100644 --- a/src/test/ui/issues/issue-52049.nll.stderr +++ b/src/test/ui/issues/issue-52049.nll.stderr @@ -1,13 +1,13 @@ -error[E0597]: borrowed value does not live long enough +error[E0714]: temporary value dropped while borrowed --> $DIR/issue-52049.rs:16:10 | LL | foo(&unpromotable(5u32)); - | ^^^^^^^^^^^^^^^^^^ temporary value does not live long enough + | ^^^^^^^^^^^^^^^^^^ creates a temporary which is freed while still in use LL | } - | - temporary value only lives until here + | - temporary value is freed at the end of this statement | = note: borrowed value must be valid for the static lifetime... error: aborting due to previous error -For more information about this error, try `rustc --explain E0597`. +For more information about this error, try `rustc --explain E0714`. diff --git a/src/test/ui/lifetimes/borrowck-let-suggestion.nll.stderr b/src/test/ui/lifetimes/borrowck-let-suggestion.nll.stderr index a8a1b33c925bc..0747405cf14cc 100644 --- a/src/test/ui/lifetimes/borrowck-let-suggestion.nll.stderr +++ b/src/test/ui/lifetimes/borrowck-let-suggestion.nll.stderr @@ -1,10 +1,10 @@ -error[E0597]: borrowed value does not live long enough +error[E0714]: temporary value dropped while borrowed --> $DIR/borrowck-let-suggestion.rs:12:17 | LL | let mut x = vec![1].iter(); - | ^^^^^^^ - temporary value only lives until here + | ^^^^^^^ - temporary value is freed at the end of this statement | | - | temporary value does not live long enough + | creates a temporary which is freed while still in use LL | //~^ ERROR borrowed value does not live long enough LL | x.use_mut(); | - borrow later used here @@ -14,4 +14,4 @@ LL | x.use_mut(); error: aborting due to previous error -For more information about this error, try `rustc --explain E0597`. +For more information about this error, try `rustc --explain E0714`. diff --git a/src/test/ui/nll/borrowed-temporary-error.rs b/src/test/ui/nll/borrowed-temporary-error.rs index 7aad7205a52a1..d0b53359cd0e4 100644 --- a/src/test/ui/nll/borrowed-temporary-error.rs +++ b/src/test/ui/nll/borrowed-temporary-error.rs @@ -18,7 +18,7 @@ fn main() { let x = gimme({ let v = 22; &(v,) - //~^ ERROR borrowed value does not live long enough [E0597] + //~^ ERROR temporary value dropped while borrowed [E0714] }); println!("{:?}", x); } diff --git a/src/test/ui/nll/borrowed-temporary-error.stderr b/src/test/ui/nll/borrowed-temporary-error.stderr index 8b69c57d3765d..a929914d8df71 100644 --- a/src/test/ui/nll/borrowed-temporary-error.stderr +++ b/src/test/ui/nll/borrowed-temporary-error.stderr @@ -1,11 +1,11 @@ -error[E0597]: borrowed value does not live long enough +error[E0714]: temporary value dropped while borrowed --> $DIR/borrowed-temporary-error.rs:20:10 | LL | &(v,) - | ^^^^ temporary value does not live long enough -LL | //~^ ERROR borrowed value does not live long enough [E0597] + | ^^^^ creates a temporary which is freed while still in use +LL | //~^ ERROR temporary value dropped while borrowed [E0714] LL | }); - | - temporary value only lives until here + | - temporary value is freed at the end of this statement LL | println!("{:?}", x); | - borrow later used here | @@ -13,4 +13,4 @@ LL | println!("{:?}", x); error: aborting due to previous error -For more information about this error, try `rustc --explain E0597`. +For more information about this error, try `rustc --explain E0714`. diff --git a/src/test/ui/nll/borrowed-universal-error.rs b/src/test/ui/nll/borrowed-universal-error.rs index 9482b9b140002..5ea91d3618afd 100644 --- a/src/test/ui/nll/borrowed-universal-error.rs +++ b/src/test/ui/nll/borrowed-universal-error.rs @@ -18,7 +18,7 @@ fn gimme(x: &(u32,)) -> &u32 { fn foo<'a>(x: &'a (u32,)) -> &'a u32 { let v = 22; gimme(&(v,)) - //~^ ERROR borrowed value does not live long enough [E0597] + //~^ ERROR temporary value dropped while borrowed [E0714] } fn main() {} diff --git a/src/test/ui/nll/borrowed-universal-error.stderr b/src/test/ui/nll/borrowed-universal-error.stderr index da287980e8c5f..a65a396d2ab64 100644 --- a/src/test/ui/nll/borrowed-universal-error.stderr +++ b/src/test/ui/nll/borrowed-universal-error.stderr @@ -1,11 +1,11 @@ -error[E0597]: borrowed value does not live long enough +error[E0714]: temporary value dropped while borrowed --> $DIR/borrowed-universal-error.rs:20:12 | LL | gimme(&(v,)) - | ^^^^ temporary value does not live long enough -LL | //~^ ERROR borrowed value does not live long enough [E0597] + | ^^^^ creates a temporary which is freed while still in use +LL | //~^ ERROR temporary value dropped while borrowed [E0714] LL | } - | - temporary value only lives until here + | - temporary value is freed at the end of this statement | note: borrowed value must be valid for the lifetime 'a as defined on the function body at 18:8... --> $DIR/borrowed-universal-error.rs:18:8 @@ -15,4 +15,4 @@ LL | fn foo<'a>(x: &'a (u32,)) -> &'a u32 { error: aborting due to previous error -For more information about this error, try `rustc --explain E0597`. +For more information about this error, try `rustc --explain E0714`. diff --git a/src/test/ui/nll/issue-52534-1.stderr b/src/test/ui/nll/issue-52534-1.stderr index e2f8134e3be0e..9bb32c3ed3dc7 100644 --- a/src/test/ui/nll/issue-52534-1.stderr +++ b/src/test/ui/nll/issue-52534-1.stderr @@ -52,13 +52,13 @@ LL | } = note: functions cannot return a borrow to data owned within the function's scope, functions can only return borrows to data passed as arguments = note: to learn more, visit -error[E0597]: borrowed value does not live long enough +error[E0714]: temporary value dropped while borrowed --> $DIR/issue-52534-1.rs:30:6 | LL | &&x - | ^^ temporary value does not live long enough + | ^^ creates a temporary which is freed while still in use LL | } - | - temporary value only lives until here + | - temporary value is freed at the end of this statement | note: borrowed value must be valid for the anonymous lifetime #1 defined on the function body at 28:1... --> $DIR/issue-52534-1.rs:28:1 @@ -137,4 +137,5 @@ LL | } error: aborting due to 8 previous errors -For more information about this error, try `rustc --explain E0597`. +Some errors occurred: E0597, E0714. +For more information about an error, try `rustc --explain E0597`. diff --git a/src/test/ui/nll/return-ref-mut-issue-46557.rs b/src/test/ui/nll/return-ref-mut-issue-46557.rs index 79150f340cad8..82222530335e7 100644 --- a/src/test/ui/nll/return-ref-mut-issue-46557.rs +++ b/src/test/ui/nll/return-ref-mut-issue-46557.rs @@ -14,7 +14,7 @@ #![allow(dead_code)] fn gimme_static_mut() -> &'static mut u32 { - let ref mut x = 1234543; //~ ERROR borrowed value does not live long enough [E0597] + let ref mut x = 1234543; //~ ERROR temporary value dropped while borrowed [E0714] x } diff --git a/src/test/ui/nll/return-ref-mut-issue-46557.stderr b/src/test/ui/nll/return-ref-mut-issue-46557.stderr index f441085f242ed..1e8224c8ddbd5 100644 --- a/src/test/ui/nll/return-ref-mut-issue-46557.stderr +++ b/src/test/ui/nll/return-ref-mut-issue-46557.stderr @@ -1,14 +1,14 @@ -error[E0597]: borrowed value does not live long enough +error[E0714]: temporary value dropped while borrowed --> $DIR/return-ref-mut-issue-46557.rs:17:21 | -LL | let ref mut x = 1234543; //~ ERROR borrowed value does not live long enough [E0597] - | ^^^^^^^ temporary value does not live long enough +LL | let ref mut x = 1234543; //~ ERROR temporary value dropped while borrowed [E0714] + | ^^^^^^^ creates a temporary which is freed while still in use LL | x LL | } - | - temporary value only lives until here + | - temporary value is freed at the end of this statement | = note: borrowed value must be valid for the static lifetime... error: aborting due to previous error -For more information about this error, try `rustc --explain E0597`. +For more information about this error, try `rustc --explain E0714`. diff --git a/src/test/ui/nll/user-annotations/patterns.rs b/src/test/ui/nll/user-annotations/patterns.rs index 53d97360c869e..971a737702490 100644 --- a/src/test/ui/nll/user-annotations/patterns.rs +++ b/src/test/ui/nll/user-annotations/patterns.rs @@ -51,13 +51,13 @@ fn underscore_with_initializer() { let _: &'static u32 = &x; //~ ERROR let _: Vec<&'static String> = vec![&String::new()]; - //~^ ERROR borrowed value does not live long enough [E0597] + //~^ ERROR temporary value dropped while borrowed [E0714] let (_, a): (Vec<&'static String>, _) = (vec![&String::new()], 44); - //~^ ERROR borrowed value does not live long enough [E0597] + //~^ ERROR temporary value dropped while borrowed [E0714] let (_a, b): (Vec<&'static String>, _) = (vec![&String::new()], 44); - //~^ ERROR borrowed value does not live long enough [E0597] + //~^ ERROR temporary value dropped while borrowed [E0714] } fn pair_underscores_with_initializer() { diff --git a/src/test/ui/nll/user-annotations/patterns.stderr b/src/test/ui/nll/user-annotations/patterns.stderr index f359608462d1d..0e3109413bdf0 100644 --- a/src/test/ui/nll/user-annotations/patterns.stderr +++ b/src/test/ui/nll/user-annotations/patterns.stderr @@ -40,33 +40,33 @@ LL | } | = note: borrowed value must be valid for the static lifetime... -error[E0597]: borrowed value does not live long enough +error[E0714]: temporary value dropped while borrowed --> $DIR/patterns.rs:53:41 | LL | let _: Vec<&'static String> = vec![&String::new()]; - | ^^^^^^^^^^^^^ - temporary value only lives until here + | ^^^^^^^^^^^^^ - temporary value is freed at the end of this statement | | - | temporary value does not live long enough + | creates a temporary which is freed while still in use | = note: borrowed value must be valid for the static lifetime... -error[E0597]: borrowed value does not live long enough +error[E0714]: temporary value dropped while borrowed --> $DIR/patterns.rs:56:52 | LL | let (_, a): (Vec<&'static String>, _) = (vec![&String::new()], 44); - | ^^^^^^^^^^^^^ - temporary value only lives until here + | ^^^^^^^^^^^^^ - temporary value is freed at the end of this statement | | - | temporary value does not live long enough + | creates a temporary which is freed while still in use | = note: borrowed value must be valid for the static lifetime... -error[E0597]: borrowed value does not live long enough +error[E0714]: temporary value dropped while borrowed --> $DIR/patterns.rs:59:53 | LL | let (_a, b): (Vec<&'static String>, _) = (vec![&String::new()], 44); - | ^^^^^^^^^^^^^ - temporary value only lives until here + | ^^^^^^^^^^^^^ - temporary value is freed at the end of this statement | | - | temporary value does not live long enough + | creates a temporary which is freed while still in use | = note: borrowed value must be valid for the static lifetime... @@ -140,4 +140,5 @@ LL | let (y, _z): (&'static u32, u32) = (x, 44); //~ ERROR error: aborting due to 14 previous errors -For more information about this error, try `rustc --explain E0597`. +Some errors occurred: E0597, E0714. +For more information about an error, try `rustc --explain E0597`. diff --git a/src/test/ui/regions/regions-creating-enums.nll.stderr b/src/test/ui/regions/regions-creating-enums.nll.stderr index 58dff9c6c37c7..df2e3558612c3 100644 --- a/src/test/ui/regions/regions-creating-enums.nll.stderr +++ b/src/test/ui/regions/regions-creating-enums.nll.stderr @@ -1,10 +1,10 @@ -error[E0597]: borrowed value does not live long enough +error[E0714]: temporary value dropped while borrowed --> $DIR/regions-creating-enums.rs:33:17 | LL | return &ast::num((*f)(x)); //~ ERROR borrowed value does not live long enough - | ^^^^^^^^^^^^^^^^^- temporary value only lives until here + | ^^^^^^^^^^^^^^^^^- temporary value is freed at the end of this statement | | - | temporary value does not live long enough + | creates a temporary which is freed while still in use | note: borrowed value must be valid for the lifetime 'a as defined on the function body at 30:13... --> $DIR/regions-creating-enums.rs:30:13 @@ -12,13 +12,13 @@ note: borrowed value must be valid for the lifetime 'a as defined on the functio LL | fn map_nums<'a,'b, F>(x: &ast, f: &mut F) -> &'a ast<'b> where F: FnMut(usize) -> usize { | ^^ -error[E0597]: borrowed value does not live long enough +error[E0714]: temporary value dropped while borrowed --> $DIR/regions-creating-enums.rs:38:17 | LL | return &ast::add(m_x, m_y); //~ ERROR borrowed value does not live long enough - | ^^^^^^^^^^^^^^^^^^- temporary value only lives until here + | ^^^^^^^^^^^^^^^^^^- temporary value is freed at the end of this statement | | - | temporary value does not live long enough + | creates a temporary which is freed while still in use | note: borrowed value must be valid for the lifetime 'a as defined on the function body at 30:13... --> $DIR/regions-creating-enums.rs:30:13 @@ -28,4 +28,4 @@ LL | fn map_nums<'a,'b, F>(x: &ast, f: &mut F) -> &'a ast<'b> where F: FnMut(usi error: aborting due to 2 previous errors -For more information about this error, try `rustc --explain E0597`. +For more information about this error, try `rustc --explain E0714`. diff --git a/src/test/ui/regions/regions-free-region-ordering-caller1.nll.stderr b/src/test/ui/regions/regions-free-region-ordering-caller1.nll.stderr index acf7a033ade17..3bac4db347545 100644 --- a/src/test/ui/regions/regions-free-region-ordering-caller1.nll.stderr +++ b/src/test/ui/regions/regions-free-region-ordering-caller1.nll.stderr @@ -1,11 +1,11 @@ -error[E0597]: borrowed value does not live long enough +error[E0714]: temporary value dropped while borrowed --> $DIR/regions-free-region-ordering-caller1.rs:19:27 | LL | let z: &'a & usize = &(&y); - | ^^^^ temporary value does not live long enough + | ^^^^ creates a temporary which is freed while still in use ... LL | } - | - temporary value only lives until here + | - temporary value is freed at the end of this statement | note: borrowed value must be valid for the lifetime 'a as defined on the function body at 15:10... --> $DIR/regions-free-region-ordering-caller1.rs:15:10 @@ -15,4 +15,4 @@ LL | fn call1<'a>(x: &'a usize) { error: aborting due to previous error -For more information about this error, try `rustc --explain E0597`. +For more information about this error, try `rustc --explain E0714`. diff --git a/src/test/ui/regions/regions-lifetime-of-struct-or-enum-variant.nll.stderr b/src/test/ui/regions/regions-lifetime-of-struct-or-enum-variant.nll.stderr new file mode 100644 index 0000000000000..0a6b9b718b5c8 --- /dev/null +++ b/src/test/ui/regions/regions-lifetime-of-struct-or-enum-variant.nll.stderr @@ -0,0 +1,33 @@ +error[E0714]: temporary value dropped while borrowed + --> $DIR/regions-lifetime-of-struct-or-enum-variant.rs:24:20 + | +LL | let testValue = &id(Test); + | ^^^^^^^^ creates a temporary which is freed while still in use +... +LL | } + | - temporary value is freed at the end of this statement + | +note: borrowed value must be valid for the lifetime 'a as defined on the function body at 23:19... + --> $DIR/regions-lifetime-of-struct-or-enum-variant.rs:23:19 + | +LL | fn structLifetime<'a>() -> &'a Test { + | ^^ + +error[E0714]: temporary value dropped while borrowed + --> $DIR/regions-lifetime-of-struct-or-enum-variant.rs:30:20 + | +LL | let testValue = &id(MyEnum::Variant1); + | ^^^^^^^^^^^^^^^^^^^^ creates a temporary which is freed while still in use +... +LL | } + | - temporary value is freed at the end of this statement + | +note: borrowed value must be valid for the lifetime 'a as defined on the function body at 29:20... + --> $DIR/regions-lifetime-of-struct-or-enum-variant.rs:29:20 + | +LL | fn variantLifetime<'a>() -> &'a MyEnum { + | ^^ + +error: aborting due to 2 previous errors + +For more information about this error, try `rustc --explain E0714`. diff --git a/src/test/ui/regions/regions-ref-in-fn-arg.nll.stderr b/src/test/ui/regions/regions-ref-in-fn-arg.nll.stderr index 87fe858769d18..af84d36e0b4e2 100644 --- a/src/test/ui/regions/regions-ref-in-fn-arg.nll.stderr +++ b/src/test/ui/regions/regions-ref-in-fn-arg.nll.stderr @@ -1,22 +1,22 @@ -error[E0597]: borrowed value does not live long enough +error[E0714]: temporary value dropped while borrowed --> $DIR/regions-ref-in-fn-arg.rs:14:13 | LL | fn arg_item(box ref x: Box) -> &'static isize { - | ^^^^^^^^^ temporary value does not live long enough + | ^^^^^^^^^ creates a temporary which is freed while still in use LL | x //~^ ERROR borrowed value does not live long enough LL | } - | - temporary value only lives until here + | - temporary value is freed at the end of this statement | = note: borrowed value must be valid for the static lifetime... -error[E0597]: borrowed value does not live long enough +error[E0714]: temporary value dropped while borrowed --> $DIR/regions-ref-in-fn-arg.rs:21:11 | LL | with(|box ref x| x) //~ ERROR borrowed value does not live long enough - | ^^^^^^^^^ - temporary value only lives until here + | ^^^^^^^^^ - temporary value is freed at the end of this statement | | - | temporary value does not live long enough + | creates a temporary which is freed while still in use error: aborting due to 2 previous errors -For more information about this error, try `rustc --explain E0597`. +For more information about this error, try `rustc --explain E0714`. diff --git a/src/test/ui/regions/regions-ret.nll.stderr b/src/test/ui/regions/regions-ret.nll.stderr index cacc119d41013..8dfb7c18480b6 100644 --- a/src/test/ui/regions/regions-ret.nll.stderr +++ b/src/test/ui/regions/regions-ret.nll.stderr @@ -1,10 +1,10 @@ -error[E0597]: borrowed value does not live long enough +error[E0714]: temporary value dropped while borrowed --> $DIR/regions-ret.rs:14:13 | LL | return &id(3); //~ ERROR borrowed value does not live long enough - | ^^^^^- temporary value only lives until here + | ^^^^^- temporary value is freed at the end of this statement | | - | temporary value does not live long enough + | creates a temporary which is freed while still in use | note: borrowed value must be valid for the anonymous lifetime #1 defined on the function body at 13:1... --> $DIR/regions-ret.rs:13:1 @@ -16,4 +16,4 @@ LL | | } error: aborting due to previous error -For more information about this error, try `rustc --explain E0597`. +For more information about this error, try `rustc --explain E0714`. diff --git a/src/test/ui/regions/regions-return-stack-allocated-vec.nll.stderr b/src/test/ui/regions/regions-return-stack-allocated-vec.nll.stderr new file mode 100644 index 0000000000000..919e29e4ec46d --- /dev/null +++ b/src/test/ui/regions/regions-return-stack-allocated-vec.nll.stderr @@ -0,0 +1,13 @@ +error[E0714]: temporary value dropped while borrowed + --> $DIR/regions-return-stack-allocated-vec.rs:14:6 + | +LL | &[x] //~ ERROR borrowed value does not live long enough + | ^^^ creates a temporary which is freed while still in use +LL | } + | - temporary value is freed at the end of this statement + | + = note: borrowed value must be valid for the static lifetime... + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0714`. diff --git a/src/test/ui/regions/regions-var-type-out-of-scope.nll.stderr b/src/test/ui/regions/regions-var-type-out-of-scope.nll.stderr index aa744a3ae8a74..6d1b9938a8b35 100644 --- a/src/test/ui/regions/regions-var-type-out-of-scope.nll.stderr +++ b/src/test/ui/regions/regions-var-type-out-of-scope.nll.stderr @@ -1,10 +1,10 @@ -error[E0597]: borrowed value does not live long enough +error[E0714]: temporary value dropped while borrowed --> $DIR/regions-var-type-out-of-scope.rs:19:14 | LL | x = &id(3); //~ ERROR borrowed value does not live long enough - | ^^^^^- temporary value only lives until here + | ^^^^^- temporary value is freed at the end of this statement | | - | temporary value does not live long enough + | creates a temporary which is freed while still in use LL | assert_eq!(*x, 3); | ------------------ borrow later used here | @@ -13,4 +13,4 @@ LL | assert_eq!(*x, 3); error: aborting due to previous error -For more information about this error, try `rustc --explain E0597`. +For more information about this error, try `rustc --explain E0714`. diff --git a/src/test/ui/span/borrowck-let-suggestion-suffixes.nll.stderr b/src/test/ui/span/borrowck-let-suggestion-suffixes.nll.stderr index 001eba4b039b1..765d8b36b0e69 100644 --- a/src/test/ui/span/borrowck-let-suggestion-suffixes.nll.stderr +++ b/src/test/ui/span/borrowck-let-suggestion-suffixes.nll.stderr @@ -1,36 +1,36 @@ -error[E0597]: borrowed value does not live long enough +error[E0714]: temporary value dropped while borrowed --> $DIR/borrowck-let-suggestion-suffixes.rs:28:14 | LL | v3.push(&id('x')); // statement 6 - | ^^^^^^^ - temporary value only lives until here + | ^^^^^^^ - temporary value is freed at the end of this statement | | - | temporary value does not live long enough + | creates a temporary which is freed while still in use ... LL | (v1, v2, v3, /* v4 is above. */ v5).use_ref(); | -- borrow later used here | = note: consider using a `let` binding to create a longer lived value -error[E0597]: borrowed value does not live long enough +error[E0714]: temporary value dropped while borrowed --> $DIR/borrowck-let-suggestion-suffixes.rs:38:18 | LL | v4.push(&id('y')); - | ^^^^^^^ - temporary value only lives until here + | ^^^^^^^ - temporary value is freed at the end of this statement | | - | temporary value does not live long enough + | creates a temporary which is freed while still in use ... LL | v4.use_ref(); | -- borrow later used here | = note: consider using a `let` binding to create a longer lived value -error[E0597]: borrowed value does not live long enough +error[E0714]: temporary value dropped while borrowed --> $DIR/borrowck-let-suggestion-suffixes.rs:49:14 | LL | v5.push(&id('z')); - | ^^^^^^^ - temporary value only lives until here + | ^^^^^^^ - temporary value is freed at the end of this statement | | - | temporary value does not live long enough + | creates a temporary which is freed while still in use ... LL | (v1, v2, v3, /* v4 is above. */ v5).use_ref(); | -- borrow later used here @@ -39,4 +39,4 @@ LL | (v1, v2, v3, /* v4 is above. */ v5).use_ref(); error: aborting due to 3 previous errors -For more information about this error, try `rustc --explain E0597`. +For more information about this error, try `rustc --explain E0714`. diff --git a/src/test/ui/span/issue-15480.nll.stderr b/src/test/ui/span/issue-15480.nll.stderr index 8dcf486f83011..098e1ce62a82c 100644 --- a/src/test/ui/span/issue-15480.nll.stderr +++ b/src/test/ui/span/issue-15480.nll.stderr @@ -1,10 +1,10 @@ -error[E0597]: borrowed value does not live long enough +error[E0714]: temporary value dropped while borrowed --> $DIR/issue-15480.rs:15:10 | LL | &id(3) - | ^^^^^ temporary value does not live long enough + | ^^^^^ creates a temporary which is freed while still in use LL | ]; - | - temporary value only lives until here + | - temporary value is freed at the end of this statement ... LL | for &&x in &v { | -- borrow later used here @@ -13,4 +13,4 @@ LL | for &&x in &v { error: aborting due to previous error -For more information about this error, try `rustc --explain E0597`. +For more information about this error, try `rustc --explain E0714`. diff --git a/src/test/ui/span/regions-close-over-borrowed-ref-in-obj.nll.stderr b/src/test/ui/span/regions-close-over-borrowed-ref-in-obj.nll.stderr index 3788b5a328495..0e5fc749d9691 100644 --- a/src/test/ui/span/regions-close-over-borrowed-ref-in-obj.nll.stderr +++ b/src/test/ui/span/regions-close-over-borrowed-ref-in-obj.nll.stderr @@ -1,11 +1,11 @@ -error[E0597]: borrowed value does not live long enough +error[E0714]: temporary value dropped while borrowed --> $DIR/regions-close-over-borrowed-ref-in-obj.rs:22:27 | LL | let ss: &isize = &id(1); - | ^^^^^ temporary value does not live long enough + | ^^^^^ creates a temporary which is freed while still in use ... LL | } - | - temporary value only lives until here + | - temporary value is freed at the end of this statement LL | } | - borrow later used here, when `blah` is dropped | @@ -13,4 +13,4 @@ LL | } error: aborting due to previous error -For more information about this error, try `rustc --explain E0597`. +For more information about this error, try `rustc --explain E0714`. diff --git a/src/test/ui/span/slice-borrow.nll.stderr b/src/test/ui/span/slice-borrow.nll.stderr index 4a15d8ff45537..0aeb549d95e58 100644 --- a/src/test/ui/span/slice-borrow.nll.stderr +++ b/src/test/ui/span/slice-borrow.nll.stderr @@ -1,11 +1,11 @@ -error[E0597]: borrowed value does not live long enough +error[E0714]: temporary value dropped while borrowed --> $DIR/slice-borrow.rs:16:28 | LL | let x: &[isize] = &vec![1, 2, 3, 4, 5]; - | ^^^^^^^^^^^^^^^^^^^ temporary value does not live long enough + | ^^^^^^^^^^^^^^^^^^^ creates a temporary which is freed while still in use ... LL | } - | - temporary value only lives until here + | - temporary value is freed at the end of this statement LL | y.use_ref(); | - borrow later used here | @@ -14,4 +14,4 @@ LL | y.use_ref(); error: aborting due to previous error -For more information about this error, try `rustc --explain E0597`. +For more information about this error, try `rustc --explain E0714`. diff --git a/src/test/ui/static/static-drop-scope.nll.stderr b/src/test/ui/static/static-drop-scope.nll.stderr new file mode 100644 index 0000000000000..36c645479dde8 --- /dev/null +++ b/src/test/ui/static/static-drop-scope.nll.stderr @@ -0,0 +1,60 @@ +error[E0493]: destructors cannot be evaluated at compile-time + --> $DIR/static-drop-scope.rs:19:60 + | +LL | static PROMOTION_FAIL_S: Option<&'static WithDtor> = Some(&WithDtor); + | ^^^^^^^^ statics cannot evaluate destructors + +error[E0714]: temporary value dropped while borrowed + --> $DIR/static-drop-scope.rs:19:60 + | +LL | static PROMOTION_FAIL_S: Option<&'static WithDtor> = Some(&WithDtor); + | ^^^^^^^^- temporary value is freed at the end of this statement + | | + | creates a temporary which is freed while still in use + | + = note: borrowed value must be valid for the static lifetime... + +error[E0493]: destructors cannot be evaluated at compile-time + --> $DIR/static-drop-scope.rs:23:59 + | +LL | const PROMOTION_FAIL_C: Option<&'static WithDtor> = Some(&WithDtor); + | ^^^^^^^^ constants cannot evaluate destructors + +error[E0714]: temporary value dropped while borrowed + --> $DIR/static-drop-scope.rs:23:59 + | +LL | const PROMOTION_FAIL_C: Option<&'static WithDtor> = Some(&WithDtor); + | ^^^^^^^^- temporary value is freed at the end of this statement + | | + | creates a temporary which is freed while still in use + | + = note: borrowed value must be valid for the static lifetime... + +error[E0493]: destructors cannot be evaluated at compile-time + --> $DIR/static-drop-scope.rs:27:28 + | +LL | static EARLY_DROP_S: i32 = (WithDtor, 0).1; + | ^^^^^^^^^^^^^ statics cannot evaluate destructors + +error[E0493]: destructors cannot be evaluated at compile-time + --> $DIR/static-drop-scope.rs:30:27 + | +LL | const EARLY_DROP_C: i32 = (WithDtor, 0).1; + | ^^^^^^^^^^^^^ constants cannot evaluate destructors + +error[E0493]: destructors cannot be evaluated at compile-time + --> $DIR/static-drop-scope.rs:33:24 + | +LL | const fn const_drop(_: T) {} + | ^ constant functions cannot evaluate destructors + +error[E0493]: destructors cannot be evaluated at compile-time + --> $DIR/static-drop-scope.rs:37:5 + | +LL | (x, ()).1 + | ^^^^^^^ constant functions cannot evaluate destructors + +error: aborting due to 8 previous errors + +Some errors occurred: E0493, E0714. +For more information about an error, try `rustc --explain E0493`. diff --git a/src/test/ui/static/static-reference-to-fn-2.nll.stderr b/src/test/ui/static/static-reference-to-fn-2.nll.stderr index 9ef94189e90ca..3740d9051be6a 100644 --- a/src/test/ui/static/static-reference-to-fn-2.nll.stderr +++ b/src/test/ui/static/static-reference-to-fn-2.nll.stderr @@ -1,10 +1,10 @@ -error[E0597]: borrowed value does not live long enough +error[E0714]: temporary value dropped while borrowed --> $DIR/static-reference-to-fn-2.rs:28:22 | LL | self_.statefn = &id(state2 as StateMachineFunc); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^- temporary value only lives until here + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^- temporary value is freed at the end of this statement | | - | temporary value does not live long enough + | creates a temporary which is freed while still in use | note: borrowed value must be valid for the anonymous lifetime #2 defined on the function body at 27:1... --> $DIR/static-reference-to-fn-2.rs:27:1 @@ -16,13 +16,13 @@ LL | | return Some("state1"); LL | | } | |_^ -error[E0597]: borrowed value does not live long enough +error[E0714]: temporary value dropped while borrowed --> $DIR/static-reference-to-fn-2.rs:34:22 | LL | self_.statefn = &id(state3 as StateMachineFunc); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^- temporary value only lives until here + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^- temporary value is freed at the end of this statement | | - | temporary value does not live long enough + | creates a temporary which is freed while still in use | note: borrowed value must be valid for the anonymous lifetime #2 defined on the function body at 33:1... --> $DIR/static-reference-to-fn-2.rs:33:1 @@ -34,13 +34,13 @@ LL | | return Some("state2"); LL | | } | |_^ -error[E0597]: borrowed value does not live long enough +error[E0714]: temporary value dropped while borrowed --> $DIR/static-reference-to-fn-2.rs:40:22 | LL | self_.statefn = &id(finished as StateMachineFunc); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^- temporary value only lives until here + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^- temporary value is freed at the end of this statement | | - | temporary value does not live long enough + | creates a temporary which is freed while still in use | note: borrowed value must be valid for the anonymous lifetime #2 defined on the function body at 39:1... --> $DIR/static-reference-to-fn-2.rs:39:1 @@ -52,17 +52,17 @@ LL | | return Some("state3"); LL | | } | |_^ -error[E0597]: borrowed value does not live long enough +error[E0714]: temporary value dropped while borrowed --> $DIR/static-reference-to-fn-2.rs:51:19 | LL | statefn: &id(state1 as StateMachineFunc) - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ temporary value does not live long enough + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ creates a temporary which is freed while still in use ... LL | } - | - temporary value only lives until here + | - temporary value is freed at the end of this statement | = note: borrowed value must be valid for the static lifetime... error: aborting due to 4 previous errors -For more information about this error, try `rustc --explain E0597`. +For more information about this error, try `rustc --explain E0714`. diff --git a/src/test/ui/static/static-region-bound.nll.stderr b/src/test/ui/static/static-region-bound.nll.stderr new file mode 100644 index 0000000000000..3bb763eb1c779 --- /dev/null +++ b/src/test/ui/static/static-region-bound.nll.stderr @@ -0,0 +1,14 @@ +error[E0714]: temporary value dropped while borrowed + --> $DIR/static-region-bound.rs:20:14 + | +LL | let x = &id(3); //~ ERROR borrowed value does not live long enough + | ^^^^^ creates a temporary which is freed while still in use +LL | f(x); +LL | } + | - temporary value is freed at the end of this statement + | + = note: borrowed value must be valid for the static lifetime... + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0714`. diff --git a/src/test/ui/wf/wf-misc-methods-issue-28609.nll.stderr b/src/test/ui/wf/wf-misc-methods-issue-28609.nll.stderr index 48a68bf5749f9..656a2eb698c05 100644 --- a/src/test/ui/wf/wf-misc-methods-issue-28609.nll.stderr +++ b/src/test/ui/wf/wf-misc-methods-issue-28609.nll.stderr @@ -1,10 +1,10 @@ -error[E0597]: borrowed value does not live long enough +error[E0714]: temporary value dropped while borrowed --> $DIR/wf-misc-methods-issue-28609.rs:32:31 | LL | s.transmute_inherent(&mut 42) //~ ERROR does not live long enough - | ^^ temporary value does not live long enough + | ^^ creates a temporary which is freed while still in use LL | } - | - temporary value only lives until here + | - temporary value is freed at the end of this statement | note: borrowed value must be valid for the anonymous lifetime #1 defined on the function body at 30:1... --> $DIR/wf-misc-methods-issue-28609.rs:30:1 @@ -55,13 +55,13 @@ LL | | &*s LL | | } | |_^ -error[E0597]: borrowed value does not live long enough +error[E0714]: temporary value dropped while borrowed --> $DIR/wf-misc-methods-issue-28609.rs:63:15 | LL | s << &mut 3 //~ ERROR does not live long enough - | ^ temporary value does not live long enough + | ^ creates a temporary which is freed while still in use LL | } - | - temporary value only lives until here + | - temporary value is freed at the end of this statement | note: borrowed value must be valid for the anonymous lifetime #1 defined on the function body at 61:1... --> $DIR/wf-misc-methods-issue-28609.rs:61:1 @@ -72,13 +72,13 @@ LL | | s << &mut 3 //~ ERROR does not live long enough LL | | } | |_^ -error[E0597]: borrowed value does not live long enough +error[E0714]: temporary value dropped while borrowed --> $DIR/wf-misc-methods-issue-28609.rs:68:16 | LL | s.shl(&mut 3) //~ ERROR does not live long enough - | ^ temporary value does not live long enough + | ^ creates a temporary which is freed while still in use LL | } - | - temporary value only lives until here + | - temporary value is freed at the end of this statement | note: borrowed value must be valid for the anonymous lifetime #1 defined on the function body at 66:1... --> $DIR/wf-misc-methods-issue-28609.rs:66:1 @@ -89,13 +89,13 @@ LL | | s.shl(&mut 3) //~ ERROR does not live long enough LL | | } | |_^ -error[E0597]: borrowed value does not live long enough +error[E0714]: temporary value dropped while borrowed --> $DIR/wf-misc-methods-issue-28609.rs:73:21 | LL | S2::shl(s, &mut 3) //~ ERROR does not live long enough - | ^ temporary value does not live long enough + | ^ creates a temporary which is freed while still in use LL | } - | - temporary value only lives until here + | - temporary value is freed at the end of this statement | note: borrowed value must be valid for the anonymous lifetime #1 defined on the function body at 71:1... --> $DIR/wf-misc-methods-issue-28609.rs:71:1 @@ -108,4 +108,5 @@ LL | | } error: aborting due to 6 previous errors -For more information about this error, try `rustc --explain E0597`. +Some errors occurred: E0597, E0714. +For more information about an error, try `rustc --explain E0597`. From ea4d934c32e49bdcf7578e1bb147ce5f62ac5d38 Mon Sep 17 00:00:00 2001 From: "Felix S. Klock II" Date: Tue, 25 Sep 2018 16:06:28 +0200 Subject: [PATCH 2/3] Change the diagnostic number from 714 to 716. --- src/librustc_mir/diagnostics.rs | 4 ++-- src/librustc_mir/util/borrowck_errors.rs | 2 +- .../borrowck-borrow-from-temporary.nll.stderr | 4 ++-- .../borrowck-borrowed-uniq-rvalue-2.nll.stderr | 4 ++-- .../borrowck-borrowed-uniq-rvalue.nll.stderr | 4 ++-- .../promote-ref-mut-in-let-issue-46557.nll.stderr | 12 ++++++------ .../dont_promote_unstable_const_fn.nll.stderr | 8 ++++---- ..._promote_unstable_const_fn_cross_crate.nll.stderr | 6 +++--- .../const-eval/promoted_raw_ptr_ops.nll.stderr | 8 ++++---- .../const-eval/transmute-const-promotion.nll.stderr | 4 ++-- src/test/ui/issues/issue-36082.mir.stderr | 4 ++-- src/test/ui/issues/issue-36082.rs | 2 +- src/test/ui/issues/issue-46472.rs | 2 +- src/test/ui/issues/issue-46472.stderr | 4 ++-- src/test/ui/issues/issue-47184.rs | 2 +- src/test/ui/issues/issue-47184.stderr | 4 ++-- src/test/ui/nll/borrowed-temporary-error.rs | 2 +- src/test/ui/nll/borrowed-temporary-error.stderr | 6 +++--- src/test/ui/nll/borrowed-universal-error.rs | 2 +- src/test/ui/nll/borrowed-universal-error.stderr | 6 +++--- src/test/ui/nll/issue-52534-1.stderr | 4 ++-- src/test/ui/nll/return-ref-mut-issue-46557.rs | 2 +- src/test/ui/nll/return-ref-mut-issue-46557.stderr | 6 +++--- src/test/ui/nll/user-annotations/patterns.rs | 6 +++--- src/test/ui/nll/user-annotations/patterns.stderr | 8 ++++---- 25 files changed, 58 insertions(+), 58 deletions(-) diff --git a/src/librustc_mir/diagnostics.rs b/src/librustc_mir/diagnostics.rs index aac5fc5ed7e91..75745849290eb 100644 --- a/src/librustc_mir/diagnostics.rs +++ b/src/librustc_mir/diagnostics.rs @@ -2263,13 +2263,13 @@ lifetime, which would again violate the `&mut`-borrow's exclusive access. "##, -E0714: r##" +E0716: r##" This error indicates that a temporary value is being dropped while a borrow is still in active use. Erroneous code example: -```compile_fail,E0714 +```compile_fail,E0716 # #![feature(nll)] fn foo() -> i32 { 22 } fn bar(x: &i32) -> &i32 { x } diff --git a/src/librustc_mir/util/borrowck_errors.rs b/src/librustc_mir/util/borrowck_errors.rs index c78020a260979..2616d0cd9640b 100644 --- a/src/librustc_mir/util/borrowck_errors.rs +++ b/src/librustc_mir/util/borrowck_errors.rs @@ -739,7 +739,7 @@ pub trait BorrowckErrors<'cx>: Sized + Copy { let err = struct_span_err!( self, span, - E0714, + E0716, "temporary value dropped while borrowed{OGN}", OGN = o ); diff --git a/src/test/ui/borrowck/borrowck-borrow-from-temporary.nll.stderr b/src/test/ui/borrowck/borrowck-borrow-from-temporary.nll.stderr index 894eb4cc4a2ee..fe2bc0ca79b23 100644 --- a/src/test/ui/borrowck/borrowck-borrow-from-temporary.nll.stderr +++ b/src/test/ui/borrowck/borrowck-borrow-from-temporary.nll.stderr @@ -1,4 +1,4 @@ -error[E0714]: temporary value dropped while borrowed +error[E0716]: temporary value dropped while borrowed --> $DIR/borrowck-borrow-from-temporary.rs:19:24 | LL | let &Foo(ref x) = &id(Foo(3)); //~ ERROR borrowed value does not live long enough @@ -15,4 +15,4 @@ LL | fn foo<'a>() -> &'a isize { error: aborting due to previous error -For more information about this error, try `rustc --explain E0714`. +For more information about this error, try `rustc --explain E0716`. diff --git a/src/test/ui/borrowck/borrowck-borrowed-uniq-rvalue-2.nll.stderr b/src/test/ui/borrowck/borrowck-borrowed-uniq-rvalue-2.nll.stderr index 1b5a1f4b29bf0..80c71b8e28203 100644 --- a/src/test/ui/borrowck/borrowck-borrowed-uniq-rvalue-2.nll.stderr +++ b/src/test/ui/borrowck/borrowck-borrowed-uniq-rvalue-2.nll.stderr @@ -1,4 +1,4 @@ -error[E0714]: temporary value dropped while borrowed +error[E0716]: temporary value dropped while borrowed --> $DIR/borrowck-borrowed-uniq-rvalue-2.rs:32:20 | LL | let x = defer(&vec!["Goodbye", "world!"]); @@ -13,4 +13,4 @@ LL | x.x[0]; error: aborting due to previous error -For more information about this error, try `rustc --explain E0714`. +For more information about this error, try `rustc --explain E0716`. diff --git a/src/test/ui/borrowck/borrowck-borrowed-uniq-rvalue.nll.stderr b/src/test/ui/borrowck/borrowck-borrowed-uniq-rvalue.nll.stderr index 9236e9e228833..0c71ac793df75 100644 --- a/src/test/ui/borrowck/borrowck-borrowed-uniq-rvalue.nll.stderr +++ b/src/test/ui/borrowck/borrowck-borrowed-uniq-rvalue.nll.stderr @@ -1,4 +1,4 @@ -error[E0714]: temporary value dropped while borrowed +error[E0716]: temporary value dropped while borrowed --> $DIR/borrowck-borrowed-uniq-rvalue.rs:20:28 | LL | buggy_map.insert(42, &*Box::new(1)); //~ ERROR borrowed value does not live long enough @@ -13,4 +13,4 @@ LL | buggy_map.insert(43, &*tmp); error: aborting due to previous error -For more information about this error, try `rustc --explain E0714`. +For more information about this error, try `rustc --explain E0716`. diff --git a/src/test/ui/borrowck/promote-ref-mut-in-let-issue-46557.nll.stderr b/src/test/ui/borrowck/promote-ref-mut-in-let-issue-46557.nll.stderr index a4fc91f208df4..101fb530a9101 100644 --- a/src/test/ui/borrowck/promote-ref-mut-in-let-issue-46557.nll.stderr +++ b/src/test/ui/borrowck/promote-ref-mut-in-let-issue-46557.nll.stderr @@ -1,4 +1,4 @@ -error[E0714]: temporary value dropped while borrowed +error[E0716]: temporary value dropped while borrowed --> $DIR/promote-ref-mut-in-let-issue-46557.rs:15:21 | LL | let ref mut x = 1234543; //~ ERROR @@ -9,7 +9,7 @@ LL | } | = note: borrowed value must be valid for the static lifetime... -error[E0714]: temporary value dropped while borrowed +error[E0716]: temporary value dropped while borrowed --> $DIR/promote-ref-mut-in-let-issue-46557.rs:20:25 | LL | let (ref mut x, ) = (1234543, ); //~ ERROR @@ -20,7 +20,7 @@ LL | } | = note: borrowed value must be valid for the static lifetime... -error[E0714]: temporary value dropped while borrowed +error[E0716]: temporary value dropped while borrowed --> $DIR/promote-ref-mut-in-let-issue-46557.rs:25:11 | LL | match 1234543 { @@ -31,7 +31,7 @@ LL | } | = note: borrowed value must be valid for the static lifetime... -error[E0714]: temporary value dropped while borrowed +error[E0716]: temporary value dropped while borrowed --> $DIR/promote-ref-mut-in-let-issue-46557.rs:31:11 | LL | match (123443,) { @@ -42,7 +42,7 @@ LL | } | = note: borrowed value must be valid for the static lifetime... -error[E0714]: temporary value dropped while borrowed +error[E0716]: temporary value dropped while borrowed --> $DIR/promote-ref-mut-in-let-issue-46557.rs:37:10 | LL | &mut 1234543 //~ ERROR @@ -54,4 +54,4 @@ LL | } error: aborting due to 5 previous errors -For more information about this error, try `rustc --explain E0714`. +For more information about this error, try `rustc --explain E0716`. diff --git a/src/test/ui/consts/const-eval/dont_promote_unstable_const_fn.nll.stderr b/src/test/ui/consts/const-eval/dont_promote_unstable_const_fn.nll.stderr index e257fdb31e767..fe7187af5f598 100644 --- a/src/test/ui/consts/const-eval/dont_promote_unstable_const_fn.nll.stderr +++ b/src/test/ui/consts/const-eval/dont_promote_unstable_const_fn.nll.stderr @@ -6,7 +6,7 @@ LL | const fn bar() -> u32 { foo() } //~ ERROR `foo` is not yet stable as a cons | = help: in Nightly builds, add `#![feature(foo)]` to the crate attributes to enable -error[E0714]: temporary value dropped while borrowed +error[E0716]: temporary value dropped while borrowed --> $DIR/dont_promote_unstable_const_fn.rs:28:28 | LL | let _: &'static u32 = &foo(); //~ ERROR does not live long enough @@ -16,7 +16,7 @@ LL | } | = note: borrowed value must be valid for the static lifetime... -error[E0714]: temporary value dropped while borrowed +error[E0716]: temporary value dropped while borrowed --> $DIR/dont_promote_unstable_const_fn.rs:32:28 | LL | let _: &'static u32 = &meh(); //~ ERROR does not live long enough @@ -27,7 +27,7 @@ LL | } | = note: borrowed value must be valid for the static lifetime... -error[E0714]: temporary value dropped while borrowed +error[E0716]: temporary value dropped while borrowed --> $DIR/dont_promote_unstable_const_fn.rs:33:26 | LL | let x: &'static _ = &std::time::Duration::from_millis(42).subsec_millis(); @@ -40,4 +40,4 @@ LL | } error: aborting due to 4 previous errors -For more information about this error, try `rustc --explain E0714`. +For more information about this error, try `rustc --explain E0716`. diff --git a/src/test/ui/consts/const-eval/dont_promote_unstable_const_fn_cross_crate.nll.stderr b/src/test/ui/consts/const-eval/dont_promote_unstable_const_fn_cross_crate.nll.stderr index 6ec0733640961..c4feb1129014c 100644 --- a/src/test/ui/consts/const-eval/dont_promote_unstable_const_fn_cross_crate.nll.stderr +++ b/src/test/ui/consts/const-eval/dont_promote_unstable_const_fn_cross_crate.nll.stderr @@ -1,4 +1,4 @@ -error[E0714]: temporary value dropped while borrowed +error[E0716]: temporary value dropped while borrowed --> $DIR/dont_promote_unstable_const_fn_cross_crate.rs:18:28 | LL | let _: &'static u32 = &foo(); //~ ERROR does not live long enough @@ -9,7 +9,7 @@ LL | } | = note: borrowed value must be valid for the static lifetime... -error[E0714]: temporary value dropped while borrowed +error[E0716]: temporary value dropped while borrowed --> $DIR/dont_promote_unstable_const_fn_cross_crate.rs:19:29 | LL | let _x: &'static u32 = &foo(); //~ ERROR does not live long enough @@ -21,4 +21,4 @@ LL | } error: aborting due to 2 previous errors -For more information about this error, try `rustc --explain E0714`. +For more information about this error, try `rustc --explain E0716`. diff --git a/src/test/ui/consts/const-eval/promoted_raw_ptr_ops.nll.stderr b/src/test/ui/consts/const-eval/promoted_raw_ptr_ops.nll.stderr index acc6104d9e21c..bc8a99f55483f 100644 --- a/src/test/ui/consts/const-eval/promoted_raw_ptr_ops.nll.stderr +++ b/src/test/ui/consts/const-eval/promoted_raw_ptr_ops.nll.stderr @@ -1,4 +1,4 @@ -error[E0714]: temporary value dropped while borrowed +error[E0716]: temporary value dropped while borrowed --> $DIR/promoted_raw_ptr_ops.rs:14:29 | LL | let x: &'static bool = &(42 as *const i32 == 43 as *const i32); @@ -9,7 +9,7 @@ LL | } | = note: borrowed value must be valid for the static lifetime... -error[E0714]: temporary value dropped while borrowed +error[E0716]: temporary value dropped while borrowed --> $DIR/promoted_raw_ptr_ops.rs:16:30 | LL | let y: &'static usize = &(&1 as *const i32 as usize + 1); //~ ERROR does not live long enough @@ -20,7 +20,7 @@ LL | } | = note: borrowed value must be valid for the static lifetime... -error[E0714]: temporary value dropped while borrowed +error[E0716]: temporary value dropped while borrowed --> $DIR/promoted_raw_ptr_ops.rs:17:28 | LL | let z: &'static i32 = &(unsafe { *(42 as *const i32) }); //~ ERROR does not live long enough @@ -32,4 +32,4 @@ LL | } error: aborting due to 3 previous errors -For more information about this error, try `rustc --explain E0714`. +For more information about this error, try `rustc --explain E0716`. diff --git a/src/test/ui/consts/const-eval/transmute-const-promotion.nll.stderr b/src/test/ui/consts/const-eval/transmute-const-promotion.nll.stderr index e11f589b1052d..cf3678e7d60dd 100644 --- a/src/test/ui/consts/const-eval/transmute-const-promotion.nll.stderr +++ b/src/test/ui/consts/const-eval/transmute-const-promotion.nll.stderr @@ -1,4 +1,4 @@ -error[E0714]: temporary value dropped while borrowed +error[E0716]: temporary value dropped while borrowed --> $DIR/transmute-const-promotion.rs:16:37 | LL | let x: &'static u32 = unsafe { &mem::transmute(3.0f32) }; @@ -11,4 +11,4 @@ LL | } error: aborting due to previous error -For more information about this error, try `rustc --explain E0714`. +For more information about this error, try `rustc --explain E0716`. diff --git a/src/test/ui/issues/issue-36082.mir.stderr b/src/test/ui/issues/issue-36082.mir.stderr index 4a481da6522ce..7fa7cee0aec1e 100644 --- a/src/test/ui/issues/issue-36082.mir.stderr +++ b/src/test/ui/issues/issue-36082.mir.stderr @@ -1,4 +1,4 @@ -error[E0714]: temporary value dropped while borrowed +error[E0716]: temporary value dropped while borrowed --> $DIR/issue-36082.rs:23:19 | LL | let val: &_ = x.borrow().0; @@ -13,4 +13,4 @@ LL | println!("{}", val); error: aborting due to previous error -For more information about this error, try `rustc --explain E0714`. +For more information about this error, try `rustc --explain E0716`. diff --git a/src/test/ui/issues/issue-36082.rs b/src/test/ui/issues/issue-36082.rs index 018d5bf091885..b8a498a4dc85c 100644 --- a/src/test/ui/issues/issue-36082.rs +++ b/src/test/ui/issues/issue-36082.rs @@ -25,7 +25,7 @@ fn main() { //[ast]~| NOTE temporary value dropped here while still borrowed //[ast]~| NOTE temporary value does not live long enough //[ast]~| NOTE consider using a `let` binding to increase its lifetime - //[mir]~^^^^^ ERROR temporary value dropped while borrowed [E0714] + //[mir]~^^^^^ ERROR temporary value dropped while borrowed [E0716] //[mir]~| NOTE temporary value is freed at the end of this statement //[mir]~| NOTE creates a temporary which is freed while still in use //[mir]~| NOTE consider using a `let` binding to create a longer lived value diff --git a/src/test/ui/issues/issue-46472.rs b/src/test/ui/issues/issue-46472.rs index 79e805c5356c5..84e30a4d29167 100644 --- a/src/test/ui/issues/issue-46472.rs +++ b/src/test/ui/issues/issue-46472.rs @@ -13,7 +13,7 @@ fn bar<'a>() -> &'a mut u32 { &mut 4 //~^ ERROR borrowed value does not live long enough (Ast) [E0597] - //~| ERROR temporary value dropped while borrowed (Mir) [E0714] + //~| ERROR temporary value dropped while borrowed (Mir) [E0716] } fn main() { } diff --git a/src/test/ui/issues/issue-46472.stderr b/src/test/ui/issues/issue-46472.stderr index 39c4e091fd2a1..4c0e6544a9393 100644 --- a/src/test/ui/issues/issue-46472.stderr +++ b/src/test/ui/issues/issue-46472.stderr @@ -13,7 +13,7 @@ note: borrowed value must be valid for the lifetime 'a as defined on the functio LL | fn bar<'a>() -> &'a mut u32 { | ^^ -error[E0714]: temporary value dropped while borrowed (Mir) +error[E0716]: temporary value dropped while borrowed (Mir) --> $DIR/issue-46472.rs:14:10 | LL | &mut 4 @@ -30,5 +30,5 @@ LL | fn bar<'a>() -> &'a mut u32 { error: aborting due to 2 previous errors -Some errors occurred: E0597, E0714. +Some errors occurred: E0597, E0716. For more information about an error, try `rustc --explain E0597`. diff --git a/src/test/ui/issues/issue-47184.rs b/src/test/ui/issues/issue-47184.rs index fbf67a3b4fc08..95d9d858ecdb0 100644 --- a/src/test/ui/issues/issue-47184.rs +++ b/src/test/ui/issues/issue-47184.rs @@ -12,5 +12,5 @@ fn main() { let _vec: Vec<&'static String> = vec![&String::new()]; - //~^ ERROR temporary value dropped while borrowed [E0714] + //~^ ERROR temporary value dropped while borrowed [E0716] } diff --git a/src/test/ui/issues/issue-47184.stderr b/src/test/ui/issues/issue-47184.stderr index 1a4b7ae16bffd..4a8e9255723cc 100644 --- a/src/test/ui/issues/issue-47184.stderr +++ b/src/test/ui/issues/issue-47184.stderr @@ -1,4 +1,4 @@ -error[E0714]: temporary value dropped while borrowed +error[E0716]: temporary value dropped while borrowed --> $DIR/issue-47184.rs:14:44 | LL | let _vec: Vec<&'static String> = vec![&String::new()]; @@ -10,4 +10,4 @@ LL | let _vec: Vec<&'static String> = vec![&String::new()]; error: aborting due to previous error -For more information about this error, try `rustc --explain E0714`. +For more information about this error, try `rustc --explain E0716`. diff --git a/src/test/ui/nll/borrowed-temporary-error.rs b/src/test/ui/nll/borrowed-temporary-error.rs index d0b53359cd0e4..3bfb319ff318a 100644 --- a/src/test/ui/nll/borrowed-temporary-error.rs +++ b/src/test/ui/nll/borrowed-temporary-error.rs @@ -18,7 +18,7 @@ fn main() { let x = gimme({ let v = 22; &(v,) - //~^ ERROR temporary value dropped while borrowed [E0714] + //~^ ERROR temporary value dropped while borrowed [E0716] }); println!("{:?}", x); } diff --git a/src/test/ui/nll/borrowed-temporary-error.stderr b/src/test/ui/nll/borrowed-temporary-error.stderr index a929914d8df71..7f62f2ee52a9e 100644 --- a/src/test/ui/nll/borrowed-temporary-error.stderr +++ b/src/test/ui/nll/borrowed-temporary-error.stderr @@ -1,9 +1,9 @@ -error[E0714]: temporary value dropped while borrowed +error[E0716]: temporary value dropped while borrowed --> $DIR/borrowed-temporary-error.rs:20:10 | LL | &(v,) | ^^^^ creates a temporary which is freed while still in use -LL | //~^ ERROR temporary value dropped while borrowed [E0714] +LL | //~^ ERROR temporary value dropped while borrowed [E0716] LL | }); | - temporary value is freed at the end of this statement LL | println!("{:?}", x); @@ -13,4 +13,4 @@ LL | println!("{:?}", x); error: aborting due to previous error -For more information about this error, try `rustc --explain E0714`. +For more information about this error, try `rustc --explain E0716`. diff --git a/src/test/ui/nll/borrowed-universal-error.rs b/src/test/ui/nll/borrowed-universal-error.rs index 5ea91d3618afd..016a4f49e504a 100644 --- a/src/test/ui/nll/borrowed-universal-error.rs +++ b/src/test/ui/nll/borrowed-universal-error.rs @@ -18,7 +18,7 @@ fn gimme(x: &(u32,)) -> &u32 { fn foo<'a>(x: &'a (u32,)) -> &'a u32 { let v = 22; gimme(&(v,)) - //~^ ERROR temporary value dropped while borrowed [E0714] + //~^ ERROR temporary value dropped while borrowed [E0716] } fn main() {} diff --git a/src/test/ui/nll/borrowed-universal-error.stderr b/src/test/ui/nll/borrowed-universal-error.stderr index a65a396d2ab64..d7ab5cec4a84a 100644 --- a/src/test/ui/nll/borrowed-universal-error.stderr +++ b/src/test/ui/nll/borrowed-universal-error.stderr @@ -1,9 +1,9 @@ -error[E0714]: temporary value dropped while borrowed +error[E0716]: temporary value dropped while borrowed --> $DIR/borrowed-universal-error.rs:20:12 | LL | gimme(&(v,)) | ^^^^ creates a temporary which is freed while still in use -LL | //~^ ERROR temporary value dropped while borrowed [E0714] +LL | //~^ ERROR temporary value dropped while borrowed [E0716] LL | } | - temporary value is freed at the end of this statement | @@ -15,4 +15,4 @@ LL | fn foo<'a>(x: &'a (u32,)) -> &'a u32 { error: aborting due to previous error -For more information about this error, try `rustc --explain E0714`. +For more information about this error, try `rustc --explain E0716`. diff --git a/src/test/ui/nll/issue-52534-1.stderr b/src/test/ui/nll/issue-52534-1.stderr index 9bb32c3ed3dc7..0d071915a3b89 100644 --- a/src/test/ui/nll/issue-52534-1.stderr +++ b/src/test/ui/nll/issue-52534-1.stderr @@ -52,7 +52,7 @@ LL | } = note: functions cannot return a borrow to data owned within the function's scope, functions can only return borrows to data passed as arguments = note: to learn more, visit -error[E0714]: temporary value dropped while borrowed +error[E0716]: temporary value dropped while borrowed --> $DIR/issue-52534-1.rs:30:6 | LL | &&x @@ -137,5 +137,5 @@ LL | } error: aborting due to 8 previous errors -Some errors occurred: E0597, E0714. +Some errors occurred: E0597, E0716. For more information about an error, try `rustc --explain E0597`. diff --git a/src/test/ui/nll/return-ref-mut-issue-46557.rs b/src/test/ui/nll/return-ref-mut-issue-46557.rs index 82222530335e7..e598147bdab77 100644 --- a/src/test/ui/nll/return-ref-mut-issue-46557.rs +++ b/src/test/ui/nll/return-ref-mut-issue-46557.rs @@ -14,7 +14,7 @@ #![allow(dead_code)] fn gimme_static_mut() -> &'static mut u32 { - let ref mut x = 1234543; //~ ERROR temporary value dropped while borrowed [E0714] + let ref mut x = 1234543; //~ ERROR temporary value dropped while borrowed [E0716] x } diff --git a/src/test/ui/nll/return-ref-mut-issue-46557.stderr b/src/test/ui/nll/return-ref-mut-issue-46557.stderr index 1e8224c8ddbd5..368cc67747185 100644 --- a/src/test/ui/nll/return-ref-mut-issue-46557.stderr +++ b/src/test/ui/nll/return-ref-mut-issue-46557.stderr @@ -1,7 +1,7 @@ -error[E0714]: temporary value dropped while borrowed +error[E0716]: temporary value dropped while borrowed --> $DIR/return-ref-mut-issue-46557.rs:17:21 | -LL | let ref mut x = 1234543; //~ ERROR temporary value dropped while borrowed [E0714] +LL | let ref mut x = 1234543; //~ ERROR temporary value dropped while borrowed [E0716] | ^^^^^^^ creates a temporary which is freed while still in use LL | x LL | } @@ -11,4 +11,4 @@ LL | } error: aborting due to previous error -For more information about this error, try `rustc --explain E0714`. +For more information about this error, try `rustc --explain E0716`. diff --git a/src/test/ui/nll/user-annotations/patterns.rs b/src/test/ui/nll/user-annotations/patterns.rs index 971a737702490..e3bac513fa874 100644 --- a/src/test/ui/nll/user-annotations/patterns.rs +++ b/src/test/ui/nll/user-annotations/patterns.rs @@ -51,13 +51,13 @@ fn underscore_with_initializer() { let _: &'static u32 = &x; //~ ERROR let _: Vec<&'static String> = vec![&String::new()]; - //~^ ERROR temporary value dropped while borrowed [E0714] + //~^ ERROR temporary value dropped while borrowed [E0716] let (_, a): (Vec<&'static String>, _) = (vec![&String::new()], 44); - //~^ ERROR temporary value dropped while borrowed [E0714] + //~^ ERROR temporary value dropped while borrowed [E0716] let (_a, b): (Vec<&'static String>, _) = (vec![&String::new()], 44); - //~^ ERROR temporary value dropped while borrowed [E0714] + //~^ ERROR temporary value dropped while borrowed [E0716] } fn pair_underscores_with_initializer() { diff --git a/src/test/ui/nll/user-annotations/patterns.stderr b/src/test/ui/nll/user-annotations/patterns.stderr index 0e3109413bdf0..b01dc65fc5f9a 100644 --- a/src/test/ui/nll/user-annotations/patterns.stderr +++ b/src/test/ui/nll/user-annotations/patterns.stderr @@ -40,7 +40,7 @@ LL | } | = note: borrowed value must be valid for the static lifetime... -error[E0714]: temporary value dropped while borrowed +error[E0716]: temporary value dropped while borrowed --> $DIR/patterns.rs:53:41 | LL | let _: Vec<&'static String> = vec![&String::new()]; @@ -50,7 +50,7 @@ LL | let _: Vec<&'static String> = vec![&String::new()]; | = note: borrowed value must be valid for the static lifetime... -error[E0714]: temporary value dropped while borrowed +error[E0716]: temporary value dropped while borrowed --> $DIR/patterns.rs:56:52 | LL | let (_, a): (Vec<&'static String>, _) = (vec![&String::new()], 44); @@ -60,7 +60,7 @@ LL | let (_, a): (Vec<&'static String>, _) = (vec![&String::new()], 44); | = note: borrowed value must be valid for the static lifetime... -error[E0714]: temporary value dropped while borrowed +error[E0716]: temporary value dropped while borrowed --> $DIR/patterns.rs:59:53 | LL | let (_a, b): (Vec<&'static String>, _) = (vec![&String::new()], 44); @@ -140,5 +140,5 @@ LL | let (y, _z): (&'static u32, u32) = (x, 44); //~ ERROR error: aborting due to 14 previous errors -Some errors occurred: E0597, E0714. +Some errors occurred: E0597, E0716. For more information about an error, try `rustc --explain E0597`. From 2af199d58e10374d907d26b671c8b1c2e84ebf9a Mon Sep 17 00:00:00 2001 From: Mikhail Modin Date: Tue, 25 Sep 2018 16:24:20 +0100 Subject: [PATCH 3/3] Update E0714 to E0716 in tests output --- .../consts/const-eval/union_promotion.nll.stderr | 4 ++-- .../ui/consts/const-int-conversion.nll.stderr | 16 ++++++++-------- .../ui/consts/const-int-overflowing.nll.stderr | 8 ++++---- src/test/ui/consts/const-int-rotate.nll.stderr | 6 +++--- src/test/ui/consts/const-int-sign.nll.stderr | 6 +++--- src/test/ui/consts/const-int-wrapping.nll.stderr | 12 ++++++------ .../consts/min_const_fn/min_const_fn.nll.stderr | 4 ++-- .../min_const_fn/min_const_fn_dyn.nll.stderr | 4 ++-- src/test/ui/issues/issue-11681.nll.stderr | 4 ++-- src/test/ui/issues/issue-17545.nll.stderr | 4 ++-- .../issue-17718-constants-not-static.nll.stderr | 4 ++-- src/test/ui/issues/issue-27592.nll.stderr | 6 +++--- src/test/ui/issues/issue-30438-a.nll.stderr | 4 ++-- src/test/ui/issues/issue-30438-b.nll.stderr | 4 ++-- src/test/ui/issues/issue-36082.ast.nll.stderr | 4 ++-- src/test/ui/issues/issue-44373.nll.stderr | 4 ++-- src/test/ui/issues/issue-52049.nll.stderr | 4 ++-- .../lifetimes/borrowck-let-suggestion.nll.stderr | 4 ++-- .../ui/regions/regions-creating-enums.nll.stderr | 6 +++--- ...gions-free-region-ordering-caller1.nll.stderr | 4 ++-- ...lifetime-of-struct-or-enum-variant.nll.stderr | 6 +++--- .../ui/regions/regions-ref-in-fn-arg.nll.stderr | 6 +++--- src/test/ui/regions/regions-ret.nll.stderr | 4 ++-- ...regions-return-stack-allocated-vec.nll.stderr | 4 ++-- .../regions-var-type-out-of-scope.nll.stderr | 4 ++-- .../borrowck-let-suggestion-suffixes.nll.stderr | 8 ++++---- .../ui/span/borrowck-ref-into-rvalue.nll.stderr | 8 ++++---- src/test/ui/span/issue-15480.nll.stderr | 4 ++-- ...ons-close-over-borrowed-ref-in-obj.nll.stderr | 4 ++-- src/test/ui/span/slice-borrow.nll.stderr | 4 ++-- src/test/ui/static/static-drop-scope.nll.stderr | 6 +++--- .../static/static-reference-to-fn-2.nll.stderr | 10 +++++----- .../ui/static/static-region-bound.nll.stderr | 4 ++-- .../ui/wf/wf-misc-methods-issue-28609.nll.stderr | 10 +++++----- 34 files changed, 97 insertions(+), 97 deletions(-) diff --git a/src/test/ui/consts/const-eval/union_promotion.nll.stderr b/src/test/ui/consts/const-eval/union_promotion.nll.stderr index 9437cacd7734c..afc5c462c4633 100644 --- a/src/test/ui/consts/const-eval/union_promotion.nll.stderr +++ b/src/test/ui/consts/const-eval/union_promotion.nll.stderr @@ -1,4 +1,4 @@ -error[E0714]: temporary value dropped while borrowed +error[E0716]: temporary value dropped while borrowed --> $DIR/union_promotion.rs:19:29 | LL | let x: &'static bool = &unsafe { //~ borrowed value does not live long enough @@ -13,4 +13,4 @@ LL | } error: aborting due to previous error -For more information about this error, try `rustc --explain E0714`. +For more information about this error, try `rustc --explain E0716`. diff --git a/src/test/ui/consts/const-int-conversion.nll.stderr b/src/test/ui/consts/const-int-conversion.nll.stderr index 922905477f380..8fe6816f0b21a 100644 --- a/src/test/ui/consts/const-int-conversion.nll.stderr +++ b/src/test/ui/consts/const-int-conversion.nll.stderr @@ -1,4 +1,4 @@ -error[E0714]: temporary value dropped while borrowed +error[E0716]: temporary value dropped while borrowed --> $DIR/const-int-conversion.rs:14:28 | LL | let x: &'static i32 = &(5_i32.reverse_bits()); @@ -9,7 +9,7 @@ LL | } | = note: borrowed value must be valid for the static lifetime... -error[E0714]: temporary value dropped while borrowed +error[E0716]: temporary value dropped while borrowed --> $DIR/const-int-conversion.rs:16:28 | LL | let y: &'static i32 = &(i32::from_be_bytes([0x12, 0x34, 0x56, 0x78])); @@ -20,7 +20,7 @@ LL | } | = note: borrowed value must be valid for the static lifetime... -error[E0714]: temporary value dropped while borrowed +error[E0716]: temporary value dropped while borrowed --> $DIR/const-int-conversion.rs:18:28 | LL | let z: &'static i32 = &(i32::from_le_bytes([0x12, 0x34, 0x56, 0x78])); @@ -31,7 +31,7 @@ LL | } | = note: borrowed value must be valid for the static lifetime... -error[E0714]: temporary value dropped while borrowed +error[E0716]: temporary value dropped while borrowed --> $DIR/const-int-conversion.rs:20:28 | LL | let a: &'static i32 = &(i32::from_be(i32::from_ne_bytes([0x80, 0, 0, 0]))); @@ -42,7 +42,7 @@ LL | } | = note: borrowed value must be valid for the static lifetime... -error[E0714]: temporary value dropped while borrowed +error[E0716]: temporary value dropped while borrowed --> $DIR/const-int-conversion.rs:22:29 | LL | let b: &'static [u8] = &(0x12_34_56_78_i32.to_be_bytes()); @@ -53,7 +53,7 @@ LL | } | = note: borrowed value must be valid for the static lifetime... -error[E0714]: temporary value dropped while borrowed +error[E0716]: temporary value dropped while borrowed --> $DIR/const-int-conversion.rs:24:29 | LL | let c: &'static [u8] = &(0x12_34_56_78_i32.to_le_bytes()); @@ -64,7 +64,7 @@ LL | } | = note: borrowed value must be valid for the static lifetime... -error[E0714]: temporary value dropped while borrowed +error[E0716]: temporary value dropped while borrowed --> $DIR/const-int-conversion.rs:26:29 | LL | let d: &'static [u8] = &(i32::min_value().to_be().to_ne_bytes()); @@ -77,4 +77,4 @@ LL | } error: aborting due to 7 previous errors -For more information about this error, try `rustc --explain E0714`. +For more information about this error, try `rustc --explain E0716`. diff --git a/src/test/ui/consts/const-int-overflowing.nll.stderr b/src/test/ui/consts/const-int-overflowing.nll.stderr index fd420658c7ad4..3f4a7562ce9b0 100644 --- a/src/test/ui/consts/const-int-overflowing.nll.stderr +++ b/src/test/ui/consts/const-int-overflowing.nll.stderr @@ -1,4 +1,4 @@ -error[E0714]: temporary value dropped while borrowed +error[E0716]: temporary value dropped while borrowed --> $DIR/const-int-overflowing.rs:12:36 | LL | let x: &'static (i32, bool) = &(5_i32.overflowing_add(3)); //~ ERROR does not live long enough @@ -9,7 +9,7 @@ LL | } | = note: borrowed value must be valid for the static lifetime... -error[E0714]: temporary value dropped while borrowed +error[E0716]: temporary value dropped while borrowed --> $DIR/const-int-overflowing.rs:13:36 | LL | let y: &'static (i32, bool) = &(5_i32.overflowing_sub(3)); //~ ERROR does not live long enough @@ -20,7 +20,7 @@ LL | } | = note: borrowed value must be valid for the static lifetime... -error[E0714]: temporary value dropped while borrowed +error[E0716]: temporary value dropped while borrowed --> $DIR/const-int-overflowing.rs:14:36 | LL | let z: &'static (i32, bool) = &(5_i32.overflowing_mul(3)); //~ ERROR does not live long enough @@ -32,4 +32,4 @@ LL | } error: aborting due to 3 previous errors -For more information about this error, try `rustc --explain E0714`. +For more information about this error, try `rustc --explain E0716`. diff --git a/src/test/ui/consts/const-int-rotate.nll.stderr b/src/test/ui/consts/const-int-rotate.nll.stderr index d66017a289bca..8a0c49a6d8451 100644 --- a/src/test/ui/consts/const-int-rotate.nll.stderr +++ b/src/test/ui/consts/const-int-rotate.nll.stderr @@ -1,4 +1,4 @@ -error[E0714]: temporary value dropped while borrowed +error[E0716]: temporary value dropped while borrowed --> $DIR/const-int-rotate.rs:12:28 | LL | let x: &'static i32 = &(5_i32.rotate_left(3)); //~ ERROR does not live long enough @@ -9,7 +9,7 @@ LL | } | = note: borrowed value must be valid for the static lifetime... -error[E0714]: temporary value dropped while borrowed +error[E0716]: temporary value dropped while borrowed --> $DIR/const-int-rotate.rs:13:28 | LL | let y: &'static i32 = &(5_i32.rotate_right(3)); //~ ERROR does not live long enough @@ -21,4 +21,4 @@ LL | } error: aborting due to 2 previous errors -For more information about this error, try `rustc --explain E0714`. +For more information about this error, try `rustc --explain E0716`. diff --git a/src/test/ui/consts/const-int-sign.nll.stderr b/src/test/ui/consts/const-int-sign.nll.stderr index 62a2b111ed9c3..53bcba8c77e54 100644 --- a/src/test/ui/consts/const-int-sign.nll.stderr +++ b/src/test/ui/consts/const-int-sign.nll.stderr @@ -1,4 +1,4 @@ -error[E0714]: temporary value dropped while borrowed +error[E0716]: temporary value dropped while borrowed --> $DIR/const-int-sign.rs:12:29 | LL | let x: &'static bool = &(5_i32.is_negative()); //~ ERROR does not live long enough @@ -9,7 +9,7 @@ LL | } | = note: borrowed value must be valid for the static lifetime... -error[E0714]: temporary value dropped while borrowed +error[E0716]: temporary value dropped while borrowed --> $DIR/const-int-sign.rs:13:29 | LL | let y: &'static bool = &(5_i32.is_positive()); //~ ERROR does not live long enough @@ -21,4 +21,4 @@ LL | } error: aborting due to 2 previous errors -For more information about this error, try `rustc --explain E0714`. +For more information about this error, try `rustc --explain E0716`. diff --git a/src/test/ui/consts/const-int-wrapping.nll.stderr b/src/test/ui/consts/const-int-wrapping.nll.stderr index 4c6c98188dccb..3fd83090a4df5 100644 --- a/src/test/ui/consts/const-int-wrapping.nll.stderr +++ b/src/test/ui/consts/const-int-wrapping.nll.stderr @@ -1,4 +1,4 @@ -error[E0714]: temporary value dropped while borrowed +error[E0716]: temporary value dropped while borrowed --> $DIR/const-int-wrapping.rs:12:28 | LL | let x: &'static i32 = &(5_i32.wrapping_add(3)); //~ ERROR does not live long enough @@ -9,7 +9,7 @@ LL | } | = note: borrowed value must be valid for the static lifetime... -error[E0714]: temporary value dropped while borrowed +error[E0716]: temporary value dropped while borrowed --> $DIR/const-int-wrapping.rs:13:28 | LL | let y: &'static i32 = &(5_i32.wrapping_sub(3)); //~ ERROR does not live long enough @@ -20,7 +20,7 @@ LL | } | = note: borrowed value must be valid for the static lifetime... -error[E0714]: temporary value dropped while borrowed +error[E0716]: temporary value dropped while borrowed --> $DIR/const-int-wrapping.rs:14:28 | LL | let z: &'static i32 = &(5_i32.wrapping_mul(3)); //~ ERROR does not live long enough @@ -31,7 +31,7 @@ LL | } | = note: borrowed value must be valid for the static lifetime... -error[E0714]: temporary value dropped while borrowed +error[E0716]: temporary value dropped while borrowed --> $DIR/const-int-wrapping.rs:15:28 | LL | let a: &'static i32 = &(5_i32.wrapping_shl(3)); //~ ERROR does not live long enough @@ -42,7 +42,7 @@ LL | } | = note: borrowed value must be valid for the static lifetime... -error[E0714]: temporary value dropped while borrowed +error[E0716]: temporary value dropped while borrowed --> $DIR/const-int-wrapping.rs:16:28 | LL | let b: &'static i32 = &(5_i32.wrapping_shr(3)); //~ ERROR does not live long enough @@ -54,4 +54,4 @@ LL | } error: aborting due to 5 previous errors -For more information about this error, try `rustc --explain E0714`. +For more information about this error, try `rustc --explain E0716`. diff --git a/src/test/ui/consts/min_const_fn/min_const_fn.nll.stderr b/src/test/ui/consts/min_const_fn/min_const_fn.nll.stderr index d79fd6571192e..715884d517512 100644 --- a/src/test/ui/consts/min_const_fn/min_const_fn.nll.stderr +++ b/src/test/ui/consts/min_const_fn/min_const_fn.nll.stderr @@ -190,7 +190,7 @@ error: trait bounds other than `Sized` on const fn parameters are unstable LL | const fn no_dyn_trait_ret() -> &'static dyn std::fmt::Debug { &() } | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -error[E0714]: temporary value dropped while borrowed +error[E0716]: temporary value dropped while borrowed --> $DIR/min_const_fn.rs:144:64 | LL | const fn no_dyn_trait_ret() -> &'static dyn std::fmt::Debug { &() } @@ -220,5 +220,5 @@ LL | const fn no_fn_ptrs2() -> fn() { fn foo() {} foo } error: aborting due to 36 previous errors -Some errors occurred: E0493, E0714. +Some errors occurred: E0493, E0716. For more information about an error, try `rustc --explain E0493`. diff --git a/src/test/ui/consts/min_const_fn/min_const_fn_dyn.nll.stderr b/src/test/ui/consts/min_const_fn/min_const_fn_dyn.nll.stderr index 8d8fe7cfbebf6..9fc38e9e1f36e 100644 --- a/src/test/ui/consts/min_const_fn/min_const_fn_dyn.nll.stderr +++ b/src/test/ui/consts/min_const_fn/min_const_fn_dyn.nll.stderr @@ -10,7 +10,7 @@ error: trait bounds other than `Sized` on const fn parameters are unstable LL | const fn no_inner_dyn_trait_ret() -> Hide { Hide(HasDyn { field: &0 }) } | ^^ -error[E0714]: temporary value dropped while borrowed +error[E0716]: temporary value dropped while borrowed --> $DIR/min_const_fn_dyn.rs:24:67 | LL | const fn no_inner_dyn_trait_ret() -> Hide { Hide(HasDyn { field: &0 }) } @@ -22,4 +22,4 @@ LL | const fn no_inner_dyn_trait_ret() -> Hide { Hide(HasDyn { field: &0 }) } error: aborting due to 3 previous errors -For more information about this error, try `rustc --explain E0714`. +For more information about this error, try `rustc --explain E0716`. diff --git a/src/test/ui/issues/issue-11681.nll.stderr b/src/test/ui/issues/issue-11681.nll.stderr index 8ded4f6e76879..f818f5b6195f3 100644 --- a/src/test/ui/issues/issue-11681.nll.stderr +++ b/src/test/ui/issues/issue-11681.nll.stderr @@ -1,4 +1,4 @@ -error[E0714]: temporary value dropped while borrowed +error[E0716]: temporary value dropped while borrowed --> $DIR/issue-11681.rs:22:20 | LL | let testValue = &Test; //~ ERROR borrowed value does not live long enough @@ -15,4 +15,4 @@ LL | fn createTest<'a>() -> &'a Test { error: aborting due to previous error -For more information about this error, try `rustc --explain E0714`. +For more information about this error, try `rustc --explain E0716`. diff --git a/src/test/ui/issues/issue-17545.nll.stderr b/src/test/ui/issues/issue-17545.nll.stderr index 3f9fa694c349e..889bfa07ab9be 100644 --- a/src/test/ui/issues/issue-17545.nll.stderr +++ b/src/test/ui/issues/issue-17545.nll.stderr @@ -1,4 +1,4 @@ -error[E0714]: temporary value dropped while borrowed +error[E0716]: temporary value dropped while borrowed --> $DIR/issue-17545.rs:17:10 | LL | &id(()), //~ ERROR borrowed value does not live long enough @@ -14,4 +14,4 @@ LL | pub fn foo<'a, F: Fn(&'a ())>(bar: F) { error: aborting due to previous error -For more information about this error, try `rustc --explain E0714`. +For more information about this error, try `rustc --explain E0716`. diff --git a/src/test/ui/issues/issue-17718-constants-not-static.nll.stderr b/src/test/ui/issues/issue-17718-constants-not-static.nll.stderr index c0795acbbb9d0..03fc31b7a7b54 100644 --- a/src/test/ui/issues/issue-17718-constants-not-static.nll.stderr +++ b/src/test/ui/issues/issue-17718-constants-not-static.nll.stderr @@ -1,4 +1,4 @@ -error[E0714]: temporary value dropped while borrowed +error[E0716]: temporary value dropped while borrowed --> $DIR/issue-17718-constants-not-static.rs:15:31 | LL | fn foo() -> &'static usize { &id(FOO) } @@ -10,4 +10,4 @@ LL | fn foo() -> &'static usize { &id(FOO) } error: aborting due to previous error -For more information about this error, try `rustc --explain E0714`. +For more information about this error, try `rustc --explain E0716`. diff --git a/src/test/ui/issues/issue-27592.nll.stderr b/src/test/ui/issues/issue-27592.nll.stderr index a41b3f8201893..a1d8c7aeb0eb9 100644 --- a/src/test/ui/issues/issue-27592.nll.stderr +++ b/src/test/ui/issues/issue-27592.nll.stderr @@ -1,4 +1,4 @@ -error[E0714]: temporary value dropped while borrowed +error[E0716]: temporary value dropped while borrowed --> $DIR/issue-27592.rs:26:27 | LL | write(|| format_args!("{}", String::from("Hello world"))); @@ -6,7 +6,7 @@ LL | write(|| format_args!("{}", String::from("Hello world"))); | | | creates a temporary which is freed while still in use -error[E0714]: temporary value dropped while borrowed +error[E0716]: temporary value dropped while borrowed --> $DIR/issue-27592.rs:26:33 | LL | write(|| format_args!("{}", String::from("Hello world"))); @@ -16,4 +16,4 @@ LL | write(|| format_args!("{}", String::from("Hello world"))); error: aborting due to 2 previous errors -For more information about this error, try `rustc --explain E0714`. +For more information about this error, try `rustc --explain E0716`. diff --git a/src/test/ui/issues/issue-30438-a.nll.stderr b/src/test/ui/issues/issue-30438-a.nll.stderr index 9acaaaa274709..7a11743fe4621 100644 --- a/src/test/ui/issues/issue-30438-a.nll.stderr +++ b/src/test/ui/issues/issue-30438-a.nll.stderr @@ -1,4 +1,4 @@ -error[E0714]: temporary value dropped while borrowed +error[E0716]: temporary value dropped while borrowed --> $DIR/issue-30438-a.rs:22:17 | LL | return &Test { s: &self.s}; @@ -17,4 +17,4 @@ LL | | } error: aborting due to previous error -For more information about this error, try `rustc --explain E0714`. +For more information about this error, try `rustc --explain E0716`. diff --git a/src/test/ui/issues/issue-30438-b.nll.stderr b/src/test/ui/issues/issue-30438-b.nll.stderr index 02344c50a38ad..ae1022f593ed5 100644 --- a/src/test/ui/issues/issue-30438-b.nll.stderr +++ b/src/test/ui/issues/issue-30438-b.nll.stderr @@ -1,4 +1,4 @@ -error[E0714]: temporary value dropped while borrowed +error[E0716]: temporary value dropped while borrowed --> $DIR/issue-30438-b.rs:23:10 | LL | &Test { s: &self.s} @@ -18,4 +18,4 @@ LL | | } error: aborting due to previous error -For more information about this error, try `rustc --explain E0714`. +For more information about this error, try `rustc --explain E0716`. diff --git a/src/test/ui/issues/issue-36082.ast.nll.stderr b/src/test/ui/issues/issue-36082.ast.nll.stderr index 4a481da6522ce..7fa7cee0aec1e 100644 --- a/src/test/ui/issues/issue-36082.ast.nll.stderr +++ b/src/test/ui/issues/issue-36082.ast.nll.stderr @@ -1,4 +1,4 @@ -error[E0714]: temporary value dropped while borrowed +error[E0716]: temporary value dropped while borrowed --> $DIR/issue-36082.rs:23:19 | LL | let val: &_ = x.borrow().0; @@ -13,4 +13,4 @@ LL | println!("{}", val); error: aborting due to previous error -For more information about this error, try `rustc --explain E0714`. +For more information about this error, try `rustc --explain E0716`. diff --git a/src/test/ui/issues/issue-44373.nll.stderr b/src/test/ui/issues/issue-44373.nll.stderr index 9a6c59aaa20d6..dadd58cf4805d 100644 --- a/src/test/ui/issues/issue-44373.nll.stderr +++ b/src/test/ui/issues/issue-44373.nll.stderr @@ -1,4 +1,4 @@ -error[E0714]: temporary value dropped while borrowed +error[E0716]: temporary value dropped while borrowed --> $DIR/issue-44373.rs:15:42 | LL | let _val: &'static [&'static u32] = &[&FOO]; //~ ERROR borrowed value does not live long enough @@ -10,4 +10,4 @@ LL | } error: aborting due to previous error -For more information about this error, try `rustc --explain E0714`. +For more information about this error, try `rustc --explain E0716`. diff --git a/src/test/ui/issues/issue-52049.nll.stderr b/src/test/ui/issues/issue-52049.nll.stderr index ad4cd48c9deb9..eb984fbde03a8 100644 --- a/src/test/ui/issues/issue-52049.nll.stderr +++ b/src/test/ui/issues/issue-52049.nll.stderr @@ -1,4 +1,4 @@ -error[E0714]: temporary value dropped while borrowed +error[E0716]: temporary value dropped while borrowed --> $DIR/issue-52049.rs:16:10 | LL | foo(&unpromotable(5u32)); @@ -10,4 +10,4 @@ LL | } error: aborting due to previous error -For more information about this error, try `rustc --explain E0714`. +For more information about this error, try `rustc --explain E0716`. diff --git a/src/test/ui/lifetimes/borrowck-let-suggestion.nll.stderr b/src/test/ui/lifetimes/borrowck-let-suggestion.nll.stderr index 0747405cf14cc..38a711bcefb0a 100644 --- a/src/test/ui/lifetimes/borrowck-let-suggestion.nll.stderr +++ b/src/test/ui/lifetimes/borrowck-let-suggestion.nll.stderr @@ -1,4 +1,4 @@ -error[E0714]: temporary value dropped while borrowed +error[E0716]: temporary value dropped while borrowed --> $DIR/borrowck-let-suggestion.rs:12:17 | LL | let mut x = vec![1].iter(); @@ -14,4 +14,4 @@ LL | x.use_mut(); error: aborting due to previous error -For more information about this error, try `rustc --explain E0714`. +For more information about this error, try `rustc --explain E0716`. diff --git a/src/test/ui/regions/regions-creating-enums.nll.stderr b/src/test/ui/regions/regions-creating-enums.nll.stderr index df2e3558612c3..a98cacaad99bf 100644 --- a/src/test/ui/regions/regions-creating-enums.nll.stderr +++ b/src/test/ui/regions/regions-creating-enums.nll.stderr @@ -1,4 +1,4 @@ -error[E0714]: temporary value dropped while borrowed +error[E0716]: temporary value dropped while borrowed --> $DIR/regions-creating-enums.rs:33:17 | LL | return &ast::num((*f)(x)); //~ ERROR borrowed value does not live long enough @@ -12,7 +12,7 @@ note: borrowed value must be valid for the lifetime 'a as defined on the functio LL | fn map_nums<'a,'b, F>(x: &ast, f: &mut F) -> &'a ast<'b> where F: FnMut(usize) -> usize { | ^^ -error[E0714]: temporary value dropped while borrowed +error[E0716]: temporary value dropped while borrowed --> $DIR/regions-creating-enums.rs:38:17 | LL | return &ast::add(m_x, m_y); //~ ERROR borrowed value does not live long enough @@ -28,4 +28,4 @@ LL | fn map_nums<'a,'b, F>(x: &ast, f: &mut F) -> &'a ast<'b> where F: FnMut(usi error: aborting due to 2 previous errors -For more information about this error, try `rustc --explain E0714`. +For more information about this error, try `rustc --explain E0716`. diff --git a/src/test/ui/regions/regions-free-region-ordering-caller1.nll.stderr b/src/test/ui/regions/regions-free-region-ordering-caller1.nll.stderr index 3bac4db347545..75758206d6b48 100644 --- a/src/test/ui/regions/regions-free-region-ordering-caller1.nll.stderr +++ b/src/test/ui/regions/regions-free-region-ordering-caller1.nll.stderr @@ -1,4 +1,4 @@ -error[E0714]: temporary value dropped while borrowed +error[E0716]: temporary value dropped while borrowed --> $DIR/regions-free-region-ordering-caller1.rs:19:27 | LL | let z: &'a & usize = &(&y); @@ -15,4 +15,4 @@ LL | fn call1<'a>(x: &'a usize) { error: aborting due to previous error -For more information about this error, try `rustc --explain E0714`. +For more information about this error, try `rustc --explain E0716`. diff --git a/src/test/ui/regions/regions-lifetime-of-struct-or-enum-variant.nll.stderr b/src/test/ui/regions/regions-lifetime-of-struct-or-enum-variant.nll.stderr index 0a6b9b718b5c8..eb870d55e0f4b 100644 --- a/src/test/ui/regions/regions-lifetime-of-struct-or-enum-variant.nll.stderr +++ b/src/test/ui/regions/regions-lifetime-of-struct-or-enum-variant.nll.stderr @@ -1,4 +1,4 @@ -error[E0714]: temporary value dropped while borrowed +error[E0716]: temporary value dropped while borrowed --> $DIR/regions-lifetime-of-struct-or-enum-variant.rs:24:20 | LL | let testValue = &id(Test); @@ -13,7 +13,7 @@ note: borrowed value must be valid for the lifetime 'a as defined on the functio LL | fn structLifetime<'a>() -> &'a Test { | ^^ -error[E0714]: temporary value dropped while borrowed +error[E0716]: temporary value dropped while borrowed --> $DIR/regions-lifetime-of-struct-or-enum-variant.rs:30:20 | LL | let testValue = &id(MyEnum::Variant1); @@ -30,4 +30,4 @@ LL | fn variantLifetime<'a>() -> &'a MyEnum { error: aborting due to 2 previous errors -For more information about this error, try `rustc --explain E0714`. +For more information about this error, try `rustc --explain E0716`. diff --git a/src/test/ui/regions/regions-ref-in-fn-arg.nll.stderr b/src/test/ui/regions/regions-ref-in-fn-arg.nll.stderr index af84d36e0b4e2..1976a3dc84d83 100644 --- a/src/test/ui/regions/regions-ref-in-fn-arg.nll.stderr +++ b/src/test/ui/regions/regions-ref-in-fn-arg.nll.stderr @@ -1,4 +1,4 @@ -error[E0714]: temporary value dropped while borrowed +error[E0716]: temporary value dropped while borrowed --> $DIR/regions-ref-in-fn-arg.rs:14:13 | LL | fn arg_item(box ref x: Box) -> &'static isize { @@ -9,7 +9,7 @@ LL | } | = note: borrowed value must be valid for the static lifetime... -error[E0714]: temporary value dropped while borrowed +error[E0716]: temporary value dropped while borrowed --> $DIR/regions-ref-in-fn-arg.rs:21:11 | LL | with(|box ref x| x) //~ ERROR borrowed value does not live long enough @@ -19,4 +19,4 @@ LL | with(|box ref x| x) //~ ERROR borrowed value does not live long enough error: aborting due to 2 previous errors -For more information about this error, try `rustc --explain E0714`. +For more information about this error, try `rustc --explain E0716`. diff --git a/src/test/ui/regions/regions-ret.nll.stderr b/src/test/ui/regions/regions-ret.nll.stderr index 8dfb7c18480b6..be4d5bf9da0d5 100644 --- a/src/test/ui/regions/regions-ret.nll.stderr +++ b/src/test/ui/regions/regions-ret.nll.stderr @@ -1,4 +1,4 @@ -error[E0714]: temporary value dropped while borrowed +error[E0716]: temporary value dropped while borrowed --> $DIR/regions-ret.rs:14:13 | LL | return &id(3); //~ ERROR borrowed value does not live long enough @@ -16,4 +16,4 @@ LL | | } error: aborting due to previous error -For more information about this error, try `rustc --explain E0714`. +For more information about this error, try `rustc --explain E0716`. diff --git a/src/test/ui/regions/regions-return-stack-allocated-vec.nll.stderr b/src/test/ui/regions/regions-return-stack-allocated-vec.nll.stderr index 919e29e4ec46d..e175a3e7f2f8f 100644 --- a/src/test/ui/regions/regions-return-stack-allocated-vec.nll.stderr +++ b/src/test/ui/regions/regions-return-stack-allocated-vec.nll.stderr @@ -1,4 +1,4 @@ -error[E0714]: temporary value dropped while borrowed +error[E0716]: temporary value dropped while borrowed --> $DIR/regions-return-stack-allocated-vec.rs:14:6 | LL | &[x] //~ ERROR borrowed value does not live long enough @@ -10,4 +10,4 @@ LL | } error: aborting due to previous error -For more information about this error, try `rustc --explain E0714`. +For more information about this error, try `rustc --explain E0716`. diff --git a/src/test/ui/regions/regions-var-type-out-of-scope.nll.stderr b/src/test/ui/regions/regions-var-type-out-of-scope.nll.stderr index 6d1b9938a8b35..c790f7ec1e53f 100644 --- a/src/test/ui/regions/regions-var-type-out-of-scope.nll.stderr +++ b/src/test/ui/regions/regions-var-type-out-of-scope.nll.stderr @@ -1,4 +1,4 @@ -error[E0714]: temporary value dropped while borrowed +error[E0716]: temporary value dropped while borrowed --> $DIR/regions-var-type-out-of-scope.rs:19:14 | LL | x = &id(3); //~ ERROR borrowed value does not live long enough @@ -13,4 +13,4 @@ LL | assert_eq!(*x, 3); error: aborting due to previous error -For more information about this error, try `rustc --explain E0714`. +For more information about this error, try `rustc --explain E0716`. diff --git a/src/test/ui/span/borrowck-let-suggestion-suffixes.nll.stderr b/src/test/ui/span/borrowck-let-suggestion-suffixes.nll.stderr index 765d8b36b0e69..873871107eeae 100644 --- a/src/test/ui/span/borrowck-let-suggestion-suffixes.nll.stderr +++ b/src/test/ui/span/borrowck-let-suggestion-suffixes.nll.stderr @@ -1,4 +1,4 @@ -error[E0714]: temporary value dropped while borrowed +error[E0716]: temporary value dropped while borrowed --> $DIR/borrowck-let-suggestion-suffixes.rs:28:14 | LL | v3.push(&id('x')); // statement 6 @@ -11,7 +11,7 @@ LL | (v1, v2, v3, /* v4 is above. */ v5).use_ref(); | = note: consider using a `let` binding to create a longer lived value -error[E0714]: temporary value dropped while borrowed +error[E0716]: temporary value dropped while borrowed --> $DIR/borrowck-let-suggestion-suffixes.rs:38:18 | LL | v4.push(&id('y')); @@ -24,7 +24,7 @@ LL | v4.use_ref(); | = note: consider using a `let` binding to create a longer lived value -error[E0714]: temporary value dropped while borrowed +error[E0716]: temporary value dropped while borrowed --> $DIR/borrowck-let-suggestion-suffixes.rs:49:14 | LL | v5.push(&id('z')); @@ -39,4 +39,4 @@ LL | (v1, v2, v3, /* v4 is above. */ v5).use_ref(); error: aborting due to 3 previous errors -For more information about this error, try `rustc --explain E0714`. +For more information about this error, try `rustc --explain E0716`. diff --git a/src/test/ui/span/borrowck-ref-into-rvalue.nll.stderr b/src/test/ui/span/borrowck-ref-into-rvalue.nll.stderr index c565842c2c002..3dc64dabf903a 100644 --- a/src/test/ui/span/borrowck-ref-into-rvalue.nll.stderr +++ b/src/test/ui/span/borrowck-ref-into-rvalue.nll.stderr @@ -1,11 +1,11 @@ -error[E0597]: borrowed value does not live long enough +error[E0716]: temporary value dropped while borrowed --> $DIR/borrowck-ref-into-rvalue.rs:13:11 | LL | match Some("Hello".to_string()) { - | ^^^^^^^^^^^^^^^^^^^^^^^^^ temporary value does not live long enough + | ^^^^^^^^^^^^^^^^^^^^^^^^^ creates a temporary which is freed while still in use ... LL | } - | - temporary value only lives until here + | - temporary value is freed at the end of this statement LL | println!("{}", *msg); | ---- borrow later used here | @@ -13,4 +13,4 @@ LL | println!("{}", *msg); error: aborting due to previous error -For more information about this error, try `rustc --explain E0597`. +For more information about this error, try `rustc --explain E0716`. diff --git a/src/test/ui/span/issue-15480.nll.stderr b/src/test/ui/span/issue-15480.nll.stderr index 098e1ce62a82c..a93bf025d4b3c 100644 --- a/src/test/ui/span/issue-15480.nll.stderr +++ b/src/test/ui/span/issue-15480.nll.stderr @@ -1,4 +1,4 @@ -error[E0714]: temporary value dropped while borrowed +error[E0716]: temporary value dropped while borrowed --> $DIR/issue-15480.rs:15:10 | LL | &id(3) @@ -13,4 +13,4 @@ LL | for &&x in &v { error: aborting due to previous error -For more information about this error, try `rustc --explain E0714`. +For more information about this error, try `rustc --explain E0716`. diff --git a/src/test/ui/span/regions-close-over-borrowed-ref-in-obj.nll.stderr b/src/test/ui/span/regions-close-over-borrowed-ref-in-obj.nll.stderr index 0e5fc749d9691..6f7fbdcf42145 100644 --- a/src/test/ui/span/regions-close-over-borrowed-ref-in-obj.nll.stderr +++ b/src/test/ui/span/regions-close-over-borrowed-ref-in-obj.nll.stderr @@ -1,4 +1,4 @@ -error[E0714]: temporary value dropped while borrowed +error[E0716]: temporary value dropped while borrowed --> $DIR/regions-close-over-borrowed-ref-in-obj.rs:22:27 | LL | let ss: &isize = &id(1); @@ -13,4 +13,4 @@ LL | } error: aborting due to previous error -For more information about this error, try `rustc --explain E0714`. +For more information about this error, try `rustc --explain E0716`. diff --git a/src/test/ui/span/slice-borrow.nll.stderr b/src/test/ui/span/slice-borrow.nll.stderr index 0aeb549d95e58..71e53e876a6e4 100644 --- a/src/test/ui/span/slice-borrow.nll.stderr +++ b/src/test/ui/span/slice-borrow.nll.stderr @@ -1,4 +1,4 @@ -error[E0714]: temporary value dropped while borrowed +error[E0716]: temporary value dropped while borrowed --> $DIR/slice-borrow.rs:16:28 | LL | let x: &[isize] = &vec![1, 2, 3, 4, 5]; @@ -14,4 +14,4 @@ LL | y.use_ref(); error: aborting due to previous error -For more information about this error, try `rustc --explain E0714`. +For more information about this error, try `rustc --explain E0716`. diff --git a/src/test/ui/static/static-drop-scope.nll.stderr b/src/test/ui/static/static-drop-scope.nll.stderr index 36c645479dde8..a498d80b67b1b 100644 --- a/src/test/ui/static/static-drop-scope.nll.stderr +++ b/src/test/ui/static/static-drop-scope.nll.stderr @@ -4,7 +4,7 @@ error[E0493]: destructors cannot be evaluated at compile-time LL | static PROMOTION_FAIL_S: Option<&'static WithDtor> = Some(&WithDtor); | ^^^^^^^^ statics cannot evaluate destructors -error[E0714]: temporary value dropped while borrowed +error[E0716]: temporary value dropped while borrowed --> $DIR/static-drop-scope.rs:19:60 | LL | static PROMOTION_FAIL_S: Option<&'static WithDtor> = Some(&WithDtor); @@ -20,7 +20,7 @@ error[E0493]: destructors cannot be evaluated at compile-time LL | const PROMOTION_FAIL_C: Option<&'static WithDtor> = Some(&WithDtor); | ^^^^^^^^ constants cannot evaluate destructors -error[E0714]: temporary value dropped while borrowed +error[E0716]: temporary value dropped while borrowed --> $DIR/static-drop-scope.rs:23:59 | LL | const PROMOTION_FAIL_C: Option<&'static WithDtor> = Some(&WithDtor); @@ -56,5 +56,5 @@ LL | (x, ()).1 error: aborting due to 8 previous errors -Some errors occurred: E0493, E0714. +Some errors occurred: E0493, E0716. For more information about an error, try `rustc --explain E0493`. diff --git a/src/test/ui/static/static-reference-to-fn-2.nll.stderr b/src/test/ui/static/static-reference-to-fn-2.nll.stderr index 3740d9051be6a..a9ecc14403ab9 100644 --- a/src/test/ui/static/static-reference-to-fn-2.nll.stderr +++ b/src/test/ui/static/static-reference-to-fn-2.nll.stderr @@ -1,4 +1,4 @@ -error[E0714]: temporary value dropped while borrowed +error[E0716]: temporary value dropped while borrowed --> $DIR/static-reference-to-fn-2.rs:28:22 | LL | self_.statefn = &id(state2 as StateMachineFunc); @@ -16,7 +16,7 @@ LL | | return Some("state1"); LL | | } | |_^ -error[E0714]: temporary value dropped while borrowed +error[E0716]: temporary value dropped while borrowed --> $DIR/static-reference-to-fn-2.rs:34:22 | LL | self_.statefn = &id(state3 as StateMachineFunc); @@ -34,7 +34,7 @@ LL | | return Some("state2"); LL | | } | |_^ -error[E0714]: temporary value dropped while borrowed +error[E0716]: temporary value dropped while borrowed --> $DIR/static-reference-to-fn-2.rs:40:22 | LL | self_.statefn = &id(finished as StateMachineFunc); @@ -52,7 +52,7 @@ LL | | return Some("state3"); LL | | } | |_^ -error[E0714]: temporary value dropped while borrowed +error[E0716]: temporary value dropped while borrowed --> $DIR/static-reference-to-fn-2.rs:51:19 | LL | statefn: &id(state1 as StateMachineFunc) @@ -65,4 +65,4 @@ LL | } error: aborting due to 4 previous errors -For more information about this error, try `rustc --explain E0714`. +For more information about this error, try `rustc --explain E0716`. diff --git a/src/test/ui/static/static-region-bound.nll.stderr b/src/test/ui/static/static-region-bound.nll.stderr index 3bb763eb1c779..45af062c82436 100644 --- a/src/test/ui/static/static-region-bound.nll.stderr +++ b/src/test/ui/static/static-region-bound.nll.stderr @@ -1,4 +1,4 @@ -error[E0714]: temporary value dropped while borrowed +error[E0716]: temporary value dropped while borrowed --> $DIR/static-region-bound.rs:20:14 | LL | let x = &id(3); //~ ERROR borrowed value does not live long enough @@ -11,4 +11,4 @@ LL | } error: aborting due to previous error -For more information about this error, try `rustc --explain E0714`. +For more information about this error, try `rustc --explain E0716`. diff --git a/src/test/ui/wf/wf-misc-methods-issue-28609.nll.stderr b/src/test/ui/wf/wf-misc-methods-issue-28609.nll.stderr index 656a2eb698c05..7c7c0468c6fcd 100644 --- a/src/test/ui/wf/wf-misc-methods-issue-28609.nll.stderr +++ b/src/test/ui/wf/wf-misc-methods-issue-28609.nll.stderr @@ -1,4 +1,4 @@ -error[E0714]: temporary value dropped while borrowed +error[E0716]: temporary value dropped while borrowed --> $DIR/wf-misc-methods-issue-28609.rs:32:31 | LL | s.transmute_inherent(&mut 42) //~ ERROR does not live long enough @@ -55,7 +55,7 @@ LL | | &*s LL | | } | |_^ -error[E0714]: temporary value dropped while borrowed +error[E0716]: temporary value dropped while borrowed --> $DIR/wf-misc-methods-issue-28609.rs:63:15 | LL | s << &mut 3 //~ ERROR does not live long enough @@ -72,7 +72,7 @@ LL | | s << &mut 3 //~ ERROR does not live long enough LL | | } | |_^ -error[E0714]: temporary value dropped while borrowed +error[E0716]: temporary value dropped while borrowed --> $DIR/wf-misc-methods-issue-28609.rs:68:16 | LL | s.shl(&mut 3) //~ ERROR does not live long enough @@ -89,7 +89,7 @@ LL | | s.shl(&mut 3) //~ ERROR does not live long enough LL | | } | |_^ -error[E0714]: temporary value dropped while borrowed +error[E0716]: temporary value dropped while borrowed --> $DIR/wf-misc-methods-issue-28609.rs:73:21 | LL | S2::shl(s, &mut 3) //~ ERROR does not live long enough @@ -108,5 +108,5 @@ LL | | } error: aborting due to 6 previous errors -Some errors occurred: E0597, E0714. +Some errors occurred: E0597, E0716. For more information about an error, try `rustc --explain E0597`.