Updated existing tests with new error messages.
This commit is contained in:
parent
00c7a3f4dc
commit
3dbc11bc63
12 changed files with 57 additions and 46 deletions
|
|
@ -30,11 +30,11 @@ fn test() {
|
|||
let closure = SomeStruct {
|
||||
p: &mut p,
|
||||
y: &y,
|
||||
//~^ ERROR `y` does not live long enough [E0597]
|
||||
};
|
||||
|
||||
closure.invoke();
|
||||
}
|
||||
//~^ ERROR borrowed value does not live long enough [E0597]
|
||||
|
||||
deref(p);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,13 +1,13 @@
|
|||
error[E0597]: borrowed value does not live long enough
|
||||
--> $DIR/capture-ref-in-struct.rs:36:6
|
||||
error[E0597]: `y` does not live long enough
|
||||
--> $DIR/capture-ref-in-struct.rs:32:16
|
||||
|
|
||||
28 | let y = 22;
|
||||
| - temporary value created here
|
||||
32 | y: &y,
|
||||
| ^^ does not live long enough
|
||||
...
|
||||
36 | }
|
||||
| ^ temporary value dropped here while still borrowed
|
||||
37 | }
|
||||
| - borrowed value only lives until here
|
||||
|
|
||||
= note: consider using a `let` binding to increase its lifetime
|
||||
= note: borrowed value must be valid for lifetime '_#4r...
|
||||
|
||||
error: aborting due to previous error
|
||||
|
||||
|
|
|
|||
|
|
@ -35,8 +35,8 @@ fn test() {
|
|||
let y = 22;
|
||||
let mut closure = expect_sig(|p, y| *p = y);
|
||||
closure(&mut p, &y);
|
||||
//~^ ERROR `y` does not live long enough [E0597]
|
||||
}
|
||||
//~^ ERROR borrowed value does not live long enough [E0597]
|
||||
|
||||
deref(p);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -24,16 +24,16 @@ note: No external requirements
|
|||
|
|
||||
= note: defining type: DefId(0/0:3 ~ escape_argument[317d]::test[0]) with substs []
|
||||
|
||||
error[E0597]: borrowed value does not live long enough
|
||||
--> $DIR/escape-argument.rs:38:6
|
||||
error[E0597]: `y` does not live long enough
|
||||
--> $DIR/escape-argument.rs:37:25
|
||||
|
|
||||
35 | let y = 22;
|
||||
| - temporary value created here
|
||||
...
|
||||
38 | }
|
||||
| ^ temporary value dropped here while still borrowed
|
||||
37 | closure(&mut p, &y);
|
||||
| ^^ does not live long enough
|
||||
38 | //~^ ERROR `y` does not live long enough [E0597]
|
||||
39 | }
|
||||
| - borrowed value only lives until here
|
||||
|
|
||||
= note: consider using a `let` binding to increase its lifetime
|
||||
= note: borrowed value must be valid for lifetime '_#5r...
|
||||
|
||||
error: aborting due to previous error
|
||||
|
||||
|
|
|
|||
|
|
@ -27,13 +27,13 @@ fn test() {
|
|||
{
|
||||
let y = 22;
|
||||
|
||||
let mut closure = || {
|
||||
let mut closure = || { //~ ERROR `y` does not live long enough [E0597]
|
||||
let mut closure1 = || p = &y;
|
||||
closure1();
|
||||
};
|
||||
|
||||
closure();
|
||||
} //~ ERROR borrowed value does not live long enough
|
||||
}
|
||||
|
||||
deref(p);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@ note: External requirements
|
|||
note: External requirements
|
||||
--> $DIR/escape-upvar-nested.rs:30:27
|
||||
|
|
||||
30 | let mut closure = || {
|
||||
30 | let mut closure = || { //~ ERROR `y` does not live long enough [E0597]
|
||||
| ___________________________^
|
||||
31 | | let mut closure1 = || p = &y;
|
||||
32 | | closure1();
|
||||
|
|
@ -46,16 +46,20 @@ note: No external requirements
|
|||
|
|
||||
= note: defining type: DefId(0/0:3 ~ escape_upvar_nested[317d]::test[0]) with substs []
|
||||
|
||||
error[E0597]: borrowed value does not live long enough
|
||||
--> $DIR/escape-upvar-nested.rs:36:6
|
||||
error[E0597]: `y` does not live long enough
|
||||
--> $DIR/escape-upvar-nested.rs:30:27
|
||||
|
|
||||
28 | let y = 22;
|
||||
| - temporary value created here
|
||||
30 | let mut closure = || { //~ ERROR `y` does not live long enough [E0597]
|
||||
| ___________________________^
|
||||
31 | | let mut closure1 = || p = &y;
|
||||
32 | | closure1();
|
||||
33 | | };
|
||||
| |_________^ does not live long enough
|
||||
...
|
||||
36 | } //~ ERROR borrowed value does not live long enough
|
||||
| ^ temporary value dropped here while still borrowed
|
||||
36 | }
|
||||
| - borrowed value only lives until here
|
||||
|
|
||||
= note: consider using a `let` binding to increase its lifetime
|
||||
= note: borrowed value must be valid for lifetime '_#3r...
|
||||
|
||||
error: aborting due to previous error
|
||||
|
||||
|
|
|
|||
|
|
@ -31,8 +31,9 @@ fn test() {
|
|||
{
|
||||
let y = 22;
|
||||
let mut closure = || p = &y;
|
||||
//~^ ERROR `y` does not live long enough [E0597]
|
||||
closure();
|
||||
} //~ ERROR borrowed value does not live long enough
|
||||
}
|
||||
|
||||
deref(p);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -21,22 +21,22 @@ note: No external requirements
|
|||
29 | | let mut p = &x;
|
||||
30 | |
|
||||
... |
|
||||
37 | | deref(p);
|
||||
38 | | }
|
||||
38 | | deref(p);
|
||||
39 | | }
|
||||
| |_^
|
||||
|
|
||||
= note: defining type: DefId(0/0:3 ~ escape_upvar_ref[317d]::test[0]) with substs []
|
||||
|
||||
error[E0597]: borrowed value does not live long enough
|
||||
--> $DIR/escape-upvar-ref.rs:35:6
|
||||
error[E0597]: `y` does not live long enough
|
||||
--> $DIR/escape-upvar-ref.rs:33:27
|
||||
|
|
||||
32 | let y = 22;
|
||||
| - temporary value created here
|
||||
33 | let mut closure = || p = &y;
|
||||
| ^^^^^^^^^ does not live long enough
|
||||
...
|
||||
35 | } //~ ERROR borrowed value does not live long enough
|
||||
| ^ temporary value dropped here while still borrowed
|
||||
36 | }
|
||||
| - borrowed value only lives until here
|
||||
|
|
||||
= note: consider using a `let` binding to increase its lifetime
|
||||
= note: borrowed value must be valid for lifetime '_#3r...
|
||||
|
||||
error: aborting due to previous error
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue