Change the diagnostic number from 714 to 716.
This commit is contained in:
parent
5fc0b743d7
commit
ea4d934c32
@ -2263,13 +2263,13 @@ impl<'a> Drop for S<'a> {
|
||||
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 }
|
||||
|
@ -739,7 +739,7 @@ fn temporary_value_borrowed_for_too_long(
|
||||
let err = struct_span_err!(
|
||||
self,
|
||||
span,
|
||||
E0714,
|
||||
E0716,
|
||||
"temporary value dropped while borrowed{OGN}",
|
||||
OGN = o
|
||||
);
|
||||
|
@ -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`.
|
||||
|
@ -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`.
|
||||
|
@ -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`.
|
||||
|
@ -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`.
|
||||
|
@ -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`.
|
||||
|
@ -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`.
|
||||
|
@ -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`.
|
||||
|
@ -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`.
|
||||
|
@ -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`.
|
||||
|
@ -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
|
||||
|
@ -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() { }
|
||||
|
@ -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`.
|
||||
|
@ -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]
|
||||
}
|
||||
|
@ -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`.
|
||||
|
@ -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);
|
||||
}
|
||||
|
@ -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`.
|
||||
|
@ -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() {}
|
||||
|
@ -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`.
|
||||
|
@ -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 <https://doc.rust-lang.org/book/second-edition/ch04-02-references-and-borrowing.html#dangling-references>
|
||||
|
||||
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`.
|
||||
|
@ -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
|
||||
}
|
||||
|
||||
|
@ -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`.
|
||||
|
@ -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() {
|
||||
|
@ -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`.
|
||||
|
Loading…
Reference in New Issue
Block a user