parent
6d2987ca03
commit
3a185a510d
24 changed files with 274 additions and 23 deletions
|
|
@ -8,7 +8,7 @@
|
|||
// option. This file may not be copied, modified, or distributed
|
||||
// except according to those terms.
|
||||
|
||||
// compile-flags:-Znll -Zborrowck=mir
|
||||
// compile-flags:-Znll -Zborrowck=mir -Znll-dump-cause
|
||||
|
||||
// Test that a structure which tries to store a pointer to `y` into
|
||||
// `p` (indirectly) fails to compile.
|
||||
|
|
|
|||
|
|
@ -6,6 +6,9 @@ error[E0597]: `y` does not live long enough
|
|||
...
|
||||
37 | }
|
||||
| - borrowed value only lives until here
|
||||
38 |
|
||||
39 | deref(p);
|
||||
| - borrow later used here
|
||||
|
|
||||
= note: borrowed value must be valid for lifetime '_#5r...
|
||||
|
||||
|
|
|
|||
|
|
@ -22,7 +22,7 @@
|
|||
// basically checking that the MIR type checker correctly enforces the
|
||||
// closure signature.
|
||||
|
||||
// compile-flags:-Znll -Zborrowck=mir -Zverbose
|
||||
// compile-flags:-Znll -Zborrowck=mir -Znll-dump-cause -Zverbose
|
||||
|
||||
#![feature(rustc_attrs)]
|
||||
|
||||
|
|
|
|||
|
|
@ -31,6 +31,9 @@ error[E0597]: `y` does not live long enough
|
|||
38 | //~^ ERROR `y` does not live long enough [E0597]
|
||||
39 | }
|
||||
| - borrowed value only lives until here
|
||||
40 |
|
||||
41 | deref(p);
|
||||
| - borrow later used here
|
||||
|
|
||||
= note: borrowed value must be valid for lifetime '_#6r...
|
||||
|
||||
|
|
|
|||
|
|
@ -15,7 +15,7 @@
|
|||
//
|
||||
// except that the closure does so via a second closure.
|
||||
|
||||
// compile-flags:-Znll -Zborrowck=mir -Zverbose
|
||||
// compile-flags:-Znll -Zborrowck=mir -Znll-dump-cause -Zverbose
|
||||
|
||||
#![feature(rustc_attrs)]
|
||||
|
||||
|
|
|
|||
|
|
@ -58,6 +58,9 @@ error[E0597]: `y` does not live long enough
|
|||
...
|
||||
36 | }
|
||||
| - borrowed value only lives until here
|
||||
37 |
|
||||
38 | deref(p);
|
||||
| - borrow later used here
|
||||
|
|
||||
= note: borrowed value must be valid for lifetime '_#4r...
|
||||
|
||||
|
|
|
|||
|
|
@ -19,7 +19,7 @@
|
|||
// `'b`. This relationship is propagated to the closure creator,
|
||||
// which reports an error.
|
||||
|
||||
// compile-flags:-Znll -Zborrowck=mir -Zverbose
|
||||
// compile-flags:-Znll -Zborrowck=mir -Znll-dump-cause -Zverbose
|
||||
|
||||
#![feature(rustc_attrs)]
|
||||
|
||||
|
|
|
|||
|
|
@ -35,6 +35,9 @@ error[E0597]: `y` does not live long enough
|
|||
...
|
||||
36 | }
|
||||
| - borrowed value only lives until here
|
||||
37 |
|
||||
38 | deref(p);
|
||||
| - borrow later used here
|
||||
|
|
||||
= note: borrowed value must be valid for lifetime '_#4r...
|
||||
|
||||
|
|
|
|||
|
|
@ -13,7 +13,7 @@
|
|||
// a variety of errors from the older, AST-based machinery (notably
|
||||
// borrowck), and then we get the NLL error at the end.
|
||||
|
||||
// compile-flags:-Znll -Zborrowck=compare
|
||||
// compile-flags:-Znll -Zborrowck=compare -Znll-dump-cause
|
||||
|
||||
struct Map {
|
||||
}
|
||||
|
|
|
|||
|
|
@ -42,6 +42,9 @@ error[E0502]: cannot borrow `*map` as mutable because it is also borrowed as imm
|
|||
43 | Some(v) => {
|
||||
44 | map.set(String::new()); // Both AST and MIR error here
|
||||
| ^^^ mutable borrow occurs here
|
||||
...
|
||||
47 | return v;
|
||||
| - borrow later used here
|
||||
|
||||
error: aborting due to 4 previous errors
|
||||
|
||||
|
|
|
|||
|
|
@ -8,7 +8,8 @@
|
|||
// option. This file may not be copied, modified, or distributed
|
||||
// except according to those terms.
|
||||
|
||||
//compile-flags: -Z emit-end-regions -Zborrowck=mir -Z nll
|
||||
//compile-flags: -Z emit-end-regions -Zborrowck=mir -Z nll -Znll-dump-cause
|
||||
|
||||
|
||||
#![allow(warnings)]
|
||||
|
||||
|
|
|
|||
|
|
@ -6,6 +6,9 @@ error[E0506]: cannot assign to `x` because it is borrowed
|
|||
...
|
||||
31 | x = 1; //~ ERROR cannot assign to `x` because it is borrowed [E0506]
|
||||
| ^^^^^ assignment to borrowed `x` occurs here
|
||||
32 | // FIXME ^ Should not error in the future with implicit dtors, only manually implemented ones
|
||||
33 | }
|
||||
| - borrow later used here, when `foo` is dropped
|
||||
|
||||
error: aborting due to previous error
|
||||
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@
|
|||
// option. This file may not be copied, modified, or distributed
|
||||
// except according to those terms.
|
||||
|
||||
//compile-flags: -Z emit-end-regions -Zborrowck=mir -Z nll
|
||||
//compile-flags: -Z emit-end-regions -Zborrowck=mir -Znll -Znll-dump-cause
|
||||
|
||||
#![allow(warnings)]
|
||||
|
||||
|
|
|
|||
|
|
@ -6,6 +6,8 @@ error[E0506]: cannot assign to `x` because it is borrowed
|
|||
...
|
||||
31 | x = 1; //~ ERROR cannot assign to `x` because it is borrowed [E0506]
|
||||
| ^^^^^ assignment to borrowed `x` occurs here
|
||||
32 | }
|
||||
| - borrow later used here, when `foo` is dropped
|
||||
|
||||
error: aborting due to previous error
|
||||
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@
|
|||
// option. This file may not be copied, modified, or distributed
|
||||
// except according to those terms.
|
||||
|
||||
//compile-flags: -Z emit-end-regions -Zborrowck=mir -Z nll
|
||||
//compile-flags: -Z emit-end-regions -Zborrowck=mir -Znll -Znll-dump-cause
|
||||
|
||||
#![allow(warnings)]
|
||||
|
||||
|
|
|
|||
|
|
@ -6,6 +6,9 @@ error[E0506]: cannot assign to `x` because it is borrowed
|
|||
...
|
||||
32 | x = 1; //~ ERROR cannot assign to `x` because it is borrowed [E0506]
|
||||
| ^^^^^ assignment to borrowed `x` occurs here
|
||||
33 | // FIXME ^ This currently errors and it should not.
|
||||
34 | }
|
||||
| - borrow later used here, when `foo` is dropped
|
||||
|
||||
error: aborting due to previous error
|
||||
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@
|
|||
// option. This file may not be copied, modified, or distributed
|
||||
// except according to those terms.
|
||||
|
||||
//compile-flags: -Z emit-end-regions -Zborrowck=mir -Z nll
|
||||
//compile-flags: -Z emit-end-regions -Zborrowck=mir -Znll -Znll-dump-cause
|
||||
|
||||
#![allow(warnings)]
|
||||
|
||||
|
|
|
|||
|
|
@ -5,6 +5,8 @@ error[E0506]: cannot assign to `x` because it is borrowed
|
|||
| ------ borrow of `x` occurs here
|
||||
26 | x = 1; //~ ERROR cannot assign to `x` because it is borrowed [E0506]
|
||||
| ^^^^^ assignment to borrowed `x` occurs here
|
||||
27 | }
|
||||
| - borrow later used here, when `wrap` is dropped
|
||||
|
||||
error: aborting due to previous error
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue