parent
ae366637fe
commit
5fc0b743d7
59 changed files with 848 additions and 188 deletions
18
src/test/ui/issues/issue-11681.nll.stderr
Normal file
18
src/test/ui/issues/issue-11681.nll.stderr
Normal file
|
|
@ -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`.
|
||||
|
|
@ -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`.
|
||||
|
|
|
|||
|
|
@ -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`.
|
||||
|
|
@ -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`.
|
||||
|
|
|
|||
|
|
@ -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`.
|
||||
|
|
|
|||
21
src/test/ui/issues/issue-30438-b.nll.stderr
Normal file
21
src/test/ui/issues/issue-30438-b.nll.stderr
Normal file
|
|
@ -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`.
|
||||
|
|
@ -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`.
|
||||
|
|
|
|||
|
|
@ -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`.
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
13
src/test/ui/issues/issue-44373.nll.stderr
Normal file
13
src/test/ui/issues/issue-44373.nll.stderr
Normal file
|
|
@ -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`.
|
||||
|
|
@ -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() { }
|
||||
|
|
|
|||
|
|
@ -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`.
|
||||
|
|
|
|||
|
|
@ -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]
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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`.
|
||||
|
|
|
|||
|
|
@ -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`.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue