Auto merge of #49836 - nikomatsakis:nll-facts-prep, r=pnkfelix
prep work for using timely dataflow with NLL Two major changes: **Two-phase borrows are overhauled.** We no longer have two bits per borrow. Instead, we track -- for each borrow -- an (optional) "activation point". Then, for each point P where the borrow is in scope, we check where P falls relative to the activation point. If P is between the reservation point and the activation point, then this is the "reservation" phase of the borrow, else the borrow is considered active. This is simpler and means that the dataflow doesn't have to care about 2-phase at all, at last not yet. **We no longer support using the MIR borrow checker without NLL.** It is going to be increasingly untenable to support lexical mode as we go forward, I think, and also of increasingly little value. This also exposed a few bugs in NLL mode due to increased testing. r? @pnkfelix cc @bobtwinkles
This commit is contained in:
commit
881a7cd86e
145 changed files with 1149 additions and 1136 deletions
|
|
@ -23,6 +23,7 @@ fn a() {
|
|||
let c1 = to_fn_mut(|| x = 4);
|
||||
let c2 = to_fn_mut(|| x = 5); //~ ERROR cannot borrow `x` as mutable more than once
|
||||
//~| ERROR cannot borrow `x` as mutable more than once
|
||||
drop((c1, c2));
|
||||
}
|
||||
|
||||
fn set(x: &mut isize) {
|
||||
|
|
@ -34,6 +35,7 @@ fn b() {
|
|||
let c1 = to_fn_mut(|| set(&mut x));
|
||||
let c2 = to_fn_mut(|| set(&mut x)); //~ ERROR cannot borrow `x` as mutable more than once
|
||||
//~| ERROR cannot borrow `x` as mutable more than once
|
||||
drop((c1, c2));
|
||||
}
|
||||
|
||||
fn c() {
|
||||
|
|
@ -41,6 +43,7 @@ fn c() {
|
|||
let c1 = to_fn_mut(|| x = 5);
|
||||
let c2 = to_fn_mut(|| set(&mut x)); //~ ERROR cannot borrow `x` as mutable more than once
|
||||
//~| ERROR cannot borrow `x` as mutable more than once
|
||||
drop((c1, c2));
|
||||
}
|
||||
|
||||
fn d() {
|
||||
|
|
@ -49,6 +52,7 @@ fn d() {
|
|||
let c2 = to_fn_mut(|| { let _y = to_fn_mut(|| set(&mut x)); }); // (nested closure)
|
||||
//~^ ERROR cannot borrow `x` as mutable more than once
|
||||
//~| ERROR cannot borrow `x` as mutable more than once
|
||||
drop((c1, c2));
|
||||
}
|
||||
|
||||
fn g() {
|
||||
|
|
@ -61,6 +65,7 @@ fn g() {
|
|||
let c2 = to_fn_mut(|| set(&mut *x.f));
|
||||
//~^ ERROR cannot borrow `x` as mutable more than once
|
||||
//~| ERROR cannot borrow `x` as mutable more than once
|
||||
drop((c1, c2));
|
||||
}
|
||||
|
||||
fn main() {
|
||||
|
|
|
|||
|
|
@ -9,12 +9,12 @@ LL | let c2 = to_fn_mut(|| x = 5); //~ ERROR cannot borrow `x` as mutable mo
|
|||
| ^^ - borrow occurs due to use of `x` in closure
|
||||
| |
|
||||
| second mutable borrow occurs here
|
||||
LL | //~| ERROR cannot borrow `x` as mutable more than once
|
||||
...
|
||||
LL | }
|
||||
| - first borrow ends here
|
||||
|
||||
error[E0499]: cannot borrow `x` as mutable more than once at a time (Ast)
|
||||
--> $DIR/borrowck-closures-two-mut.rs:35:24
|
||||
--> $DIR/borrowck-closures-two-mut.rs:36:24
|
||||
|
|
||||
LL | let c1 = to_fn_mut(|| set(&mut x));
|
||||
| -- - previous borrow occurs due to use of `x` in closure
|
||||
|
|
@ -24,12 +24,12 @@ LL | let c2 = to_fn_mut(|| set(&mut x)); //~ ERROR cannot borrow `x` as muta
|
|||
| ^^ - borrow occurs due to use of `x` in closure
|
||||
| |
|
||||
| second mutable borrow occurs here
|
||||
LL | //~| ERROR cannot borrow `x` as mutable more than once
|
||||
...
|
||||
LL | }
|
||||
| - first borrow ends here
|
||||
|
||||
error[E0499]: cannot borrow `x` as mutable more than once at a time (Ast)
|
||||
--> $DIR/borrowck-closures-two-mut.rs:42:24
|
||||
--> $DIR/borrowck-closures-two-mut.rs:44:24
|
||||
|
|
||||
LL | let c1 = to_fn_mut(|| x = 5);
|
||||
| -- - previous borrow occurs due to use of `x` in closure
|
||||
|
|
@ -39,12 +39,12 @@ LL | let c2 = to_fn_mut(|| set(&mut x)); //~ ERROR cannot borrow `x` as muta
|
|||
| ^^ - borrow occurs due to use of `x` in closure
|
||||
| |
|
||||
| second mutable borrow occurs here
|
||||
LL | //~| ERROR cannot borrow `x` as mutable more than once
|
||||
...
|
||||
LL | }
|
||||
| - first borrow ends here
|
||||
|
||||
error[E0499]: cannot borrow `x` as mutable more than once at a time (Ast)
|
||||
--> $DIR/borrowck-closures-two-mut.rs:49:24
|
||||
--> $DIR/borrowck-closures-two-mut.rs:52:24
|
||||
|
|
||||
LL | let c1 = to_fn_mut(|| x = 5);
|
||||
| -- - previous borrow occurs due to use of `x` in closure
|
||||
|
|
@ -59,7 +59,7 @@ LL | }
|
|||
| - first borrow ends here
|
||||
|
||||
error[E0499]: cannot borrow `x` as mutable more than once at a time (Ast)
|
||||
--> $DIR/borrowck-closures-two-mut.rs:61:24
|
||||
--> $DIR/borrowck-closures-two-mut.rs:65:24
|
||||
|
|
||||
LL | let c1 = to_fn_mut(|| set(&mut *x.f));
|
||||
| -- - previous borrow occurs due to use of `x` in closure
|
||||
|
|
@ -85,11 +85,11 @@ LL | let c2 = to_fn_mut(|| x = 5); //~ ERROR cannot borrow `x` as mutable mo
|
|||
| |
|
||||
| second mutable borrow occurs here
|
||||
LL | //~| ERROR cannot borrow `x` as mutable more than once
|
||||
LL | }
|
||||
| - first borrow ends here
|
||||
LL | drop((c1, c2));
|
||||
| -- borrow later used here
|
||||
|
||||
error[E0499]: cannot borrow `x` as mutable more than once at a time (Mir)
|
||||
--> $DIR/borrowck-closures-two-mut.rs:35:24
|
||||
--> $DIR/borrowck-closures-two-mut.rs:36:24
|
||||
|
|
||||
LL | let c1 = to_fn_mut(|| set(&mut x));
|
||||
| -- - previous borrow occurs due to use of `x` in closure
|
||||
|
|
@ -100,11 +100,11 @@ LL | let c2 = to_fn_mut(|| set(&mut x)); //~ ERROR cannot borrow `x` as muta
|
|||
| |
|
||||
| second mutable borrow occurs here
|
||||
LL | //~| ERROR cannot borrow `x` as mutable more than once
|
||||
LL | }
|
||||
| - first borrow ends here
|
||||
LL | drop((c1, c2));
|
||||
| -- borrow later used here
|
||||
|
||||
error[E0499]: cannot borrow `x` as mutable more than once at a time (Mir)
|
||||
--> $DIR/borrowck-closures-two-mut.rs:42:24
|
||||
--> $DIR/borrowck-closures-two-mut.rs:44:24
|
||||
|
|
||||
LL | let c1 = to_fn_mut(|| x = 5);
|
||||
| -- - previous borrow occurs due to use of `x` in closure
|
||||
|
|
@ -115,11 +115,11 @@ LL | let c2 = to_fn_mut(|| set(&mut x)); //~ ERROR cannot borrow `x` as muta
|
|||
| |
|
||||
| second mutable borrow occurs here
|
||||
LL | //~| ERROR cannot borrow `x` as mutable more than once
|
||||
LL | }
|
||||
| - first borrow ends here
|
||||
LL | drop((c1, c2));
|
||||
| -- borrow later used here
|
||||
|
||||
error[E0499]: cannot borrow `x` as mutable more than once at a time (Mir)
|
||||
--> $DIR/borrowck-closures-two-mut.rs:49:24
|
||||
--> $DIR/borrowck-closures-two-mut.rs:52:24
|
||||
|
|
||||
LL | let c1 = to_fn_mut(|| x = 5);
|
||||
| -- - previous borrow occurs due to use of `x` in closure
|
||||
|
|
@ -130,11 +130,11 @@ LL | let c2 = to_fn_mut(|| { let _y = to_fn_mut(|| set(&mut x)); }); // (nes
|
|||
| |
|
||||
| second mutable borrow occurs here
|
||||
...
|
||||
LL | }
|
||||
| - first borrow ends here
|
||||
LL | drop((c1, c2));
|
||||
| -- borrow later used here
|
||||
|
||||
error[E0499]: cannot borrow `x` as mutable more than once at a time (Mir)
|
||||
--> $DIR/borrowck-closures-two-mut.rs:61:24
|
||||
--> $DIR/borrowck-closures-two-mut.rs:65:24
|
||||
|
|
||||
LL | let c1 = to_fn_mut(|| set(&mut *x.f));
|
||||
| -- - previous borrow occurs due to use of `x` in closure
|
||||
|
|
@ -145,8 +145,8 @@ LL | let c2 = to_fn_mut(|| set(&mut *x.f));
|
|||
| |
|
||||
| second mutable borrow occurs here
|
||||
...
|
||||
LL | }
|
||||
| - first borrow ends here
|
||||
LL | drop((c1, c2));
|
||||
| -- borrow later used here
|
||||
|
||||
error: aborting due to 10 previous errors
|
||||
|
||||
|
|
|
|||
|
|
@ -8,9 +8,7 @@
|
|||
// option. This file may not be copied, modified, or distributed
|
||||
// except according to those terms.
|
||||
|
||||
// revisions: lxl nll
|
||||
//[lxl]compile-flags: -Z borrowck=mir -Z two-phase-borrows
|
||||
//[nll]compile-flags: -Z borrowck=mir -Z two-phase-borrows -Z nll
|
||||
// compile-flags: -Z borrowck=mir -Z two-phase-borrows
|
||||
|
||||
// run-pass
|
||||
|
||||
|
|
|
|||
|
|
@ -8,9 +8,7 @@
|
|||
// option. This file may not be copied, modified, or distributed
|
||||
// except according to those terms.
|
||||
|
||||
// revisions: lxl nll
|
||||
//[lxl]compile-flags: -Z borrowck=mir -Z two-phase-borrows
|
||||
//[nll]compile-flags: -Z borrowck=mir -Z two-phase-borrows -Z nll
|
||||
// compile-flags: -Z borrowck=mir -Z two-phase-borrows
|
||||
|
||||
// run-pass
|
||||
|
||||
|
|
|
|||
|
|
@ -30,6 +30,7 @@ fn main() {
|
|||
*y.pointer += 1;
|
||||
//~^ ERROR cannot assign to `*y.pointer` because it is borrowed (Ast) [E0506]
|
||||
//~| ERROR cannot use `*y.pointer` because it was mutably borrowed (Mir) [E0503]
|
||||
//~| ERROR cannot assign to `*y.pointer` because it is borrowed (Mir) [E0506]
|
||||
*z.pointer += 1;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -13,8 +13,22 @@ LL | let z = copy_borrowed_ptr(&mut y);
|
|||
| ------ borrow of `y` occurs here
|
||||
LL | *y.pointer += 1;
|
||||
| ^^^^^^^^^^^^^^^ use of borrowed `y`
|
||||
...
|
||||
LL | *z.pointer += 1;
|
||||
| --------------- borrow later used here
|
||||
|
||||
error: aborting due to 2 previous errors
|
||||
error[E0506]: cannot assign to `*y.pointer` because it is borrowed (Mir)
|
||||
--> $DIR/issue-45697-1.rs:30:9
|
||||
|
|
||||
LL | let z = copy_borrowed_ptr(&mut y);
|
||||
| ------ borrow of `*y.pointer` occurs here
|
||||
LL | *y.pointer += 1;
|
||||
| ^^^^^^^^^^^^^^^ assignment to borrowed `*y.pointer` occurs here
|
||||
...
|
||||
LL | *z.pointer += 1;
|
||||
| --------------- borrow later used here
|
||||
|
||||
error: aborting due to 3 previous errors
|
||||
|
||||
Some errors occurred: E0503, E0506.
|
||||
For more information about an error, try `rustc --explain E0503`.
|
||||
|
|
|
|||
|
|
@ -30,6 +30,7 @@ fn main() {
|
|||
*y.pointer += 1;
|
||||
//~^ ERROR cannot assign to `*y.pointer` because it is borrowed (Ast) [E0506]
|
||||
//~| ERROR cannot use `*y.pointer` because it was mutably borrowed (Mir) [E0503]
|
||||
//~| ERROR cannot assign to `*y.pointer` because it is borrowed (Mir) [E0506]
|
||||
*z.pointer += 1;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -13,8 +13,22 @@ LL | let z = copy_borrowed_ptr(&mut y);
|
|||
| ------ borrow of `y` occurs here
|
||||
LL | *y.pointer += 1;
|
||||
| ^^^^^^^^^^^^^^^ use of borrowed `y`
|
||||
...
|
||||
LL | *z.pointer += 1;
|
||||
| --------------- borrow later used here
|
||||
|
||||
error: aborting due to 2 previous errors
|
||||
error[E0506]: cannot assign to `*y.pointer` because it is borrowed (Mir)
|
||||
--> $DIR/issue-45697.rs:30:9
|
||||
|
|
||||
LL | let z = copy_borrowed_ptr(&mut y);
|
||||
| ------ borrow of `*y.pointer` occurs here
|
||||
LL | *y.pointer += 1;
|
||||
| ^^^^^^^^^^^^^^^ assignment to borrowed `*y.pointer` occurs here
|
||||
...
|
||||
LL | *z.pointer += 1;
|
||||
| --------------- borrow later used here
|
||||
|
||||
error: aborting due to 3 previous errors
|
||||
|
||||
Some errors occurred: E0503, E0506.
|
||||
For more information about an error, try `rustc --explain E0503`.
|
||||
|
|
|
|||
|
|
@ -12,13 +12,16 @@ LL | }
|
|||
error[E0597]: `z` does not live long enough (Mir)
|
||||
--> $DIR/issue-46471-1.rs:16:9
|
||||
|
|
||||
LL | &mut z
|
||||
| ^^^^^^ borrowed value does not live long enough
|
||||
LL | };
|
||||
| - `z` dropped here while still borrowed
|
||||
...
|
||||
LL | }
|
||||
| - borrowed value needs to live until here
|
||||
LL | let y = {
|
||||
| _____________-
|
||||
LL | | let mut z = 0;
|
||||
LL | | &mut z
|
||||
| | ^^^^^^ borrowed value does not live long enough
|
||||
LL | | };
|
||||
| | -
|
||||
| | |
|
||||
| |_____borrowed value only lives until here
|
||||
| borrow later used here
|
||||
|
||||
error: aborting due to 2 previous errors
|
||||
|
||||
|
|
|
|||
|
|
@ -22,7 +22,7 @@
|
|||
// that appear free in its type (hence, we see it before the closure's
|
||||
// "external requirements" report).
|
||||
|
||||
// compile-flags:-Znll -Zborrowck=mir -Zverbose
|
||||
// compile-flags:-Zborrowck=mir -Zverbose
|
||||
|
||||
#![feature(rustc_attrs)]
|
||||
|
||||
|
|
@ -35,7 +35,7 @@ fn test() {
|
|||
let y = 22;
|
||||
let mut closure = expect_sig(|p, y| *p = y);
|
||||
//~^ ERROR does not outlive free region
|
||||
//~| WARNING not reporting region error due to -Znll
|
||||
//~| WARNING not reporting region error due to nll
|
||||
closure(&mut p, &y);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
warning: not reporting region error due to -Znll
|
||||
warning: not reporting region error due to nll
|
||||
--> $DIR/escape-argument-callee.rs:36:50
|
||||
|
|
||||
LL | let mut closure = expect_sig(|p, y| *p = y);
|
||||
|
|
|
|||
|
|
@ -22,7 +22,7 @@
|
|||
// basically checking that the MIR type checker correctly enforces the
|
||||
// closure signature.
|
||||
|
||||
// compile-flags:-Znll -Zborrowck=mir -Zverbose
|
||||
// compile-flags:-Zborrowck=mir -Zverbose
|
||||
|
||||
#![feature(rustc_attrs)]
|
||||
|
||||
|
|
|
|||
|
|
@ -15,7 +15,7 @@
|
|||
//
|
||||
// except that the closure does so via a second closure.
|
||||
|
||||
// compile-flags:-Znll -Zborrowck=mir -Zverbose
|
||||
// compile-flags:-Zborrowck=mir -Zverbose
|
||||
|
||||
#![feature(rustc_attrs)]
|
||||
|
||||
|
|
|
|||
|
|
@ -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:-Zborrowck=mir -Zverbose
|
||||
|
||||
#![feature(rustc_attrs)]
|
||||
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@
|
|||
// Test where we fail to approximate due to demanding a postdom
|
||||
// relationship between our upper bounds.
|
||||
|
||||
// compile-flags:-Znll -Zborrowck=mir -Zverbose
|
||||
// compile-flags:-Zborrowck=mir -Zverbose
|
||||
|
||||
#![feature(rustc_attrs)]
|
||||
|
||||
|
|
@ -53,7 +53,7 @@ fn supply<'a, 'b, 'c>(cell_a: Cell<&'a u32>, cell_b: Cell<&'b u32>, cell_c: Cell
|
|||
|_outlives1, _outlives2, _outlives3, x, y| {
|
||||
// Only works if 'x: 'y:
|
||||
let p = x.get();
|
||||
//~^ WARN not reporting region error due to -Znll
|
||||
//~^ WARN not reporting region error due to nll
|
||||
//~| ERROR does not outlive free region
|
||||
demand_y(x, y, p)
|
||||
},
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
warning: not reporting region error due to -Znll
|
||||
warning: not reporting region error due to nll
|
||||
--> $DIR/propagate-approximated-fail-no-postdom.rs:55:21
|
||||
|
|
||||
LL | let p = x.get();
|
||||
|
|
@ -16,7 +16,7 @@ note: No external requirements
|
|||
LL | / |_outlives1, _outlives2, _outlives3, x, y| {
|
||||
LL | | // Only works if 'x: 'y:
|
||||
LL | | let p = x.get();
|
||||
LL | | //~^ WARN not reporting region error due to -Znll
|
||||
LL | | //~^ WARN not reporting region error due to nll
|
||||
LL | | //~| ERROR does not outlive free region
|
||||
LL | | demand_y(x, y, p)
|
||||
LL | | },
|
||||
|
|
|
|||
|
|
@ -22,7 +22,7 @@
|
|||
// Note: the use of `Cell` here is to introduce invariance. One less
|
||||
// variable.
|
||||
|
||||
// compile-flags:-Znll -Zborrowck=mir -Zverbose
|
||||
// compile-flags:-Zborrowck=mir -Zverbose
|
||||
|
||||
#![feature(rustc_attrs)]
|
||||
|
||||
|
|
@ -54,7 +54,7 @@ fn supply<'a, 'b>(cell_a: Cell<&'a u32>, cell_b: Cell<&'b u32>) {
|
|||
//~^ ERROR lifetime mismatch
|
||||
|
||||
// Only works if 'x: 'y:
|
||||
demand_y(x, y, x.get()) //~ WARNING not reporting region error due to -Znll
|
||||
demand_y(x, y, x.get()) //~ WARNING not reporting region error due to nll
|
||||
});
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
warning: not reporting region error due to -Znll
|
||||
warning: not reporting region error due to nll
|
||||
--> $DIR/propagate-approximated-ref.rs:57:9
|
||||
|
|
||||
LL | demand_y(x, y, x.get()) //~ WARNING not reporting region error due to -Znll
|
||||
LL | demand_y(x, y, x.get()) //~ WARNING not reporting region error due to nll
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
note: External requirements
|
||||
|
|
@ -12,7 +12,7 @@ LL | establish_relationships(&cell_a, &cell_b, |_outlives1, _outlives2, x,
|
|||
LL | | //~^ ERROR lifetime mismatch
|
||||
LL | |
|
||||
LL | | // Only works if 'x: 'y:
|
||||
LL | | demand_y(x, y, x.get()) //~ WARNING not reporting region error due to -Znll
|
||||
LL | | demand_y(x, y, x.get()) //~ WARNING not reporting region error due to nll
|
||||
LL | | });
|
||||
| |_____^
|
||||
|
|
||||
|
|
|
|||
|
|
@ -12,7 +12,7 @@
|
|||
// where `'x` is bound in closure type but `'a` is free. This forces
|
||||
// us to approximate `'x` one way or the other.
|
||||
|
||||
// compile-flags:-Znll -Zborrowck=mir -Zverbose
|
||||
// compile-flags:-Zborrowck=mir -Zverbose
|
||||
|
||||
#![feature(rustc_attrs)]
|
||||
|
||||
|
|
@ -29,7 +29,7 @@ fn case1() {
|
|||
let a = 0;
|
||||
let cell = Cell::new(&a);
|
||||
foo(cell, |cell_a, cell_x| {
|
||||
//~^ WARNING not reporting region error due to -Znll
|
||||
//~^ WARNING not reporting region error due to nll
|
||||
cell_a.set(cell_x.get()); // forces 'x: 'a, error in closure
|
||||
//~^ ERROR does not outlive free region
|
||||
})
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
warning: not reporting region error due to -Znll
|
||||
warning: not reporting region error due to nll
|
||||
--> $DIR/propagate-approximated-shorter-to-static-comparing-against-free.rs:31:5
|
||||
|
|
||||
LL | foo(cell, |cell_a, cell_x| {
|
||||
|
|
@ -15,7 +15,7 @@ note: No external requirements
|
|||
|
|
||||
LL | foo(cell, |cell_a, cell_x| {
|
||||
| _______________^
|
||||
LL | | //~^ WARNING not reporting region error due to -Znll
|
||||
LL | | //~^ WARNING not reporting region error due to nll
|
||||
LL | | cell_a.set(cell_x.get()); // forces 'x: 'a, error in closure
|
||||
LL | | //~^ ERROR does not outlive free region
|
||||
LL | | })
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@
|
|||
// FIXME(#45827) Because of shortcomings in the MIR type checker,
|
||||
// these errors are not (yet) reported.
|
||||
|
||||
// compile-flags:-Znll -Zborrowck=mir -Zverbose
|
||||
// compile-flags:-Zborrowck=mir -Zverbose
|
||||
|
||||
#![feature(rustc_attrs)]
|
||||
|
||||
|
|
@ -46,7 +46,7 @@ fn supply<'a, 'b>(cell_a: Cell<&'a u32>, cell_b: Cell<&'b u32>) {
|
|||
//~^ ERROR does not outlive free region
|
||||
|
||||
// Only works if 'x: 'y:
|
||||
demand_y(x, y, x.get()) //~ WARNING not reporting region error due to -Znll
|
||||
demand_y(x, y, x.get()) //~ WARNING not reporting region error due to nll
|
||||
});
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
warning: not reporting region error due to -Znll
|
||||
warning: not reporting region error due to nll
|
||||
--> $DIR/propagate-approximated-shorter-to-static-no-bound.rs:49:9
|
||||
|
|
||||
LL | demand_y(x, y, x.get()) //~ WARNING not reporting region error due to -Znll
|
||||
LL | demand_y(x, y, x.get()) //~ WARNING not reporting region error due to nll
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
note: External requirements
|
||||
|
|
@ -12,7 +12,7 @@ LL | establish_relationships(&cell_a, &cell_b, |_outlives, x, y| {
|
|||
LL | | //~^ ERROR does not outlive free region
|
||||
LL | |
|
||||
LL | | // Only works if 'x: 'y:
|
||||
LL | | demand_y(x, y, x.get()) //~ WARNING not reporting region error due to -Znll
|
||||
LL | | demand_y(x, y, x.get()) //~ WARNING not reporting region error due to nll
|
||||
LL | | });
|
||||
| |_____^
|
||||
|
|
||||
|
|
@ -31,7 +31,7 @@ LL | establish_relationships(&cell_a, &cell_b, |_outlives, x, y| {
|
|||
LL | | //~^ ERROR does not outlive free region
|
||||
LL | |
|
||||
LL | | // Only works if 'x: 'y:
|
||||
LL | | demand_y(x, y, x.get()) //~ WARNING not reporting region error due to -Znll
|
||||
LL | | demand_y(x, y, x.get()) //~ WARNING not reporting region error due to nll
|
||||
LL | | });
|
||||
| |_____^
|
||||
|
||||
|
|
|
|||
|
|
@ -17,7 +17,7 @@
|
|||
// FIXME(#45827) Because of shortcomings in the MIR type checker,
|
||||
// these errors are not (yet) reported.
|
||||
|
||||
// compile-flags:-Znll -Zborrowck=mir -Zverbose
|
||||
// compile-flags:-Zborrowck=mir -Zverbose
|
||||
|
||||
#![feature(rustc_attrs)]
|
||||
|
||||
|
|
@ -49,7 +49,7 @@ fn supply<'a, 'b>(cell_a: Cell<&'a u32>, cell_b: Cell<&'b u32>) {
|
|||
//~^ ERROR does not outlive free region
|
||||
// Only works if 'x: 'y:
|
||||
demand_y(x, y, x.get())
|
||||
//~^ WARNING not reporting region error due to -Znll
|
||||
//~^ WARNING not reporting region error due to nll
|
||||
});
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
warning: not reporting region error due to -Znll
|
||||
warning: not reporting region error due to nll
|
||||
--> $DIR/propagate-approximated-shorter-to-static-wrong-bound.rs:51:9
|
||||
|
|
||||
LL | demand_y(x, y, x.get())
|
||||
|
|
@ -12,7 +12,7 @@ LL | establish_relationships(&cell_a, &cell_b, |_outlives1, _outlives2, x,
|
|||
LL | | //~^ ERROR does not outlive free region
|
||||
LL | | // Only works if 'x: 'y:
|
||||
LL | | demand_y(x, y, x.get())
|
||||
LL | | //~^ WARNING not reporting region error due to -Znll
|
||||
LL | | //~^ WARNING not reporting region error due to nll
|
||||
LL | | });
|
||||
| |_____^
|
||||
|
|
||||
|
|
@ -31,7 +31,7 @@ LL | establish_relationships(&cell_a, &cell_b, |_outlives1, _outlives2, x,
|
|||
LL | | //~^ ERROR does not outlive free region
|
||||
LL | | // Only works if 'x: 'y:
|
||||
LL | | demand_y(x, y, x.get())
|
||||
LL | | //~^ WARNING not reporting region error due to -Znll
|
||||
LL | | //~^ WARNING not reporting region error due to nll
|
||||
LL | | });
|
||||
| |_____^
|
||||
|
||||
|
|
|
|||
|
|
@ -15,7 +15,7 @@
|
|||
// relationships. In the 'main' variant, there are a number of
|
||||
// anonymous regions as well.
|
||||
|
||||
// compile-flags:-Znll -Zborrowck=mir -Zverbose
|
||||
// compile-flags:-Zborrowck=mir -Zverbose
|
||||
|
||||
#![feature(rustc_attrs)]
|
||||
|
||||
|
|
@ -47,7 +47,7 @@ fn test<'a, 'b>(cell_a: Cell<&'a u32>, cell_b: Cell<&'b u32>) {
|
|||
//~^ ERROR lifetime mismatch
|
||||
|
||||
// Only works if 'x: 'y:
|
||||
demand_y(outlives1, outlives2, x.get()) //~ WARNING not reporting region error due to -Znll
|
||||
demand_y(outlives1, outlives2, x.get()) //~ WARNING not reporting region error due to nll
|
||||
});
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
warning: not reporting region error due to -Znll
|
||||
warning: not reporting region error due to nll
|
||||
--> $DIR/propagate-approximated-val.rs:50:9
|
||||
|
|
||||
LL | demand_y(outlives1, outlives2, x.get()) //~ WARNING not reporting region error due to -Znll
|
||||
LL | demand_y(outlives1, outlives2, x.get()) //~ WARNING not reporting region error due to nll
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
note: External requirements
|
||||
|
|
@ -12,7 +12,7 @@ LL | establish_relationships(cell_a, cell_b, |outlives1, outlives2, x, y|
|
|||
LL | | //~^ ERROR lifetime mismatch
|
||||
LL | |
|
||||
LL | | // Only works if 'x: 'y:
|
||||
LL | | demand_y(outlives1, outlives2, x.get()) //~ WARNING not reporting region error due to -Znll
|
||||
LL | | demand_y(outlives1, outlives2, x.get()) //~ WARNING not reporting region error due to nll
|
||||
LL | | });
|
||||
| |_____^
|
||||
|
|
||||
|
|
|
|||
|
|
@ -13,7 +13,7 @@
|
|||
// need to propagate; but in fact we do because identity of free
|
||||
// regions is erased.
|
||||
|
||||
// compile-flags:-Znll -Zborrowck=mir -Zverbose
|
||||
// compile-flags:-Zborrowck=mir -Zverbose
|
||||
// compile-pass
|
||||
|
||||
#![feature(rustc_attrs)]
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
warning: not reporting region error due to -Znll
|
||||
warning: not reporting region error due to nll
|
||||
--> $DIR/propagate-despite-same-free-region.rs:54:21
|
||||
|
|
||||
LL | let p = x.get();
|
||||
|
|
|
|||
|
|
@ -17,7 +17,7 @@
|
|||
// as it knows of no relationships between `'x` and any
|
||||
// non-higher-ranked regions.
|
||||
|
||||
// compile-flags:-Znll -Zborrowck=mir -Zverbose
|
||||
// compile-flags:-Zborrowck=mir -Zverbose
|
||||
|
||||
#![feature(rustc_attrs)]
|
||||
|
||||
|
|
@ -45,7 +45,7 @@ fn supply<'a, 'b>(cell_a: Cell<&'a u32>, cell_b: Cell<&'b u32>) {
|
|||
establish_relationships(&cell_a, &cell_b, |_outlives, x, y| {
|
||||
// Only works if 'x: 'y:
|
||||
demand_y(x, y, x.get())
|
||||
//~^ WARN not reporting region error due to -Znll
|
||||
//~^ WARN not reporting region error due to nll
|
||||
//~| ERROR does not outlive free region
|
||||
});
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
warning: not reporting region error due to -Znll
|
||||
warning: not reporting region error due to nll
|
||||
--> $DIR/propagate-fail-to-approximate-longer-no-bounds.rs:47:9
|
||||
|
|
||||
LL | demand_y(x, y, x.get())
|
||||
|
|
@ -17,7 +17,7 @@ LL | establish_relationships(&cell_a, &cell_b, |_outlives, x, y| {
|
|||
| _______________________________________________^
|
||||
LL | | // Only works if 'x: 'y:
|
||||
LL | | demand_y(x, y, x.get())
|
||||
LL | | //~^ WARN not reporting region error due to -Znll
|
||||
LL | | //~^ WARN not reporting region error due to nll
|
||||
LL | | //~| ERROR does not outlive free region
|
||||
LL | | });
|
||||
| |_____^
|
||||
|
|
|
|||
|
|
@ -17,7 +17,7 @@
|
|||
// as it only knows of regions that `'x` is outlived by, and none that
|
||||
// `'x` outlives.
|
||||
|
||||
// compile-flags:-Znll -Zborrowck=mir -Zverbose
|
||||
// compile-flags:-Zborrowck=mir -Zverbose
|
||||
|
||||
#![feature(rustc_attrs)]
|
||||
|
||||
|
|
@ -49,7 +49,7 @@ fn supply<'a, 'b>(cell_a: Cell<&'a u32>, cell_b: Cell<&'b u32>) {
|
|||
establish_relationships(&cell_a, &cell_b, |_outlives1, _outlives2, x, y| {
|
||||
// Only works if 'x: 'y:
|
||||
demand_y(x, y, x.get())
|
||||
//~^ WARN not reporting region error due to -Znll
|
||||
//~^ WARN not reporting region error due to nll
|
||||
//~| ERROR does not outlive free region
|
||||
});
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
warning: not reporting region error due to -Znll
|
||||
warning: not reporting region error due to nll
|
||||
--> $DIR/propagate-fail-to-approximate-longer-wrong-bounds.rs:51:9
|
||||
|
|
||||
LL | demand_y(x, y, x.get())
|
||||
|
|
@ -17,7 +17,7 @@ LL | establish_relationships(&cell_a, &cell_b, |_outlives1, _outlives2, x,
|
|||
| _______________________________________________^
|
||||
LL | | // Only works if 'x: 'y:
|
||||
LL | | demand_y(x, y, x.get())
|
||||
LL | | //~^ WARN not reporting region error due to -Znll
|
||||
LL | | //~^ WARN not reporting region error due to nll
|
||||
LL | | //~| ERROR does not outlive free region
|
||||
LL | | });
|
||||
| |_____^
|
||||
|
|
|
|||
|
|
@ -14,7 +14,7 @@
|
|||
// the same `'a` for which it implements `Trait`, which can only be the `'a`
|
||||
// from the function definition.
|
||||
|
||||
// compile-flags:-Znll -Zborrowck=mir -Zverbose
|
||||
// compile-flags:-Zborrowck=mir -Zverbose
|
||||
|
||||
#![feature(rustc_attrs)]
|
||||
#![allow(dead_code)]
|
||||
|
|
@ -53,7 +53,7 @@ where
|
|||
// The latter does not hold.
|
||||
|
||||
require(value);
|
||||
//~^ WARNING not reporting region error due to -Znll
|
||||
//~^ WARNING not reporting region error due to nll
|
||||
});
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
warning: not reporting region error due to -Znll
|
||||
warning: not reporting region error due to nll
|
||||
--> $DIR/propagate-from-trait-match.rs:55:9
|
||||
|
|
||||
LL | require(value);
|
||||
|
|
@ -13,7 +13,7 @@ LL | | //~^ ERROR the parameter type `T` may not live long enough
|
|||
LL | |
|
||||
LL | | // This function call requires that
|
||||
... |
|
||||
LL | | //~^ WARNING not reporting region error due to -Znll
|
||||
LL | | //~^ WARNING not reporting region error due to nll
|
||||
LL | | });
|
||||
| |_____^
|
||||
|
|
||||
|
|
@ -35,7 +35,7 @@ LL | | //~^ ERROR the parameter type `T` may not live long enough
|
|||
LL | |
|
||||
LL | | // This function call requires that
|
||||
... |
|
||||
LL | | //~^ WARNING not reporting region error due to -Znll
|
||||
LL | | //~^ WARNING not reporting region error due to nll
|
||||
LL | | });
|
||||
| |_____^
|
||||
|
|
||||
|
|
|
|||
|
|
@ -13,11 +13,11 @@
|
|||
// 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=mir -Zverbose
|
||||
// compile-flags:-Zborrowck=mir -Zverbose
|
||||
|
||||
fn foo(x: &u32) -> &'static u32 {
|
||||
&*x
|
||||
//~^ WARN not reporting region error due to -Znll
|
||||
//~^ WARN not reporting region error due to nll
|
||||
//~| ERROR explicit lifetime required in the type of `x`
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
warning: not reporting region error due to -Znll
|
||||
warning: not reporting region error due to nll
|
||||
--> $DIR/region-lbr-anon-does-not-outlive-static.rs:19:5
|
||||
|
|
||||
LL | &*x
|
||||
|
|
|
|||
|
|
@ -13,11 +13,11 @@
|
|||
// 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=mir -Zverbose
|
||||
// compile-flags:-Zborrowck=mir -Zverbose
|
||||
|
||||
fn foo<'a>(x: &'a u32) -> &'static u32 {
|
||||
&*x
|
||||
//~^ WARN not reporting region error due to -Znll
|
||||
//~^ WARN not reporting region error due to nll
|
||||
//~| ERROR does not outlive free region
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
warning: not reporting region error due to -Znll
|
||||
warning: not reporting region error due to nll
|
||||
--> $DIR/region-lbr-named-does-not-outlive-static.rs:19:5
|
||||
|
|
||||
LL | &*x
|
||||
|
|
|
|||
|
|
@ -13,11 +13,11 @@
|
|||
// 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=mir -Zverbose
|
||||
// compile-flags:-Zborrowck=mir -Zverbose
|
||||
|
||||
fn foo<'a, 'b>(x: &'a u32, y: &'b u32) -> &'b u32 {
|
||||
&*x
|
||||
//~^ WARN not reporting region error due to -Znll
|
||||
//~^ WARN not reporting region error due to nll
|
||||
//~| ERROR lifetime mismatch
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
warning: not reporting region error due to -Znll
|
||||
warning: not reporting region error due to nll
|
||||
--> $DIR/region-lbr1-does-not-outlive-ebr2.rs:19:5
|
||||
|
|
||||
LL | &*x
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@
|
|||
// Basic test for free regions in the NLL code. This test does not
|
||||
// report an error because of the (implied) bound that `'b: 'a`.
|
||||
|
||||
// compile-flags:-Znll -Zborrowck=mir -Zverbose
|
||||
// compile-flags:-Zborrowck=mir -Zverbose
|
||||
// compile-pass
|
||||
|
||||
#![allow(warnings)]
|
||||
|
|
|
|||
|
|
@ -12,14 +12,14 @@
|
|||
// the first, but actually returns the second. This should fail within
|
||||
// the closure.
|
||||
|
||||
// compile-flags:-Znll -Zborrowck=mir -Zverbose
|
||||
// compile-flags:-Zborrowck=mir -Zverbose
|
||||
|
||||
#![feature(rustc_attrs)]
|
||||
|
||||
#[rustc_regions]
|
||||
fn test() {
|
||||
expect_sig(|a, b| b); // ought to return `a`
|
||||
//~^ WARN not reporting region error due to -Znll
|
||||
//~^ WARN not reporting region error due to nll
|
||||
//~| ERROR does not outlive free region
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
warning: not reporting region error due to -Znll
|
||||
warning: not reporting region error due to nll
|
||||
--> $DIR/return-wrong-bound-region.rs:21:23
|
||||
|
|
||||
LL | expect_sig(|a, b| b); // ought to return `a`
|
||||
|
|
@ -26,7 +26,7 @@ note: No external requirements
|
|||
|
|
||||
LL | / fn test() {
|
||||
LL | | expect_sig(|a, b| b); // ought to return `a`
|
||||
LL | | //~^ WARN not reporting region error due to -Znll
|
||||
LL | | //~^ WARN not reporting region error due to nll
|
||||
LL | | //~| ERROR does not outlive free region
|
||||
LL | | }
|
||||
| |_^
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@
|
|||
// Test that MIR borrowck and NLL analysis can handle constants of
|
||||
// arbitrary types without ICEs.
|
||||
|
||||
// compile-flags:-Znll -Zborrowck=mir -Zverbose
|
||||
// compile-flags:-Zborrowck=mir -Zverbose
|
||||
// compile-pass
|
||||
|
||||
const HI: &str = "hi";
|
||||
|
|
|
|||
|
|
@ -12,7 +12,7 @@
|
|||
// in the type of `p` includes the points after `&v[0]` up to (but not
|
||||
// including) the call to `use_x`. The `else` branch is not included.
|
||||
|
||||
// compile-flags:-Znll -Zborrowck=mir
|
||||
// compile-flags:-Zborrowck=mir
|
||||
// compile-pass
|
||||
|
||||
#![allow(warnings)]
|
||||
|
|
|
|||
|
|
@ -13,7 +13,7 @@
|
|||
// because of destructor. (Note that the stderr also identifies this
|
||||
// destructor in the error message.)
|
||||
|
||||
// compile-flags:-Znll -Zborrowck=mir
|
||||
// compile-flags:-Zborrowck=mir
|
||||
|
||||
#![allow(warnings)]
|
||||
#![feature(dropck_eyepatch)]
|
||||
|
|
|
|||
|
|
@ -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:-Zborrowck=compare
|
||||
|
||||
struct Map {
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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 -Znll
|
||||
//compile-flags: -Z emit-end-regions -Zborrowck=mir
|
||||
|
||||
|
||||
#![allow(warnings)]
|
||||
|
|
|
|||
|
|
@ -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
|
||||
// compile-pass
|
||||
|
||||
#![allow(warnings)]
|
||||
|
|
|
|||
|
|
@ -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 -Znll
|
||||
//compile-flags: -Z emit-end-regions -Zborrowck=mir
|
||||
|
||||
#![allow(warnings)]
|
||||
|
||||
|
|
|
|||
|
|
@ -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 -Znll
|
||||
//compile-flags: -Z emit-end-regions -Zborrowck=mir
|
||||
|
||||
#![allow(warnings)]
|
||||
|
||||
|
|
|
|||
|
|
@ -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 -Znll
|
||||
//compile-flags: -Z emit-end-regions -Zborrowck=mir
|
||||
|
||||
#![allow(warnings)]
|
||||
|
||||
|
|
|
|||
|
|
@ -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:-Zborrowck=mir
|
||||
// compile-pass
|
||||
|
||||
#![feature(rustc_attrs)]
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@
|
|||
// option. This file may not be copied, modified, or distributed
|
||||
// except according to those terms.
|
||||
|
||||
// compile-flags:-Znll -Zborrowck=mir -Zverbose
|
||||
// compile-flags:-Zborrowck=mir -Zverbose
|
||||
|
||||
#![allow(warnings)]
|
||||
|
||||
|
|
@ -19,7 +19,7 @@ impl<'a, T> Foo<'a> for T { }
|
|||
|
||||
fn foo<'a, T>(x: &T) -> impl Foo<'a> {
|
||||
x
|
||||
//~^ WARNING not reporting region error due to -Znll
|
||||
//~^ WARNING not reporting region error due to nll
|
||||
//~| ERROR explicit lifetime required in the type of `x` [E0621]
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
warning: not reporting region error due to -Znll
|
||||
warning: not reporting region error due to nll
|
||||
--> $DIR/impl-trait-captures.rs:21:5
|
||||
|
|
||||
LL | x
|
||||
|
|
|
|||
|
|
@ -8,14 +8,14 @@
|
|||
// option. This file may not be copied, modified, or distributed
|
||||
// except according to those terms.
|
||||
|
||||
// compile-flags:-Znll -Zborrowck=mir -Zverbose
|
||||
// compile-flags:-Zborrowck=mir -Zverbose
|
||||
|
||||
#![allow(warnings)]
|
||||
|
||||
use std::fmt::Debug;
|
||||
|
||||
fn no_region<'a, T>(x: Box<T>) -> impl Debug + 'a
|
||||
//~^ WARNING not reporting region error due to -Znll
|
||||
//~^ WARNING not reporting region error due to nll
|
||||
where
|
||||
T: Debug,
|
||||
{
|
||||
|
|
@ -31,7 +31,7 @@ where
|
|||
}
|
||||
|
||||
fn wrong_region<'a, 'b, T>(x: Box<T>) -> impl Debug + 'a
|
||||
//~^ WARNING not reporting region error due to -Znll
|
||||
//~^ WARNING not reporting region error due to nll
|
||||
where
|
||||
T: 'b + Debug,
|
||||
{
|
||||
|
|
|
|||
|
|
@ -1,10 +1,10 @@
|
|||
warning: not reporting region error due to -Znll
|
||||
warning: not reporting region error due to nll
|
||||
--> $DIR/impl-trait-outlives.rs:17:35
|
||||
|
|
||||
LL | fn no_region<'a, T>(x: Box<T>) -> impl Debug + 'a
|
||||
| ^^^^^^^^^^^^^^^
|
||||
|
||||
warning: not reporting region error due to -Znll
|
||||
warning: not reporting region error due to nll
|
||||
--> $DIR/impl-trait-outlives.rs:33:42
|
||||
|
|
||||
LL | fn wrong_region<'a, 'b, T>(x: Box<T>) -> impl Debug + 'a
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@
|
|||
// option. This file may not be copied, modified, or distributed
|
||||
// except according to those terms.
|
||||
|
||||
// compile-flags:-Znll -Zborrowck=mir -Zverbose
|
||||
// compile-flags:-Zborrowck=mir -Zverbose
|
||||
|
||||
// Test that we can deduce when projections like `T::Item` outlive the
|
||||
// function body. Test that this does not imply that `T: 'a` holds.
|
||||
|
|
@ -43,7 +43,7 @@ where
|
|||
#[rustc_errors]
|
||||
fn generic2<T: Iterator>(value: T) {
|
||||
twice(value, |value_ref, item| invoke2(value_ref, item));
|
||||
//~^ WARNING not reporting region error due to -Znll
|
||||
//~^ WARNING not reporting region error due to nll
|
||||
//~| ERROR the parameter type `T` may not live long enough
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
warning: not reporting region error due to -Znll
|
||||
warning: not reporting region error due to nll
|
||||
--> $DIR/projection-implied-bounds.rs:45:36
|
||||
|
|
||||
LL | twice(value, |value_ref, item| invoke2(value_ref, item));
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@
|
|||
// option. This file may not be copied, modified, or distributed
|
||||
// except according to those terms.
|
||||
|
||||
// compile-flags:-Znll -Zborrowck=mir -Zverbose
|
||||
// compile-flags:-Zborrowck=mir -Zverbose
|
||||
|
||||
// Tests closures that propagate an outlives relationship to their
|
||||
// creator where the subject is a projection with no regions (`<T as
|
||||
|
|
@ -34,7 +34,7 @@ where
|
|||
T: Iterator,
|
||||
{
|
||||
with_signature(x, |mut y| Box::new(y.next()))
|
||||
//~^ WARNING not reporting region error due to -Znll
|
||||
//~^ WARNING not reporting region error due to nll
|
||||
//~| ERROR the associated type `<T as std::iter::Iterator>::Item` may not live long enough
|
||||
}
|
||||
|
||||
|
|
@ -52,7 +52,7 @@ where
|
|||
T: 'b + Iterator,
|
||||
{
|
||||
with_signature(x, |mut y| Box::new(y.next()))
|
||||
//~^ WARNING not reporting region error due to -Znll
|
||||
//~^ WARNING not reporting region error due to nll
|
||||
//~| ERROR the associated type `<T as std::iter::Iterator>::Item` may not live long enough
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,10 +1,10 @@
|
|||
warning: not reporting region error due to -Znll
|
||||
warning: not reporting region error due to nll
|
||||
--> $DIR/projection-no-regions-closure.rs:36:31
|
||||
|
|
||||
LL | with_signature(x, |mut y| Box::new(y.next()))
|
||||
| ^^^^^^^^^^^^^^^^^^
|
||||
|
||||
warning: not reporting region error due to -Znll
|
||||
warning: not reporting region error due to nll
|
||||
--> $DIR/projection-no-regions-closure.rs:54:31
|
||||
|
|
||||
LL | with_signature(x, |mut y| Box::new(y.next()))
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@
|
|||
// option. This file may not be copied, modified, or distributed
|
||||
// except according to those terms.
|
||||
|
||||
// compile-flags:-Znll -Zborrowck=mir -Zverbose
|
||||
// compile-flags:-Zborrowck=mir -Zverbose
|
||||
|
||||
#![allow(warnings)]
|
||||
#![feature(dyn_trait)]
|
||||
|
|
@ -22,7 +22,7 @@ where
|
|||
T: Iterator,
|
||||
{
|
||||
Box::new(x.next())
|
||||
//~^ WARNING not reporting region error due to -Znll
|
||||
//~^ WARNING not reporting region error due to nll
|
||||
//~| the associated type `<T as std::iter::Iterator>::Item` may not live long enough
|
||||
}
|
||||
|
||||
|
|
@ -38,7 +38,7 @@ where
|
|||
T: 'b + Iterator,
|
||||
{
|
||||
Box::new(x.next())
|
||||
//~^ WARNING not reporting region error due to -Znll
|
||||
//~^ WARNING not reporting region error due to nll
|
||||
//~| the associated type `<T as std::iter::Iterator>::Item` may not live long enough
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,10 +1,10 @@
|
|||
warning: not reporting region error due to -Znll
|
||||
warning: not reporting region error due to nll
|
||||
--> $DIR/projection-no-regions-fn.rs:24:5
|
||||
|
|
||||
LL | Box::new(x.next())
|
||||
| ^^^^^^^^^^^^^^^^^^
|
||||
|
||||
warning: not reporting region error due to -Znll
|
||||
warning: not reporting region error due to nll
|
||||
--> $DIR/projection-no-regions-fn.rs:40:5
|
||||
|
|
||||
LL | Box::new(x.next())
|
||||
|
|
|
|||
|
|
@ -22,7 +22,7 @@
|
|||
//
|
||||
// Ensuring that both `T: 'a` and `'b: 'a` holds does work (`elements_outlive`).
|
||||
|
||||
// compile-flags:-Znll -Zborrowck=mir -Zverbose
|
||||
// compile-flags:-Zborrowck=mir -Zverbose
|
||||
|
||||
#![allow(warnings)]
|
||||
#![feature(dyn_trait)]
|
||||
|
|
@ -54,7 +54,7 @@ where
|
|||
T: Anything<'b>,
|
||||
{
|
||||
with_signature(cell, t, |cell, t| require(cell, t));
|
||||
//~^ WARNING not reporting region error due to -Znll
|
||||
//~^ WARNING not reporting region error due to nll
|
||||
//~| ERROR the parameter type `T` may not live long enough
|
||||
//~| ERROR does not outlive free region
|
||||
}
|
||||
|
|
@ -66,7 +66,7 @@ where
|
|||
'a: 'a,
|
||||
{
|
||||
with_signature(cell, t, |cell, t| require(cell, t));
|
||||
//~^ WARNING not reporting region error due to -Znll
|
||||
//~^ WARNING not reporting region error due to nll
|
||||
//~| ERROR the parameter type `T` may not live long enough
|
||||
//~| ERROR does not outlive free region
|
||||
}
|
||||
|
|
@ -88,7 +88,7 @@ where
|
|||
// can do better here with a more involved verification step.
|
||||
|
||||
with_signature(cell, t, |cell, t| require(cell, t));
|
||||
//~^ WARNING not reporting region error due to -Znll
|
||||
//~^ WARNING not reporting region error due to nll
|
||||
//~| ERROR the parameter type `T` may not live long enough
|
||||
//~| ERROR free region `ReEarlyBound(1, 'b)` does not outlive free region `ReEarlyBound(0, 'a)`
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,16 +1,16 @@
|
|||
warning: not reporting region error due to -Znll
|
||||
warning: not reporting region error due to nll
|
||||
--> $DIR/projection-one-region-closure.rs:56:39
|
||||
|
|
||||
LL | with_signature(cell, t, |cell, t| require(cell, t));
|
||||
| ^^^^^^^
|
||||
|
||||
warning: not reporting region error due to -Znll
|
||||
warning: not reporting region error due to nll
|
||||
--> $DIR/projection-one-region-closure.rs:68:39
|
||||
|
|
||||
LL | with_signature(cell, t, |cell, t| require(cell, t));
|
||||
| ^^^^^^^
|
||||
|
||||
warning: not reporting region error due to -Znll
|
||||
warning: not reporting region error due to nll
|
||||
--> $DIR/projection-one-region-closure.rs:90:39
|
||||
|
|
||||
LL | with_signature(cell, t, |cell, t| require(cell, t));
|
||||
|
|
|
|||
|
|
@ -14,7 +14,7 @@
|
|||
// case, the best way to satisfy the trait bound is to show that `'b:
|
||||
// 'a`, which can be done in various ways.
|
||||
|
||||
// compile-flags:-Znll -Zborrowck=mir -Zverbose
|
||||
// compile-flags:-Zborrowck=mir -Zverbose
|
||||
|
||||
#![allow(warnings)]
|
||||
#![feature(dyn_trait)]
|
||||
|
|
@ -46,7 +46,7 @@ where
|
|||
T: Anything<'b>,
|
||||
{
|
||||
with_signature(cell, t, |cell, t| require(cell, t));
|
||||
//~^ WARNING not reporting region error due to -Znll
|
||||
//~^ WARNING not reporting region error due to nll
|
||||
//~| ERROR does not outlive free region
|
||||
}
|
||||
|
||||
|
|
@ -57,7 +57,7 @@ where
|
|||
'a: 'a,
|
||||
{
|
||||
with_signature(cell, t, |cell, t| require(cell, t));
|
||||
//~^ WARNING not reporting region error due to -Znll
|
||||
//~^ WARNING not reporting region error due to nll
|
||||
//~| ERROR does not outlive free region
|
||||
}
|
||||
|
||||
|
|
@ -78,7 +78,7 @@ where
|
|||
// can do better here with a more involved verification step.
|
||||
|
||||
with_signature(cell, t, |cell, t| require(cell, t));
|
||||
//~^ WARNING not reporting region error due to -Znll
|
||||
//~^ WARNING not reporting region error due to nll
|
||||
//~| ERROR does not outlive free region
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,16 +1,16 @@
|
|||
warning: not reporting region error due to -Znll
|
||||
warning: not reporting region error due to nll
|
||||
--> $DIR/projection-one-region-trait-bound-closure.rs:48:39
|
||||
|
|
||||
LL | with_signature(cell, t, |cell, t| require(cell, t));
|
||||
| ^^^^^^^
|
||||
|
||||
warning: not reporting region error due to -Znll
|
||||
warning: not reporting region error due to nll
|
||||
--> $DIR/projection-one-region-trait-bound-closure.rs:59:39
|
||||
|
|
||||
LL | with_signature(cell, t, |cell, t| require(cell, t));
|
||||
| ^^^^^^^
|
||||
|
||||
warning: not reporting region error due to -Znll
|
||||
warning: not reporting region error due to nll
|
||||
--> $DIR/projection-one-region-trait-bound-closure.rs:80:39
|
||||
|
|
||||
LL | with_signature(cell, t, |cell, t| require(cell, t));
|
||||
|
|
|
|||
|
|
@ -12,7 +12,7 @@
|
|||
// outlive `'static`. In this case, we don't get any errors, and in fact
|
||||
// we don't even propagate constraints from the closures to the callers.
|
||||
|
||||
// compile-flags:-Znll -Zborrowck=mir -Zverbose
|
||||
// compile-flags:-Zborrowck=mir -Zverbose
|
||||
// compile-pass
|
||||
|
||||
#![allow(warnings)]
|
||||
|
|
|
|||
|
|
@ -15,7 +15,7 @@
|
|||
// the trait bound, and hence we propagate it to the caller as a type
|
||||
// test.
|
||||
|
||||
// compile-flags:-Znll -Zborrowck=mir -Zverbose
|
||||
// compile-flags:-Zborrowck=mir -Zverbose
|
||||
|
||||
#![allow(warnings)]
|
||||
#![feature(dyn_trait)]
|
||||
|
|
@ -47,7 +47,7 @@ where
|
|||
T: Anything<'b, 'c>,
|
||||
{
|
||||
with_signature(cell, t, |cell, t| require(cell, t));
|
||||
//~^ WARNING not reporting region error due to -Znll
|
||||
//~^ WARNING not reporting region error due to nll
|
||||
//~| ERROR associated type `<T as Anything<'_#5r, '_#6r>>::AssocType` may not live long enough
|
||||
}
|
||||
|
||||
|
|
@ -58,7 +58,7 @@ where
|
|||
'a: 'a,
|
||||
{
|
||||
with_signature(cell, t, |cell, t| require(cell, t));
|
||||
//~^ WARNING not reporting region error due to -Znll
|
||||
//~^ WARNING not reporting region error due to nll
|
||||
//~| ERROR associated type `<T as Anything<'_#6r, '_#7r>>::AssocType` may not live long enough
|
||||
}
|
||||
|
||||
|
|
@ -79,7 +79,7 @@ where
|
|||
// can do better here with a more involved verification step.
|
||||
|
||||
with_signature(cell, t, |cell, t| require(cell, t));
|
||||
//~^ WARNING not reporting region error due to -Znll
|
||||
//~^ WARNING not reporting region error due to nll
|
||||
//~| ERROR associated type `<T as Anything<'_#6r, '_#7r>>::AssocType` may not live long enough
|
||||
}
|
||||
|
||||
|
|
@ -107,7 +107,7 @@ where
|
|||
T: Anything<'b, 'b>,
|
||||
{
|
||||
with_signature(cell, t, |cell, t| require(cell, t));
|
||||
//~^ WARNING not reporting region error due to -Znll
|
||||
//~^ WARNING not reporting region error due to nll
|
||||
//~| ERROR does not outlive free region
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,22 +1,22 @@
|
|||
warning: not reporting region error due to -Znll
|
||||
warning: not reporting region error due to nll
|
||||
--> $DIR/projection-two-region-trait-bound-closure.rs:49:39
|
||||
|
|
||||
LL | with_signature(cell, t, |cell, t| require(cell, t));
|
||||
| ^^^^^^^
|
||||
|
||||
warning: not reporting region error due to -Znll
|
||||
warning: not reporting region error due to nll
|
||||
--> $DIR/projection-two-region-trait-bound-closure.rs:60:39
|
||||
|
|
||||
LL | with_signature(cell, t, |cell, t| require(cell, t));
|
||||
| ^^^^^^^
|
||||
|
||||
warning: not reporting region error due to -Znll
|
||||
warning: not reporting region error due to nll
|
||||
--> $DIR/projection-two-region-trait-bound-closure.rs:81:39
|
||||
|
|
||||
LL | with_signature(cell, t, |cell, t| require(cell, t));
|
||||
| ^^^^^^^
|
||||
|
||||
warning: not reporting region error due to -Znll
|
||||
warning: not reporting region error due to nll
|
||||
--> $DIR/projection-two-region-trait-bound-closure.rs:109:39
|
||||
|
|
||||
LL | with_signature(cell, t, |cell, t| require(cell, t));
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@
|
|||
// option. This file may not be copied, modified, or distributed
|
||||
// except according to those terms.
|
||||
|
||||
// compile-flags:-Znll -Zborrowck=mir -Zverbose
|
||||
// compile-flags:-Zborrowck=mir -Zverbose
|
||||
|
||||
#![allow(warnings)]
|
||||
#![feature(dyn_trait)]
|
||||
|
|
|
|||
|
|
@ -1,16 +1,16 @@
|
|||
warning: not reporting region error due to -Znll
|
||||
warning: not reporting region error due to nll
|
||||
--> $DIR/ty-param-closure-approximate-lower-bound.rs:35:31
|
||||
|
|
||||
LL | twice(cell, value, |a, b| invoke(a, b));
|
||||
| ^^^^^^^^^^^^
|
||||
|
||||
warning: not reporting region error due to -Znll
|
||||
warning: not reporting region error due to nll
|
||||
--> $DIR/ty-param-closure-approximate-lower-bound.rs:43:31
|
||||
|
|
||||
LL | twice(cell, value, |a, b| invoke(a, b));
|
||||
| ^^^^^^
|
||||
|
||||
warning: not reporting region error due to -Znll
|
||||
warning: not reporting region error due to nll
|
||||
--> $DIR/ty-param-closure-approximate-lower-bound.rs:43:31
|
||||
|
|
||||
LL | twice(cell, value, |a, b| invoke(a, b));
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@
|
|||
// option. This file may not be copied, modified, or distributed
|
||||
// except according to those terms.
|
||||
|
||||
// compile-flags:-Znll -Zborrowck=mir -Zverbose
|
||||
// compile-flags:-Zborrowck=mir -Zverbose
|
||||
|
||||
#![allow(warnings)]
|
||||
#![feature(dyn_trait)]
|
||||
|
|
@ -35,7 +35,7 @@ where
|
|||
// `'a` (and subsequently reports an error).
|
||||
|
||||
with_signature(x, |y| y)
|
||||
//~^ WARNING not reporting region error due to -Znll
|
||||
//~^ WARNING not reporting region error due to nll
|
||||
//~| ERROR the parameter type `T` may not live long enough
|
||||
}
|
||||
|
||||
|
|
@ -51,7 +51,7 @@ where
|
|||
T: 'b + Debug,
|
||||
{
|
||||
x
|
||||
//~^ WARNING not reporting region error due to -Znll
|
||||
//~^ WARNING not reporting region error due to nll
|
||||
//~| ERROR the parameter type `T` may not live long enough
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,10 +1,10 @@
|
|||
warning: not reporting region error due to -Znll
|
||||
warning: not reporting region error due to nll
|
||||
--> $DIR/ty-param-closure-outlives-from-return-type.rs:37:27
|
||||
|
|
||||
LL | with_signature(x, |y| y)
|
||||
| ^
|
||||
|
||||
warning: not reporting region error due to -Znll
|
||||
warning: not reporting region error due to nll
|
||||
--> $DIR/ty-param-closure-outlives-from-return-type.rs:53:5
|
||||
|
|
||||
LL | x
|
||||
|
|
|
|||
|
|
@ -12,7 +12,7 @@
|
|||
// `correct_region` for an explanation of how this test is setup; it's
|
||||
// somewhat intricate.
|
||||
|
||||
// compile-flags:-Znll -Zborrowck=mir -Zverbose
|
||||
// compile-flags:-Zborrowck=mir -Zverbose
|
||||
|
||||
#![allow(warnings)]
|
||||
#![feature(dyn_trait)]
|
||||
|
|
@ -43,7 +43,7 @@ fn no_region<'a, T>(a: Cell<&'a ()>, b: T) {
|
|||
// function, there is no where clause *anywhere*, and hence we
|
||||
// get an error (but reported by the closure creator).
|
||||
require(&x, &y)
|
||||
//~^ WARNING not reporting region error due to -Znll
|
||||
//~^ WARNING not reporting region error due to nll
|
||||
})
|
||||
}
|
||||
|
||||
|
|
@ -77,7 +77,7 @@ where
|
|||
//~^ ERROR the parameter type `T` may not live long enough
|
||||
// See `correct_region`
|
||||
require(&x, &y)
|
||||
//~^ WARNING not reporting region error due to -Znll
|
||||
//~^ WARNING not reporting region error due to nll
|
||||
})
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,10 +1,10 @@
|
|||
warning: not reporting region error due to -Znll
|
||||
warning: not reporting region error due to nll
|
||||
--> $DIR/ty-param-closure-outlives-from-where-clause.rs:45:9
|
||||
|
|
||||
LL | require(&x, &y)
|
||||
| ^^^^^^^
|
||||
|
||||
warning: not reporting region error due to -Znll
|
||||
warning: not reporting region error due to nll
|
||||
--> $DIR/ty-param-closure-outlives-from-where-clause.rs:79:9
|
||||
|
|
||||
LL | require(&x, &y)
|
||||
|
|
@ -19,7 +19,7 @@ LL | | //~^ ERROR the parameter type `T` may not live long enough
|
|||
LL | | //
|
||||
LL | | // See `correct_region`, which explains the point of this
|
||||
... |
|
||||
LL | | //~^ WARNING not reporting region error due to -Znll
|
||||
LL | | //~^ WARNING not reporting region error due to nll
|
||||
LL | | })
|
||||
| |_____^
|
||||
|
|
||||
|
|
@ -40,7 +40,7 @@ LL | | //~^ ERROR the parameter type `T` may not live long enough
|
|||
LL | | //
|
||||
LL | | // See `correct_region`, which explains the point of this
|
||||
... |
|
||||
LL | | //~^ WARNING not reporting region error due to -Znll
|
||||
LL | | //~^ WARNING not reporting region error due to nll
|
||||
LL | | })
|
||||
| |_____^
|
||||
|
|
||||
|
|
@ -109,7 +109,7 @@ LL | with_signature(a, b, |x, y| {
|
|||
LL | | //~^ ERROR the parameter type `T` may not live long enough
|
||||
LL | | // See `correct_region`
|
||||
LL | | require(&x, &y)
|
||||
LL | | //~^ WARNING not reporting region error due to -Znll
|
||||
LL | | //~^ WARNING not reporting region error due to nll
|
||||
LL | | })
|
||||
| |_____^
|
||||
|
|
||||
|
|
@ -130,7 +130,7 @@ LL | with_signature(a, b, |x, y| {
|
|||
LL | | //~^ ERROR the parameter type `T` may not live long enough
|
||||
LL | | // See `correct_region`
|
||||
LL | | require(&x, &y)
|
||||
LL | | //~^ WARNING not reporting region error due to -Znll
|
||||
LL | | //~^ WARNING not reporting region error due to nll
|
||||
LL | | })
|
||||
| |_____^
|
||||
|
|
||||
|
|
|
|||
|
|
@ -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:-Zborrowck=mir
|
||||
|
||||
// Test that we assume that universal types like `T` outlive the
|
||||
// function body.
|
||||
|
|
@ -28,7 +28,7 @@ fn region_within_body<T>(t: T) {
|
|||
// Error here, because T: 'a is not satisfied.
|
||||
fn region_static<'a, T>(cell: Cell<&'a usize>, t: T) {
|
||||
outlives(cell, t)
|
||||
//~^ WARNING not reporting region error due to -Znll
|
||||
//~^ WARNING not reporting region error due to nll
|
||||
//~| ERROR the parameter type `T` may not live long enough
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
warning: not reporting region error due to -Znll
|
||||
warning: not reporting region error due to nll
|
||||
--> $DIR/ty-param-fn-body.rs:30:5
|
||||
|
|
||||
LL | outlives(cell, t)
|
||||
|
|
|
|||
|
|
@ -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:-Zborrowck=mir
|
||||
|
||||
#![allow(warnings)]
|
||||
#![feature(dyn_trait)]
|
||||
|
|
@ -20,7 +20,7 @@ where
|
|||
T: Debug,
|
||||
{
|
||||
x
|
||||
//~^ WARNING not reporting region error due to -Znll
|
||||
//~^ WARNING not reporting region error due to nll
|
||||
//~| the parameter type `T` may not live long enough
|
||||
}
|
||||
|
||||
|
|
@ -36,7 +36,7 @@ where
|
|||
T: 'b + Debug,
|
||||
{
|
||||
x
|
||||
//~^ WARNING not reporting region error due to -Znll
|
||||
//~^ WARNING not reporting region error due to nll
|
||||
//~| the parameter type `T` may not live long enough
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,10 +1,10 @@
|
|||
warning: not reporting region error due to -Znll
|
||||
warning: not reporting region error due to nll
|
||||
--> $DIR/ty-param-fn.rs:22:5
|
||||
|
|
||||
LL | x
|
||||
| ^
|
||||
|
||||
warning: not reporting region error due to -Znll
|
||||
warning: not reporting region error due to nll
|
||||
--> $DIR/ty-param-fn.rs:38:5
|
||||
|
|
||||
LL | x
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@
|
|||
// option. This file may not be copied, modified, or distributed
|
||||
// except according to those terms.
|
||||
|
||||
// compile-flags:-Znll -Zborrowck=mir -Zverbose
|
||||
// compile-flags:-Zborrowck=mir -Zverbose
|
||||
// compile-pass
|
||||
|
||||
// Test that we assume that universal types like `T` outlive the
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue