diff --git a/src/test/ui/regions/issue-28848.stderr b/src/test/ui/regions/issue-28848.base.stderr similarity index 84% rename from src/test/ui/regions/issue-28848.stderr rename to src/test/ui/regions/issue-28848.base.stderr index afa0c9c76b2c5..f10b19738c423 100644 --- a/src/test/ui/regions/issue-28848.stderr +++ b/src/test/ui/regions/issue-28848.base.stderr @@ -1,16 +1,16 @@ error[E0478]: lifetime bound not satisfied - --> $DIR/issue-28848.rs:10:5 + --> $DIR/issue-28848.rs:14:5 | LL | Foo::<'a, 'b>::xmute(u) | ^^^^^^^^^^^^^ | note: lifetime parameter instantiated with the lifetime `'b` as defined here - --> $DIR/issue-28848.rs:9:16 + --> $DIR/issue-28848.rs:13:16 | LL | pub fn foo<'a, 'b>(u: &'b ()) -> &'a () { | ^^ note: but lifetime parameter must outlive the lifetime `'a` as defined here - --> $DIR/issue-28848.rs:9:12 + --> $DIR/issue-28848.rs:13:12 | LL | pub fn foo<'a, 'b>(u: &'b ()) -> &'a () { | ^^ diff --git a/src/test/ui/regions/issue-28848.nll.stderr b/src/test/ui/regions/issue-28848.nll.stderr index a29dac4c9c87c..f9de8948272af 100644 --- a/src/test/ui/regions/issue-28848.nll.stderr +++ b/src/test/ui/regions/issue-28848.nll.stderr @@ -1,5 +1,5 @@ error: lifetime may not live long enough - --> $DIR/issue-28848.rs:10:5 + --> $DIR/issue-28848.rs:14:5 | LL | pub fn foo<'a, 'b>(u: &'b ()) -> &'a () { | -- -- lifetime `'b` defined here diff --git a/src/test/ui/regions/issue-28848.rs b/src/test/ui/regions/issue-28848.rs index a62502390302b..d8ab42a08d448 100644 --- a/src/test/ui/regions/issue-28848.rs +++ b/src/test/ui/regions/issue-28848.rs @@ -1,3 +1,7 @@ +// revisions: base nll +// ignore-compare-mode-nll +//[nll] compile-flags: -Z borrowck=mir + struct Foo<'a, 'b: 'a>(&'a &'b ()); impl<'a, 'b> Foo<'a, 'b> { @@ -7,7 +11,9 @@ impl<'a, 'b> Foo<'a, 'b> { } pub fn foo<'a, 'b>(u: &'b ()) -> &'a () { - Foo::<'a, 'b>::xmute(u) //~ ERROR lifetime bound not satisfied + Foo::<'a, 'b>::xmute(u) + //[base]~^ ERROR lifetime bound not satisfied + //[nll]~^^ ERROR lifetime may not live long enough } fn main() {} diff --git a/src/test/ui/regions/region-invariant-static-error-reporting.stderr b/src/test/ui/regions/region-invariant-static-error-reporting.base.stderr similarity index 86% rename from src/test/ui/regions/region-invariant-static-error-reporting.stderr rename to src/test/ui/regions/region-invariant-static-error-reporting.base.stderr index 34287070eec77..ce21751a95a26 100644 --- a/src/test/ui/regions/region-invariant-static-error-reporting.stderr +++ b/src/test/ui/regions/region-invariant-static-error-reporting.base.stderr @@ -1,5 +1,5 @@ error[E0308]: `if` and `else` have incompatible types - --> $DIR/region-invariant-static-error-reporting.rs:17:9 + --> $DIR/region-invariant-static-error-reporting.rs:21:9 | LL | let bad = if x.is_some() { | _______________- @@ -14,7 +14,7 @@ LL | | }; = note: expected struct `Invariant<'a>` found struct `Invariant<'static>` note: the lifetime `'a` as defined here... - --> $DIR/region-invariant-static-error-reporting.rs:13:10 + --> $DIR/region-invariant-static-error-reporting.rs:17:10 | LL | fn unify<'a>(x: Option>, f: fn(Invariant<'a>)) { | ^^ diff --git a/src/test/ui/regions/region-invariant-static-error-reporting.nll.stderr b/src/test/ui/regions/region-invariant-static-error-reporting.nll.stderr index 6e7eb734a50ea..6905fd008c525 100644 --- a/src/test/ui/regions/region-invariant-static-error-reporting.nll.stderr +++ b/src/test/ui/regions/region-invariant-static-error-reporting.nll.stderr @@ -1,5 +1,5 @@ error[E0521]: borrowed data escapes outside of function - --> $DIR/region-invariant-static-error-reporting.rs:15:9 + --> $DIR/region-invariant-static-error-reporting.rs:19:9 | LL | fn unify<'a>(x: Option>, f: fn(Invariant<'a>)) { | -- - `x` is a reference that is only valid in the function body diff --git a/src/test/ui/regions/region-invariant-static-error-reporting.rs b/src/test/ui/regions/region-invariant-static-error-reporting.rs index 911904813d0eb..b81022ca4b40b 100644 --- a/src/test/ui/regions/region-invariant-static-error-reporting.rs +++ b/src/test/ui/regions/region-invariant-static-error-reporting.rs @@ -3,8 +3,12 @@ // over time, but this test used to exhibit some pretty bogus messages // that were not remotely helpful. -// error-pattern:the lifetime `'a` -// error-pattern:the static lifetime +// revisions: base nll +// ignore-compare-mode-nll +//[base] error-pattern:the lifetime `'a` +//[base] error-pattern:the static lifetime +//[nll] compile-flags: -Z borrowck=mir +//[nll] error-pattern:argument requires that `'a` must outlive `'static` struct Invariant<'a>(Option<&'a mut &'a mut ()>); @@ -12,9 +16,9 @@ fn mk_static() -> Invariant<'static> { Invariant(None) } fn unify<'a>(x: Option>, f: fn(Invariant<'a>)) { let bad = if x.is_some() { - x.unwrap() + x.unwrap() //[nll]~ ERROR borrowed data escapes outside of function [E0521] } else { - mk_static() + mk_static() //[base]~ ERROR `if` and `else` have incompatible types [E0308] }; f(bad); } diff --git a/src/test/ui/regions/region-lifetime-bounds-on-fns-where-clause.stderr b/src/test/ui/regions/region-lifetime-bounds-on-fns-where-clause.base.stderr similarity index 85% rename from src/test/ui/regions/region-lifetime-bounds-on-fns-where-clause.stderr rename to src/test/ui/regions/region-lifetime-bounds-on-fns-where-clause.base.stderr index b83e07663faba..2ba4f4f5d9f46 100644 --- a/src/test/ui/regions/region-lifetime-bounds-on-fns-where-clause.stderr +++ b/src/test/ui/regions/region-lifetime-bounds-on-fns-where-clause.base.stderr @@ -1,5 +1,5 @@ error[E0623]: lifetime mismatch - --> $DIR/region-lifetime-bounds-on-fns-where-clause.rs:8:10 + --> $DIR/region-lifetime-bounds-on-fns-where-clause.rs:12:10 | LL | fn b<'a, 'b>(x: &mut &'a isize, y: &mut &'b isize) { | --------- --------- these two types are declared with different lifetimes... @@ -8,7 +8,7 @@ LL | *x = *y; | ^^ ...but data from `y` flows into `x` here error[E0623]: lifetime mismatch - --> $DIR/region-lifetime-bounds-on-fns-where-clause.rs:14:7 + --> $DIR/region-lifetime-bounds-on-fns-where-clause.rs:20:7 | LL | fn c<'a,'b>(x: &mut &'a isize, y: &mut &'b isize) { | --------- --------- these two types are declared with different lifetimes... @@ -17,7 +17,7 @@ LL | a(x, y); | ^ ...but data from `y` flows into `x` here error[E0308]: mismatched types - --> $DIR/region-lifetime-bounds-on-fns-where-clause.rs:20:43 + --> $DIR/region-lifetime-bounds-on-fns-where-clause.rs:28:43 | LL | let _: fn(&mut &isize, &mut &isize) = a; | ^ one type is more general than the other diff --git a/src/test/ui/regions/region-lifetime-bounds-on-fns-where-clause.nll.stderr b/src/test/ui/regions/region-lifetime-bounds-on-fns-where-clause.nll.stderr index 233a040491c66..c64309743346d 100644 --- a/src/test/ui/regions/region-lifetime-bounds-on-fns-where-clause.nll.stderr +++ b/src/test/ui/regions/region-lifetime-bounds-on-fns-where-clause.nll.stderr @@ -1,5 +1,5 @@ error: lifetime may not live long enough - --> $DIR/region-lifetime-bounds-on-fns-where-clause.rs:8:5 + --> $DIR/region-lifetime-bounds-on-fns-where-clause.rs:12:5 | LL | fn b<'a, 'b>(x: &mut &'a isize, y: &mut &'b isize) { | -- -- lifetime `'b` defined here @@ -12,7 +12,7 @@ LL | *x = *y; = help: consider adding the following bound: `'b: 'a` error: lifetime may not live long enough - --> $DIR/region-lifetime-bounds-on-fns-where-clause.rs:14:5 + --> $DIR/region-lifetime-bounds-on-fns-where-clause.rs:20:5 | LL | fn c<'a,'b>(x: &mut &'a isize, y: &mut &'b isize) { | -- -- lifetime `'b` defined here @@ -28,7 +28,7 @@ LL | a(x, y); = help: see for more information about variance error[E0308]: mismatched types - --> $DIR/region-lifetime-bounds-on-fns-where-clause.rs:20:12 + --> $DIR/region-lifetime-bounds-on-fns-where-clause.rs:28:12 | LL | let _: fn(&mut &isize, &mut &isize) = a; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ one type is more general than the other @@ -37,7 +37,7 @@ LL | let _: fn(&mut &isize, &mut &isize) = a; found fn pointer `for<'r, 's> fn(&'r mut &isize, &'s mut &isize)` error[E0308]: mismatched types - --> $DIR/region-lifetime-bounds-on-fns-where-clause.rs:20:12 + --> $DIR/region-lifetime-bounds-on-fns-where-clause.rs:28:12 | LL | let _: fn(&mut &isize, &mut &isize) = a; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ one type is more general than the other diff --git a/src/test/ui/regions/region-lifetime-bounds-on-fns-where-clause.rs b/src/test/ui/regions/region-lifetime-bounds-on-fns-where-clause.rs index ab4c6d9cf9198..ec91d1798083c 100644 --- a/src/test/ui/regions/region-lifetime-bounds-on-fns-where-clause.rs +++ b/src/test/ui/regions/region-lifetime-bounds-on-fns-where-clause.rs @@ -1,3 +1,7 @@ +// revisions: base nll +// ignore-compare-mode-nll +//[nll] compile-flags: -Z borrowck=mir + fn a<'a, 'b>(x: &mut &'a isize, y: &mut &'b isize) where 'b: 'a { // Note: this is legal because of the `'b:'a` declaration. *x = *y; @@ -5,19 +9,25 @@ fn a<'a, 'b>(x: &mut &'a isize, y: &mut &'b isize) where 'b: 'a { fn b<'a, 'b>(x: &mut &'a isize, y: &mut &'b isize) { // Illegal now because there is no `'b:'a` declaration. - *x = *y; //~ ERROR E0623 + *x = *y; + //[base]~^ ERROR E0623 + //[nll]~^^ ERROR lifetime may not live long enough } fn c<'a,'b>(x: &mut &'a isize, y: &mut &'b isize) { // Here we try to call `foo` but do not know that `'a` and `'b` are // related as required. - a(x, y); //~ ERROR lifetime mismatch [E0623] + a(x, y); + //[base]~^ ERROR lifetime mismatch [E0623] + //[nll]~^^ ERROR lifetime may not live long enough } fn d() { // 'a and 'b are early bound in the function `a` because they appear // inconstraints: - let _: fn(&mut &isize, &mut &isize) = a; //~ ERROR mismatched types + let _: fn(&mut &isize, &mut &isize) = a; + //~^ ERROR mismatched types [E0308] + //[nll]~^^ ERROR mismatched types [E0308] } fn e() { diff --git a/src/test/ui/regions/region-multiple-lifetime-bounds-on-fns-where-clause.stderr b/src/test/ui/regions/region-multiple-lifetime-bounds-on-fns-where-clause.base.stderr similarity index 98% rename from src/test/ui/regions/region-multiple-lifetime-bounds-on-fns-where-clause.stderr rename to src/test/ui/regions/region-multiple-lifetime-bounds-on-fns-where-clause.base.stderr index c93f2890f1110..537a1fb98a50f 100644 --- a/src/test/ui/regions/region-multiple-lifetime-bounds-on-fns-where-clause.stderr +++ b/src/test/ui/regions/region-multiple-lifetime-bounds-on-fns-where-clause.base.stderr @@ -1,5 +1,5 @@ error[E0623]: lifetime mismatch - --> $DIR/region-multiple-lifetime-bounds-on-fns-where-clause.rs:9:10 + --> $DIR/region-multiple-lifetime-bounds-on-fns-where-clause.rs:13:10 | LL | fn b<'a, 'b, 'c>(x: &mut &'a isize, y: &mut &'b isize, z: &mut &'c isize) { | --------- --------- these two types are declared with different lifetimes... @@ -8,7 +8,7 @@ LL | *x = *y; | ^^ ...but data from `y` flows into `x` here error[E0623]: lifetime mismatch - --> $DIR/region-multiple-lifetime-bounds-on-fns-where-clause.rs:10:10 + --> $DIR/region-multiple-lifetime-bounds-on-fns-where-clause.rs:16:10 | LL | fn b<'a, 'b, 'c>(x: &mut &'a isize, y: &mut &'b isize, z: &mut &'c isize) { | --------- --------- @@ -19,7 +19,7 @@ LL | *z = *y; | ^^ ...but data from `y` flows into `z` here error[E0623]: lifetime mismatch - --> $DIR/region-multiple-lifetime-bounds-on-fns-where-clause.rs:16:7 + --> $DIR/region-multiple-lifetime-bounds-on-fns-where-clause.rs:22:7 | LL | fn c<'a,'b, 'c>(x: &mut &'a isize, y: &mut &'b isize, z: &mut &'c isize) { | --------- --------- these two types are declared with different lifetimes... @@ -28,7 +28,7 @@ LL | a(x, y, z); | ^ ...but data from `y` flows into `x` here error[E0308]: mismatched types - --> $DIR/region-multiple-lifetime-bounds-on-fns-where-clause.rs:22:56 + --> $DIR/region-multiple-lifetime-bounds-on-fns-where-clause.rs:30:56 | LL | let _: fn(&mut &isize, &mut &isize, &mut &isize) = a; | ^ one type is more general than the other diff --git a/src/test/ui/regions/region-multiple-lifetime-bounds-on-fns-where-clause.nll.stderr b/src/test/ui/regions/region-multiple-lifetime-bounds-on-fns-where-clause.nll.stderr index 00119743acd78..053078f58df93 100644 --- a/src/test/ui/regions/region-multiple-lifetime-bounds-on-fns-where-clause.nll.stderr +++ b/src/test/ui/regions/region-multiple-lifetime-bounds-on-fns-where-clause.nll.stderr @@ -1,5 +1,5 @@ error: lifetime may not live long enough - --> $DIR/region-multiple-lifetime-bounds-on-fns-where-clause.rs:9:5 + --> $DIR/region-multiple-lifetime-bounds-on-fns-where-clause.rs:13:5 | LL | fn b<'a, 'b, 'c>(x: &mut &'a isize, y: &mut &'b isize, z: &mut &'c isize) { | -- -- lifetime `'b` defined here @@ -12,7 +12,7 @@ LL | *x = *y; = help: consider adding the following bound: `'b: 'a` error: lifetime may not live long enough - --> $DIR/region-multiple-lifetime-bounds-on-fns-where-clause.rs:16:5 + --> $DIR/region-multiple-lifetime-bounds-on-fns-where-clause.rs:22:5 | LL | fn c<'a,'b, 'c>(x: &mut &'a isize, y: &mut &'b isize, z: &mut &'c isize) { | -- -- lifetime `'b` defined here @@ -28,7 +28,7 @@ LL | a(x, y, z); = help: see for more information about variance error[E0308]: mismatched types - --> $DIR/region-multiple-lifetime-bounds-on-fns-where-clause.rs:22:12 + --> $DIR/region-multiple-lifetime-bounds-on-fns-where-clause.rs:30:12 | LL | let _: fn(&mut &isize, &mut &isize, &mut &isize) = a; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ one type is more general than the other @@ -37,7 +37,7 @@ LL | let _: fn(&mut &isize, &mut &isize, &mut &isize) = a; found fn pointer `for<'r, 's, 't0> fn(&'r mut &isize, &'s mut &isize, &'t0 mut &isize)` error[E0308]: mismatched types - --> $DIR/region-multiple-lifetime-bounds-on-fns-where-clause.rs:22:12 + --> $DIR/region-multiple-lifetime-bounds-on-fns-where-clause.rs:30:12 | LL | let _: fn(&mut &isize, &mut &isize, &mut &isize) = a; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ one type is more general than the other @@ -46,7 +46,7 @@ LL | let _: fn(&mut &isize, &mut &isize, &mut &isize) = a; found fn pointer `for<'r, 's, 't0> fn(&'r mut &isize, &'s mut &isize, &'t0 mut &isize)` error[E0308]: mismatched types - --> $DIR/region-multiple-lifetime-bounds-on-fns-where-clause.rs:22:12 + --> $DIR/region-multiple-lifetime-bounds-on-fns-where-clause.rs:30:12 | LL | let _: fn(&mut &isize, &mut &isize, &mut &isize) = a; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ one type is more general than the other diff --git a/src/test/ui/regions/region-multiple-lifetime-bounds-on-fns-where-clause.polonius.stderr b/src/test/ui/regions/region-multiple-lifetime-bounds-on-fns-where-clause.polonius.stderr deleted file mode 100644 index 13741664ef227..0000000000000 --- a/src/test/ui/regions/region-multiple-lifetime-bounds-on-fns-where-clause.polonius.stderr +++ /dev/null @@ -1,82 +0,0 @@ -error: lifetime may not live long enough - --> $DIR/region-multiple-lifetime-bounds-on-fns-where-clause.rs:9:5 - | -LL | fn b<'a, 'b, 'c>(x: &mut &'a isize, y: &mut &'b isize, z: &mut &'c isize) { - | -- -- lifetime `'b` defined here - | | - | lifetime `'a` defined here -LL | // Illegal now because there is no `'b:'a` declaration. -LL | *x = *y; - | ^^^^^^^ assignment requires that `'b` must outlive `'a` - | - = help: consider adding the following bound: `'b: 'a` - -error: lifetime may not live long enough - --> $DIR/region-multiple-lifetime-bounds-on-fns-where-clause.rs:10:5 - | -LL | fn b<'a, 'b, 'c>(x: &mut &'a isize, y: &mut &'b isize, z: &mut &'c isize) { - | -- -- lifetime `'c` defined here - | | - | lifetime `'b` defined here -... -LL | *z = *y; - | ^^^^^^^ assignment requires that `'b` must outlive `'c` - | - = help: consider adding the following bound: `'b: 'c` - -help: add bound `'b: 'a + 'c` - -error: lifetime may not live long enough - --> $DIR/region-multiple-lifetime-bounds-on-fns-where-clause.rs:16:5 - | -LL | fn c<'a,'b, 'c>(x: &mut &'a isize, y: &mut &'b isize, z: &mut &'c isize) { - | -- -- lifetime `'b` defined here - | | - | lifetime `'a` defined here -... -LL | a(x, y, z); - | ^^^^^^^^^^ argument requires that `'b` must outlive `'a` - | - = help: consider adding the following bound: `'b: 'a` - = note: requirement occurs because of a mutable reference to &isize - = note: mutable references are invariant over their type parameter - = help: see for more information about variance - -error: lifetime may not live long enough - --> $DIR/region-multiple-lifetime-bounds-on-fns-where-clause.rs:16:5 - | -LL | fn c<'a,'b, 'c>(x: &mut &'a isize, y: &mut &'b isize, z: &mut &'c isize) { - | -- -- lifetime `'c` defined here - | | - | lifetime `'b` defined here -... -LL | a(x, y, z); - | ^^^^^^^^^^ argument requires that `'b` must outlive `'c` - | - = help: consider adding the following bound: `'b: 'c` - = note: requirement occurs because of a mutable reference to &isize - = note: mutable references are invariant over their type parameter - = help: see for more information about variance - -help: add bound `'b: 'a + 'c` - -error: higher-ranked subtype error - --> $DIR/region-multiple-lifetime-bounds-on-fns-where-clause.rs:22:12 - | -LL | let _: fn(&mut &isize, &mut &isize, &mut &isize) = a; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - -error: higher-ranked subtype error - --> $DIR/region-multiple-lifetime-bounds-on-fns-where-clause.rs:22:12 - | -LL | let _: fn(&mut &isize, &mut &isize, &mut &isize) = a; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - -error: higher-ranked subtype error - --> $DIR/region-multiple-lifetime-bounds-on-fns-where-clause.rs:22:12 - | -LL | let _: fn(&mut &isize, &mut &isize, &mut &isize) = a; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - -error: aborting due to 7 previous errors - diff --git a/src/test/ui/regions/region-multiple-lifetime-bounds-on-fns-where-clause.rs b/src/test/ui/regions/region-multiple-lifetime-bounds-on-fns-where-clause.rs index 066522548ad45..8b5c1d47ec61b 100644 --- a/src/test/ui/regions/region-multiple-lifetime-bounds-on-fns-where-clause.rs +++ b/src/test/ui/regions/region-multiple-lifetime-bounds-on-fns-where-clause.rs @@ -1,3 +1,7 @@ +// revisions: base nll +// ignore-compare-mode-nll +//[nll] compile-flags: -Z borrowck=mir + fn a<'a, 'b, 'c>(x: &mut &'a isize, y: &mut &'b isize, z: &mut &'c isize) where 'b: 'a + 'c { // Note: this is legal because of the `'b:'a` declaration. *x = *y; @@ -6,20 +10,27 @@ fn a<'a, 'b, 'c>(x: &mut &'a isize, y: &mut &'b isize, z: &mut &'c isize) where fn b<'a, 'b, 'c>(x: &mut &'a isize, y: &mut &'b isize, z: &mut &'c isize) { // Illegal now because there is no `'b:'a` declaration. - *x = *y; //~ ERROR E0623 - *z = *y; //~ ERROR E0623 + *x = *y; + //[base]~^ ERROR E0623 + //[nll]~^^ ERROR lifetime may not live long enough + *z = *y; //[base]~ ERROR E0623 } fn c<'a,'b, 'c>(x: &mut &'a isize, y: &mut &'b isize, z: &mut &'c isize) { // Here we try to call `foo` but do not know that `'a` and `'b` are // related as required. - a(x, y, z); //~ ERROR lifetime mismatch [E0623] + a(x, y, z); + //[base]~^ ERROR lifetime mismatch [E0623] + //[nll]~^^ ERROR lifetime may not live long enough } fn d() { // 'a and 'b are early bound in the function `a` because they appear // inconstraints: - let _: fn(&mut &isize, &mut &isize, &mut &isize) = a; //~ ERROR E0308 + let _: fn(&mut &isize, &mut &isize, &mut &isize) = a; + //~^ ERROR E0308 + //[nll]~^^ ERROR mismatched types [E0308] + //[nll]~| ERROR mismatched types [E0308] } fn e() { diff --git a/src/test/ui/regions/region-object-lifetime-2.stderr b/src/test/ui/regions/region-object-lifetime-2.base.stderr similarity index 80% rename from src/test/ui/regions/region-object-lifetime-2.stderr rename to src/test/ui/regions/region-object-lifetime-2.base.stderr index 380e27ab0e011..118fe47650048 100644 --- a/src/test/ui/regions/region-object-lifetime-2.stderr +++ b/src/test/ui/regions/region-object-lifetime-2.base.stderr @@ -1,26 +1,26 @@ error[E0495]: cannot infer an appropriate lifetime for autoref due to conflicting requirements - --> $DIR/region-object-lifetime-2.rs:10:7 + --> $DIR/region-object-lifetime-2.rs:14:7 | LL | x.borrowed() | ^^^^^^^^ | note: first, the lifetime cannot outlive the lifetime `'a` as defined here... - --> $DIR/region-object-lifetime-2.rs:9:42 + --> $DIR/region-object-lifetime-2.rs:13:42 | LL | fn borrowed_receiver_different_lifetimes<'a,'b>(x: &'a dyn Foo) -> &'b () { | ^^ note: ...so that reference does not outlive borrowed content - --> $DIR/region-object-lifetime-2.rs:10:5 + --> $DIR/region-object-lifetime-2.rs:14:5 | LL | x.borrowed() | ^ note: but, the lifetime must be valid for the lifetime `'b` as defined here... - --> $DIR/region-object-lifetime-2.rs:9:45 + --> $DIR/region-object-lifetime-2.rs:13:45 | LL | fn borrowed_receiver_different_lifetimes<'a,'b>(x: &'a dyn Foo) -> &'b () { | ^^ note: ...so that reference does not outlive borrowed content - --> $DIR/region-object-lifetime-2.rs:10:5 + --> $DIR/region-object-lifetime-2.rs:14:5 | LL | x.borrowed() | ^^^^^^^^^^^^ diff --git a/src/test/ui/regions/region-object-lifetime-2.nll.stderr b/src/test/ui/regions/region-object-lifetime-2.nll.stderr index d95289f3f9def..c0b09ebb6f58b 100644 --- a/src/test/ui/regions/region-object-lifetime-2.nll.stderr +++ b/src/test/ui/regions/region-object-lifetime-2.nll.stderr @@ -1,5 +1,5 @@ error: lifetime may not live long enough - --> $DIR/region-object-lifetime-2.rs:10:5 + --> $DIR/region-object-lifetime-2.rs:14:5 | LL | fn borrowed_receiver_different_lifetimes<'a,'b>(x: &'a dyn Foo) -> &'b () { | -- -- lifetime `'b` defined here diff --git a/src/test/ui/regions/region-object-lifetime-2.rs b/src/test/ui/regions/region-object-lifetime-2.rs index 4279848789338..e12b9822f6084 100644 --- a/src/test/ui/regions/region-object-lifetime-2.rs +++ b/src/test/ui/regions/region-object-lifetime-2.rs @@ -1,13 +1,19 @@ // Various tests related to testing how region inference works // with respect to the object receivers. +// revisions: base nll +// ignore-compare-mode-nll +//[nll] compile-flags: -Z borrowck=mir + trait Foo { fn borrowed<'a>(&'a self) -> &'a (); } // Borrowed receiver but two distinct lifetimes, we get an error. fn borrowed_receiver_different_lifetimes<'a,'b>(x: &'a dyn Foo) -> &'b () { - x.borrowed() //~ ERROR cannot infer + x.borrowed() + //[base]~^ ERROR cannot infer + //[nll]~^^ ERROR lifetime may not live long enough } fn main() {} diff --git a/src/test/ui/regions/region-object-lifetime-4.stderr b/src/test/ui/regions/region-object-lifetime-4.base.stderr similarity index 80% rename from src/test/ui/regions/region-object-lifetime-4.stderr rename to src/test/ui/regions/region-object-lifetime-4.base.stderr index b59163ef13b31..3765076a9c5cf 100644 --- a/src/test/ui/regions/region-object-lifetime-4.stderr +++ b/src/test/ui/regions/region-object-lifetime-4.base.stderr @@ -1,26 +1,26 @@ error[E0495]: cannot infer an appropriate lifetime for autoref due to conflicting requirements - --> $DIR/region-object-lifetime-4.rs:12:7 + --> $DIR/region-object-lifetime-4.rs:16:7 | LL | x.borrowed() | ^^^^^^^^ | note: first, the lifetime cannot outlive the lifetime `'a` as defined here... - --> $DIR/region-object-lifetime-4.rs:11:41 + --> $DIR/region-object-lifetime-4.rs:15:41 | LL | fn borrowed_receiver_related_lifetimes2<'a,'b>(x: &'a (dyn Foo + 'b)) -> &'b () { | ^^ note: ...so that reference does not outlive borrowed content - --> $DIR/region-object-lifetime-4.rs:12:5 + --> $DIR/region-object-lifetime-4.rs:16:5 | LL | x.borrowed() | ^ note: but, the lifetime must be valid for the lifetime `'b` as defined here... - --> $DIR/region-object-lifetime-4.rs:11:44 + --> $DIR/region-object-lifetime-4.rs:15:44 | LL | fn borrowed_receiver_related_lifetimes2<'a,'b>(x: &'a (dyn Foo + 'b)) -> &'b () { | ^^ note: ...so that reference does not outlive borrowed content - --> $DIR/region-object-lifetime-4.rs:12:5 + --> $DIR/region-object-lifetime-4.rs:16:5 | LL | x.borrowed() | ^^^^^^^^^^^^ diff --git a/src/test/ui/regions/region-object-lifetime-4.nll.stderr b/src/test/ui/regions/region-object-lifetime-4.nll.stderr index fda66a2412ccb..a2a958f90b234 100644 --- a/src/test/ui/regions/region-object-lifetime-4.nll.stderr +++ b/src/test/ui/regions/region-object-lifetime-4.nll.stderr @@ -1,5 +1,5 @@ error: lifetime may not live long enough - --> $DIR/region-object-lifetime-4.rs:12:5 + --> $DIR/region-object-lifetime-4.rs:16:5 | LL | fn borrowed_receiver_related_lifetimes2<'a,'b>(x: &'a (dyn Foo + 'b)) -> &'b () { | -- -- lifetime `'b` defined here diff --git a/src/test/ui/regions/region-object-lifetime-4.rs b/src/test/ui/regions/region-object-lifetime-4.rs index 4fe12b2acfc69..aad9c2c95217b 100644 --- a/src/test/ui/regions/region-object-lifetime-4.rs +++ b/src/test/ui/regions/region-object-lifetime-4.rs @@ -1,6 +1,10 @@ // Various tests related to testing how region inference works // with respect to the object receivers. +// revisions: base nll +// ignore-compare-mode-nll +//[nll] compile-flags: -Z borrowck=mir + trait Foo { fn borrowed<'a>(&'a self) -> &'a (); } @@ -9,7 +13,9 @@ trait Foo { // with the longer lifetime when (from the signature) we only know // that it lives as long as the shorter lifetime. Therefore, error. fn borrowed_receiver_related_lifetimes2<'a,'b>(x: &'a (dyn Foo + 'b)) -> &'b () { - x.borrowed() //~ ERROR cannot infer + x.borrowed() + //[base]~^ ERROR cannot infer + //[nll]~^^ ERROR lifetime may not live long enough } fn main() {} diff --git a/src/test/ui/regions/region-object-lifetime-in-coercion.stderr b/src/test/ui/regions/region-object-lifetime-in-coercion.base.stderr similarity index 87% rename from src/test/ui/regions/region-object-lifetime-in-coercion.stderr rename to src/test/ui/regions/region-object-lifetime-in-coercion.base.stderr index d8932c067acd8..85bfa16b3d37d 100644 --- a/src/test/ui/regions/region-object-lifetime-in-coercion.stderr +++ b/src/test/ui/regions/region-object-lifetime-in-coercion.base.stderr @@ -1,5 +1,5 @@ error[E0759]: `v` has an anonymous lifetime `'_` but it needs to satisfy a `'static` lifetime requirement - --> $DIR/region-object-lifetime-in-coercion.rs:8:46 + --> $DIR/region-object-lifetime-in-coercion.rs:12:46 | LL | fn a(v: &[u8]) -> Box { | ----- this data with an anonymous lifetime `'_`... @@ -16,7 +16,7 @@ LL | fn a(v: &'static [u8]) -> Box { | ~~~~~~~~~~~~~ error[E0759]: `v` has an anonymous lifetime `'_` but it needs to satisfy a `'static` lifetime requirement - --> $DIR/region-object-lifetime-in-coercion.rs:13:14 + --> $DIR/region-object-lifetime-in-coercion.rs:19:14 | LL | fn b(v: &[u8]) -> Box { | ----- this data with an anonymous lifetime `'_`... @@ -24,7 +24,7 @@ LL | Box::new(v) | ^ ...is used and required to live as long as `'static` here | note: `'static` lifetime requirement introduced by the return type - --> $DIR/region-object-lifetime-in-coercion.rs:12:33 + --> $DIR/region-object-lifetime-in-coercion.rs:18:33 | LL | fn b(v: &[u8]) -> Box { | ^^^^^^^ `'static` requirement introduced here @@ -40,7 +40,7 @@ LL | fn b(v: &'static [u8]) -> Box { | ~~~~~~~~~~~~~ error[E0759]: `v` has an anonymous lifetime `'_` but it needs to satisfy a `'static` lifetime requirement - --> $DIR/region-object-lifetime-in-coercion.rs:19:14 + --> $DIR/region-object-lifetime-in-coercion.rs:27:14 | LL | fn c(v: &[u8]) -> Box { | ----- this data with an anonymous lifetime `'_`... @@ -49,7 +49,7 @@ LL | Box::new(v) | ^ ...is used and required to live as long as `'static` here | note: `'static` lifetime requirement introduced by the return type - --> $DIR/region-object-lifetime-in-coercion.rs:16:23 + --> $DIR/region-object-lifetime-in-coercion.rs:24:23 | LL | fn c(v: &[u8]) -> Box { | ^^^^^^^ `'static` requirement introduced here @@ -62,30 +62,30 @@ LL | fn c(v: &[u8]) -> Box { | ++++ error[E0495]: cannot infer an appropriate lifetime due to conflicting requirements - --> $DIR/region-object-lifetime-in-coercion.rs:23:14 + --> $DIR/region-object-lifetime-in-coercion.rs:33:14 | LL | Box::new(v) | ^ | note: first, the lifetime cannot outlive the lifetime `'a` as defined here... - --> $DIR/region-object-lifetime-in-coercion.rs:22:6 + --> $DIR/region-object-lifetime-in-coercion.rs:32:6 | LL | fn d<'a,'b>(v: &'a [u8]) -> Box { | ^^ note: ...so that the expression is assignable - --> $DIR/region-object-lifetime-in-coercion.rs:23:14 + --> $DIR/region-object-lifetime-in-coercion.rs:33:14 | LL | Box::new(v) | ^ = note: expected `&[u8]` found `&'a [u8]` note: but, the lifetime must be valid for the lifetime `'b` as defined here... - --> $DIR/region-object-lifetime-in-coercion.rs:22:9 + --> $DIR/region-object-lifetime-in-coercion.rs:32:9 | LL | fn d<'a,'b>(v: &'a [u8]) -> Box { | ^^ note: ...so that the types are compatible - --> $DIR/region-object-lifetime-in-coercion.rs:23:5 + --> $DIR/region-object-lifetime-in-coercion.rs:33:5 | LL | Box::new(v) | ^^^^^^^^^^^ diff --git a/src/test/ui/regions/region-object-lifetime-in-coercion.nll.stderr b/src/test/ui/regions/region-object-lifetime-in-coercion.nll.stderr index 92588819076d3..4d72724586e9a 100644 --- a/src/test/ui/regions/region-object-lifetime-in-coercion.nll.stderr +++ b/src/test/ui/regions/region-object-lifetime-in-coercion.nll.stderr @@ -1,5 +1,5 @@ error: lifetime may not live long enough - --> $DIR/region-object-lifetime-in-coercion.rs:8:12 + --> $DIR/region-object-lifetime-in-coercion.rs:12:12 | LL | fn a(v: &[u8]) -> Box { | - let's call the lifetime of this reference `'1` @@ -7,7 +7,7 @@ LL | let x: Box = Box::new(v); | ^^^^^^^^^^^^^^^^^^^^^^ type annotation requires that `'1` must outlive `'static` error: lifetime may not live long enough - --> $DIR/region-object-lifetime-in-coercion.rs:13:5 + --> $DIR/region-object-lifetime-in-coercion.rs:19:5 | LL | fn b(v: &[u8]) -> Box { | - let's call the lifetime of this reference `'1` @@ -15,7 +15,7 @@ LL | Box::new(v) | ^^^^^^^^^^^ returning this value requires that `'1` must outlive `'static` error: lifetime may not live long enough - --> $DIR/region-object-lifetime-in-coercion.rs:19:5 + --> $DIR/region-object-lifetime-in-coercion.rs:27:5 | LL | fn c(v: &[u8]) -> Box { | - let's call the lifetime of this reference `'1` @@ -24,7 +24,7 @@ LL | Box::new(v) | ^^^^^^^^^^^ returning this value requires that `'1` must outlive `'static` error: lifetime may not live long enough - --> $DIR/region-object-lifetime-in-coercion.rs:23:5 + --> $DIR/region-object-lifetime-in-coercion.rs:33:5 | LL | fn d<'a,'b>(v: &'a [u8]) -> Box { | -- -- lifetime `'b` defined here diff --git a/src/test/ui/regions/region-object-lifetime-in-coercion.rs b/src/test/ui/regions/region-object-lifetime-in-coercion.rs index 9d3f485e31438..ed28d6c0ff1ae 100644 --- a/src/test/ui/regions/region-object-lifetime-in-coercion.rs +++ b/src/test/ui/regions/region-object-lifetime-in-coercion.rs @@ -1,26 +1,38 @@ // Test that attempts to implicitly coerce a value into an // object respect the lifetime bound on the object type. +// revisions: base nll +// ignore-compare-mode-nll +//[nll] compile-flags: -Z borrowck=mir + trait Foo {} impl<'a> Foo for &'a [u8] {} fn a(v: &[u8]) -> Box { - let x: Box = Box::new(v); //~ ERROR E0759 + let x: Box = Box::new(v); + //[base]~^ ERROR E0759 + //[nll]~^^ ERROR lifetime may not live long enough x } fn b(v: &[u8]) -> Box { - Box::new(v) //~ ERROR E0759 + Box::new(v) + //[base]~^ ERROR E0759 + //[nll]~^^ ERROR lifetime may not live long enough } fn c(v: &[u8]) -> Box { // same as previous case due to RFC 599 - Box::new(v) //~ ERROR E0759 + Box::new(v) + //[base]~^ ERROR E0759 + //[nll]~^^ ERROR lifetime may not live long enough } fn d<'a,'b>(v: &'a [u8]) -> Box { - Box::new(v) //~ ERROR cannot infer an appropriate lifetime due to conflicting + Box::new(v) + //[base]~^ ERROR cannot infer an appropriate lifetime due to conflicting + //[nll]~^^ ERROR lifetime may not live long enough } fn e<'a:'b,'b>(v: &'a [u8]) -> Box { diff --git a/src/test/ui/regions/regions-addr-of-self.stderr b/src/test/ui/regions/regions-addr-of-self.base.stderr similarity index 92% rename from src/test/ui/regions/regions-addr-of-self.stderr rename to src/test/ui/regions/regions-addr-of-self.base.stderr index 3453c6458f1da..3167c2f210784 100644 --- a/src/test/ui/regions/regions-addr-of-self.stderr +++ b/src/test/ui/regions/regions-addr-of-self.base.stderr @@ -1,5 +1,5 @@ error[E0759]: `self` has an anonymous lifetime `'_` but it needs to satisfy a `'static` lifetime requirement - --> $DIR/regions-addr-of-self.rs:7:37 + --> $DIR/regions-addr-of-self.rs:11:37 | LL | pub fn chase_cat(&mut self) { | --------- this data with an anonymous lifetime `'_`... diff --git a/src/test/ui/regions/regions-addr-of-self.nll.stderr b/src/test/ui/regions/regions-addr-of-self.nll.stderr index 3d7aac74bd4f7..1f720520f6ba6 100644 --- a/src/test/ui/regions/regions-addr-of-self.nll.stderr +++ b/src/test/ui/regions/regions-addr-of-self.nll.stderr @@ -1,5 +1,5 @@ error: lifetime may not live long enough - --> $DIR/regions-addr-of-self.rs:7:16 + --> $DIR/regions-addr-of-self.rs:11:16 | LL | pub fn chase_cat(&mut self) { | - let's call the lifetime of this reference `'1` diff --git a/src/test/ui/regions/regions-addr-of-self.rs b/src/test/ui/regions/regions-addr-of-self.rs index 4eb1b275f163e..698433c71b380 100644 --- a/src/test/ui/regions/regions-addr-of-self.rs +++ b/src/test/ui/regions/regions-addr-of-self.rs @@ -1,10 +1,16 @@ +// revisions: base nll +// ignore-compare-mode-nll +//[nll] compile-flags: -Z borrowck=mir + struct Dog { cats_chased: usize, } impl Dog { pub fn chase_cat(&mut self) { - let p: &'static mut usize = &mut self.cats_chased; //~ ERROR E0759 + let p: &'static mut usize = &mut self.cats_chased; + //[base]~^ ERROR E0759 + //[nll]~^^ ERROR lifetime may not live long enough *p += 1; } diff --git a/src/test/ui/regions/regions-addr-of-upvar-self.stderr b/src/test/ui/regions/regions-addr-of-upvar-self.base.stderr similarity index 82% rename from src/test/ui/regions/regions-addr-of-upvar-self.stderr rename to src/test/ui/regions/regions-addr-of-upvar-self.base.stderr index f638064ef8378..42d0638e8b74c 100644 --- a/src/test/ui/regions/regions-addr-of-upvar-self.stderr +++ b/src/test/ui/regions/regions-addr-of-upvar-self.base.stderr @@ -1,22 +1,22 @@ error[E0495]: cannot infer an appropriate lifetime for borrow expression due to conflicting requirements - --> $DIR/regions-addr-of-upvar-self.rs:8:41 + --> $DIR/regions-addr-of-upvar-self.rs:12:41 | LL | let p: &'static mut usize = &mut self.food; | ^^^^^^^^^^^^^^ | note: first, the lifetime cannot outlive the lifetime `'_` as defined here... - --> $DIR/regions-addr-of-upvar-self.rs:7:18 + --> $DIR/regions-addr-of-upvar-self.rs:11:18 | LL | let _f = || { | ^^ note: ...so that closure can access `self` - --> $DIR/regions-addr-of-upvar-self.rs:8:41 + --> $DIR/regions-addr-of-upvar-self.rs:12:41 | LL | let p: &'static mut usize = &mut self.food; | ^^^^^^^^^^^^^^ = note: but, the lifetime must be valid for the static lifetime... note: ...so that reference does not outlive borrowed content - --> $DIR/regions-addr-of-upvar-self.rs:8:41 + --> $DIR/regions-addr-of-upvar-self.rs:12:41 | LL | let p: &'static mut usize = &mut self.food; | ^^^^^^^^^^^^^^ diff --git a/src/test/ui/regions/regions-addr-of-upvar-self.nll.stderr b/src/test/ui/regions/regions-addr-of-upvar-self.nll.stderr index c16a6f8585b69..b8e37e92316db 100644 --- a/src/test/ui/regions/regions-addr-of-upvar-self.nll.stderr +++ b/src/test/ui/regions/regions-addr-of-upvar-self.nll.stderr @@ -1,5 +1,5 @@ error: lifetime may not live long enough - --> $DIR/regions-addr-of-upvar-self.rs:8:20 + --> $DIR/regions-addr-of-upvar-self.rs:12:20 | LL | let _f = || { | -- lifetime `'1` represents this closure's body @@ -9,7 +9,7 @@ LL | let p: &'static mut usize = &mut self.food; = note: closure implements `FnMut`, so references to captured variables can't escape the closure error: lifetime may not live long enough - --> $DIR/regions-addr-of-upvar-self.rs:8:20 + --> $DIR/regions-addr-of-upvar-self.rs:12:20 | LL | pub fn chase_cat(&mut self) { | - let's call the lifetime of this reference `'1` @@ -18,7 +18,7 @@ LL | let p: &'static mut usize = &mut self.food; | ^^^^^^^^^^^^^^^^^^ type annotation requires that `'1` must outlive `'static` error[E0597]: `self` does not live long enough - --> $DIR/regions-addr-of-upvar-self.rs:8:46 + --> $DIR/regions-addr-of-upvar-self.rs:12:46 | LL | let _f = || { | -- value captured here diff --git a/src/test/ui/regions/regions-addr-of-upvar-self.rs b/src/test/ui/regions/regions-addr-of-upvar-self.rs index 6159ab02d3d95..36cc592d47c93 100644 --- a/src/test/ui/regions/regions-addr-of-upvar-self.rs +++ b/src/test/ui/regions/regions-addr-of-upvar-self.rs @@ -1,3 +1,7 @@ +// revisions: base nll +// ignore-compare-mode-nll +//[nll] compile-flags: -Z borrowck=mir + struct Dog { food: usize, } @@ -5,7 +9,11 @@ struct Dog { impl Dog { pub fn chase_cat(&mut self) { let _f = || { - let p: &'static mut usize = &mut self.food; //~ ERROR cannot infer + let p: &'static mut usize = &mut self.food; + //[base]~^ ERROR cannot infer + //[nll]~^^ ERROR lifetime may not live long enough + //[nll]~^^^ ERROR lifetime may not live long enough + //[nll]~^^^^ ERROR E0597 *p = 3; }; } diff --git a/src/test/ui/regions/regions-bounded-by-trait-requiring-static.stderr b/src/test/ui/regions/regions-bounded-by-trait-requiring-static.base.stderr similarity index 74% rename from src/test/ui/regions/regions-bounded-by-trait-requiring-static.stderr rename to src/test/ui/regions/regions-bounded-by-trait-requiring-static.base.stderr index 68b90eee72d6d..9b45dcfd95a7a 100644 --- a/src/test/ui/regions/regions-bounded-by-trait-requiring-static.stderr +++ b/src/test/ui/regions/regions-bounded-by-trait-requiring-static.base.stderr @@ -1,71 +1,71 @@ error[E0477]: the type `&'a isize` does not fulfill the required lifetime - --> $DIR/regions-bounded-by-trait-requiring-static.rs:22:5 + --> $DIR/regions-bounded-by-trait-requiring-static.rs:26:5 | LL | assert_send::<&'a isize>(); | ^^^^^^^^^^^^^^^^^^^^^^^^ | note: type must satisfy the static lifetime as required by this binding - --> $DIR/regions-bounded-by-trait-requiring-static.rs:6:18 + --> $DIR/regions-bounded-by-trait-requiring-static.rs:10:18 | LL | fn assert_send() { } | ^^^^^^^ error[E0477]: the type `&'a str` does not fulfill the required lifetime - --> $DIR/regions-bounded-by-trait-requiring-static.rs:26:5 + --> $DIR/regions-bounded-by-trait-requiring-static.rs:32:5 | LL | assert_send::<&'a str>(); | ^^^^^^^^^^^^^^^^^^^^^^ | note: type must satisfy the static lifetime as required by this binding - --> $DIR/regions-bounded-by-trait-requiring-static.rs:6:18 + --> $DIR/regions-bounded-by-trait-requiring-static.rs:10:18 | LL | fn assert_send() { } | ^^^^^^^ error[E0477]: the type `&'a [isize]` does not fulfill the required lifetime - --> $DIR/regions-bounded-by-trait-requiring-static.rs:30:5 + --> $DIR/regions-bounded-by-trait-requiring-static.rs:38:5 | LL | assert_send::<&'a [isize]>(); | ^^^^^^^^^^^^^^^^^^^^^^^^^^ | note: type must satisfy the static lifetime as required by this binding - --> $DIR/regions-bounded-by-trait-requiring-static.rs:6:18 + --> $DIR/regions-bounded-by-trait-requiring-static.rs:10:18 | LL | fn assert_send() { } | ^^^^^^^ error[E0477]: the type `Box<&'a isize>` does not fulfill the required lifetime - --> $DIR/regions-bounded-by-trait-requiring-static.rs:44:5 + --> $DIR/regions-bounded-by-trait-requiring-static.rs:54:5 | LL | assert_send::>(); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | note: type must satisfy the static lifetime as required by this binding - --> $DIR/regions-bounded-by-trait-requiring-static.rs:6:18 + --> $DIR/regions-bounded-by-trait-requiring-static.rs:10:18 | LL | fn assert_send() { } | ^^^^^^^ error[E0477]: the type `*const &'a isize` does not fulfill the required lifetime - --> $DIR/regions-bounded-by-trait-requiring-static.rs:55:5 + --> $DIR/regions-bounded-by-trait-requiring-static.rs:67:5 | LL | assert_send::<*const &'a isize>(); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | note: type must satisfy the static lifetime as required by this binding - --> $DIR/regions-bounded-by-trait-requiring-static.rs:6:18 + --> $DIR/regions-bounded-by-trait-requiring-static.rs:10:18 | LL | fn assert_send() { } | ^^^^^^^ error[E0477]: the type `*mut &'a isize` does not fulfill the required lifetime - --> $DIR/regions-bounded-by-trait-requiring-static.rs:59:5 + --> $DIR/regions-bounded-by-trait-requiring-static.rs:73:5 | LL | assert_send::<*mut &'a isize>(); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | note: type must satisfy the static lifetime as required by this binding - --> $DIR/regions-bounded-by-trait-requiring-static.rs:6:18 + --> $DIR/regions-bounded-by-trait-requiring-static.rs:10:18 | LL | fn assert_send() { } | ^^^^^^^ diff --git a/src/test/ui/regions/regions-bounded-by-trait-requiring-static.nll.stderr b/src/test/ui/regions/regions-bounded-by-trait-requiring-static.nll.stderr index 86bd100538d70..558a77516bbf7 100644 --- a/src/test/ui/regions/regions-bounded-by-trait-requiring-static.nll.stderr +++ b/src/test/ui/regions/regions-bounded-by-trait-requiring-static.nll.stderr @@ -1,5 +1,5 @@ error: lifetime may not live long enough - --> $DIR/regions-bounded-by-trait-requiring-static.rs:22:5 + --> $DIR/regions-bounded-by-trait-requiring-static.rs:26:5 | LL | fn param_not_ok<'a>(x: &'a isize) { | -- lifetime `'a` defined here @@ -7,7 +7,7 @@ LL | assert_send::<&'a isize>(); | ^^^^^^^^^^^^^^^^^^^^^^^^ requires that `'a` must outlive `'static` error: lifetime may not live long enough - --> $DIR/regions-bounded-by-trait-requiring-static.rs:26:5 + --> $DIR/regions-bounded-by-trait-requiring-static.rs:32:5 | LL | fn param_not_ok1<'a>(_: &'a isize) { | -- lifetime `'a` defined here @@ -15,7 +15,7 @@ LL | assert_send::<&'a str>(); | ^^^^^^^^^^^^^^^^^^^^^^ requires that `'a` must outlive `'static` error: lifetime may not live long enough - --> $DIR/regions-bounded-by-trait-requiring-static.rs:30:5 + --> $DIR/regions-bounded-by-trait-requiring-static.rs:38:5 | LL | fn param_not_ok2<'a>(_: &'a isize) { | -- lifetime `'a` defined here @@ -23,7 +23,7 @@ LL | assert_send::<&'a [isize]>(); | ^^^^^^^^^^^^^^^^^^^^^^^^^^ requires that `'a` must outlive `'static` error: lifetime may not live long enough - --> $DIR/regions-bounded-by-trait-requiring-static.rs:44:5 + --> $DIR/regions-bounded-by-trait-requiring-static.rs:54:5 | LL | fn box_with_region_not_ok<'a>() { | -- lifetime `'a` defined here @@ -31,7 +31,7 @@ LL | assert_send::>(); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ requires that `'a` must outlive `'static` error: lifetime may not live long enough - --> $DIR/regions-bounded-by-trait-requiring-static.rs:55:5 + --> $DIR/regions-bounded-by-trait-requiring-static.rs:67:5 | LL | fn unsafe_ok2<'a>(_: &'a isize) { | -- lifetime `'a` defined here @@ -39,7 +39,7 @@ LL | assert_send::<*const &'a isize>(); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ requires that `'a` must outlive `'static` error: lifetime may not live long enough - --> $DIR/regions-bounded-by-trait-requiring-static.rs:59:5 + --> $DIR/regions-bounded-by-trait-requiring-static.rs:73:5 | LL | fn unsafe_ok3<'a>(_: &'a isize) { | -- lifetime `'a` defined here diff --git a/src/test/ui/regions/regions-bounded-by-trait-requiring-static.rs b/src/test/ui/regions/regions-bounded-by-trait-requiring-static.rs index c583f43638af3..37dc1300d3983 100644 --- a/src/test/ui/regions/regions-bounded-by-trait-requiring-static.rs +++ b/src/test/ui/regions/regions-bounded-by-trait-requiring-static.rs @@ -2,6 +2,10 @@ // in this file all test region bound and lifetime violations that are // detected during type check. +// revisions: base nll +// ignore-compare-mode-nll +//[nll] compile-flags: -Z borrowck=mir + trait Dummy : 'static { } fn assert_send() { } @@ -19,15 +23,21 @@ fn static_lifime_ok<'a,T,U:Send>(_: &'a isize) { // otherwise lifetime pointers are not ok fn param_not_ok<'a>(x: &'a isize) { - assert_send::<&'a isize>(); //~ ERROR does not fulfill the required lifetime + assert_send::<&'a isize>(); + //[base]~^ ERROR does not fulfill the required lifetime + //[nll]~^^ ERROR lifetime may not live long enough } fn param_not_ok1<'a>(_: &'a isize) { - assert_send::<&'a str>(); //~ ERROR does not fulfill the required lifetime + assert_send::<&'a str>(); + //[base]~^ ERROR does not fulfill the required lifetime + //[nll]~^^ ERROR lifetime may not live long enough } fn param_not_ok2<'a>(_: &'a isize) { - assert_send::<&'a [isize]>(); //~ ERROR does not fulfill the required lifetime + assert_send::<&'a [isize]>(); + //[base]~^ ERROR does not fulfill the required lifetime + //[nll]~^^ ERROR lifetime may not live long enough } // boxes are ok @@ -41,7 +51,9 @@ fn box_ok() { // but not if they own a bad thing fn box_with_region_not_ok<'a>() { - assert_send::>(); //~ ERROR does not fulfill the required lifetime + assert_send::>(); + //[base]~^ ERROR does not fulfill the required lifetime + //[nll]~^^ ERROR lifetime may not live long enough } // raw pointers are ok unless they point at unsendable things @@ -52,11 +64,15 @@ fn unsafe_ok1<'a>(_: &'a isize) { } fn unsafe_ok2<'a>(_: &'a isize) { - assert_send::<*const &'a isize>(); //~ ERROR does not fulfill the required lifetime + assert_send::<*const &'a isize>(); + //[base]~^ ERROR does not fulfill the required lifetime + //[nll]~^^ ERROR lifetime may not live long enough } fn unsafe_ok3<'a>(_: &'a isize) { - assert_send::<*mut &'a isize>(); //~ ERROR does not fulfill the required lifetime + assert_send::<*mut &'a isize>(); + //[base]~^ ERROR does not fulfill the required lifetime + //[nll]~^^ ERROR lifetime may not live long enough } fn main() { diff --git a/src/test/ui/regions/regions-bounded-method-type-parameters-cross-crate.stderr b/src/test/ui/regions/regions-bounded-method-type-parameters-cross-crate.base.stderr similarity index 98% rename from src/test/ui/regions/regions-bounded-method-type-parameters-cross-crate.stderr rename to src/test/ui/regions/regions-bounded-method-type-parameters-cross-crate.base.stderr index eb205a303dbdf..e031f0db4124c 100644 --- a/src/test/ui/regions/regions-bounded-method-type-parameters-cross-crate.stderr +++ b/src/test/ui/regions/regions-bounded-method-type-parameters-cross-crate.base.stderr @@ -1,5 +1,5 @@ error[E0623]: lifetime mismatch - --> $DIR/regions-bounded-method-type-parameters-cross-crate.rs:20:7 + --> $DIR/regions-bounded-method-type-parameters-cross-crate.rs:23:7 | LL | fn call_bigger_region<'x, 'y>(a: Inv<'x>, b: Inv<'y>) { | ------- ------- these two types are declared with different lifetimes... diff --git a/src/test/ui/regions/regions-bounded-method-type-parameters-cross-crate.nll.stderr b/src/test/ui/regions/regions-bounded-method-type-parameters-cross-crate.nll.stderr index 6193bf02f6d0d..4f5d747be711b 100644 --- a/src/test/ui/regions/regions-bounded-method-type-parameters-cross-crate.nll.stderr +++ b/src/test/ui/regions/regions-bounded-method-type-parameters-cross-crate.nll.stderr @@ -1,5 +1,5 @@ error: lifetime may not live long enough - --> $DIR/regions-bounded-method-type-parameters-cross-crate.rs:20:5 + --> $DIR/regions-bounded-method-type-parameters-cross-crate.rs:23:5 | LL | fn call_bigger_region<'x, 'y>(a: Inv<'x>, b: Inv<'y>) { | -- -- lifetime `'y` defined here diff --git a/src/test/ui/regions/regions-bounded-method-type-parameters-cross-crate.rs b/src/test/ui/regions/regions-bounded-method-type-parameters-cross-crate.rs index a7987d0e1feb0..e0965613f1dbe 100644 --- a/src/test/ui/regions/regions-bounded-method-type-parameters-cross-crate.rs +++ b/src/test/ui/regions/regions-bounded-method-type-parameters-cross-crate.rs @@ -1,4 +1,7 @@ // aux-build:rbmtp_cross_crate_lib.rs +// revisions: base nll +// ignore-compare-mode-nll +//[nll] compile-flags: -Z borrowck=mir // Check explicit region bounds on methods in the cross crate case. @@ -17,7 +20,9 @@ fn call_into_maybe_owned<'x,F:IntoMaybeOwned<'x>>(f: F) { fn call_bigger_region<'x, 'y>(a: Inv<'x>, b: Inv<'y>) { // Here the value provided for 'y is 'y, and hence 'y:'x does not hold. - a.bigger_region(b) //~ ERROR lifetime mismatch [E0623] + a.bigger_region(b) + //[base]~^ ERROR lifetime mismatch [E0623] + //[nll]~^^ ERROR lifetime may not live long enough } fn main() { } diff --git a/src/test/ui/regions/regions-bounded-method-type-parameters-trait-bound.stderr b/src/test/ui/regions/regions-bounded-method-type-parameters-trait-bound.base.stderr similarity index 98% rename from src/test/ui/regions/regions-bounded-method-type-parameters-trait-bound.stderr rename to src/test/ui/regions/regions-bounded-method-type-parameters-trait-bound.base.stderr index de1073cd1d9da..0a213e3f77998 100644 --- a/src/test/ui/regions/regions-bounded-method-type-parameters-trait-bound.stderr +++ b/src/test/ui/regions/regions-bounded-method-type-parameters-trait-bound.base.stderr @@ -1,5 +1,5 @@ error[E0623]: lifetime mismatch - --> $DIR/regions-bounded-method-type-parameters-trait-bound.rs:20:7 + --> $DIR/regions-bounded-method-type-parameters-trait-bound.rs:24:7 | LL | fn caller2<'a,'b,F:Foo<'a>>(a: Inv<'a>, b: Inv<'b>, f: F) { | ------- ------- these two types are declared with different lifetimes... diff --git a/src/test/ui/regions/regions-bounded-method-type-parameters-trait-bound.nll.stderr b/src/test/ui/regions/regions-bounded-method-type-parameters-trait-bound.nll.stderr index 0e0086be9ea8d..1c2f46a5fc1b2 100644 --- a/src/test/ui/regions/regions-bounded-method-type-parameters-trait-bound.nll.stderr +++ b/src/test/ui/regions/regions-bounded-method-type-parameters-trait-bound.nll.stderr @@ -1,5 +1,5 @@ error: lifetime may not live long enough - --> $DIR/regions-bounded-method-type-parameters-trait-bound.rs:20:5 + --> $DIR/regions-bounded-method-type-parameters-trait-bound.rs:24:5 | LL | fn caller2<'a,'b,F:Foo<'a>>(a: Inv<'a>, b: Inv<'b>, f: F) { | -- -- lifetime `'b` defined here diff --git a/src/test/ui/regions/regions-bounded-method-type-parameters-trait-bound.rs b/src/test/ui/regions/regions-bounded-method-type-parameters-trait-bound.rs index 8adf496b2304d..8a52a1549abf2 100644 --- a/src/test/ui/regions/regions-bounded-method-type-parameters-trait-bound.rs +++ b/src/test/ui/regions/regions-bounded-method-type-parameters-trait-bound.rs @@ -2,6 +2,10 @@ // nominal types (but not on other types) and that they are type // checked. +// revisions: base nll +// ignore-compare-mode-nll +//[nll] compile-flags: -Z borrowck=mir + struct Inv<'a> { // invariant w/r/t 'a x: &'a mut &'a isize } @@ -17,7 +21,9 @@ fn caller1<'a,'b,F:Foo<'a>>(a: Inv<'a>, b: Inv<'b>, f: F) { fn caller2<'a,'b,F:Foo<'a>>(a: Inv<'a>, b: Inv<'b>, f: F) { // Here the value provided for 'y is 'b, and hence 'b:'a does not hold. - f.method(b); //~ ERROR lifetime mismatch [E0623] + f.method(b); + //[base]~^ ERROR lifetime mismatch [E0623] + //[nll]~^^ ERROR lifetime may not live long enough } fn caller3<'a,'b:'a,F:Foo<'a>>(a: Inv<'a>, b: Inv<'b>, f: F) { diff --git a/src/test/ui/regions/regions-bounded-method-type-parameters.stderr b/src/test/ui/regions/regions-bounded-method-type-parameters.base.stderr similarity index 77% rename from src/test/ui/regions/regions-bounded-method-type-parameters.stderr rename to src/test/ui/regions/regions-bounded-method-type-parameters.base.stderr index 318e9d006a148..3d37a1ba47b14 100644 --- a/src/test/ui/regions/regions-bounded-method-type-parameters.stderr +++ b/src/test/ui/regions/regions-bounded-method-type-parameters.base.stderr @@ -1,11 +1,11 @@ error[E0477]: the type `&'a isize` does not fulfill the required lifetime - --> $DIR/regions-bounded-method-type-parameters.rs:12:9 + --> $DIR/regions-bounded-method-type-parameters.rs:16:9 | LL | Foo.some_method::<&'a isize>(); | ^^^^^^^^^^^ | note: type must satisfy the static lifetime as required by this binding - --> $DIR/regions-bounded-method-type-parameters.rs:8:22 + --> $DIR/regions-bounded-method-type-parameters.rs:12:22 | LL | fn some_method(self) { } | ^^^^^^^ diff --git a/src/test/ui/regions/regions-bounded-method-type-parameters.nll.stderr b/src/test/ui/regions/regions-bounded-method-type-parameters.nll.stderr index b6d7b8aac5f19..05c3fa58ea363 100644 --- a/src/test/ui/regions/regions-bounded-method-type-parameters.nll.stderr +++ b/src/test/ui/regions/regions-bounded-method-type-parameters.nll.stderr @@ -1,5 +1,5 @@ error: lifetime may not live long enough - --> $DIR/regions-bounded-method-type-parameters.rs:12:9 + --> $DIR/regions-bounded-method-type-parameters.rs:16:9 | LL | fn caller<'a>(x: &isize) { | -- lifetime `'a` defined here diff --git a/src/test/ui/regions/regions-bounded-method-type-parameters.rs b/src/test/ui/regions/regions-bounded-method-type-parameters.rs index 90af120f052b0..06bc1544a3807 100644 --- a/src/test/ui/regions/regions-bounded-method-type-parameters.rs +++ b/src/test/ui/regions/regions-bounded-method-type-parameters.rs @@ -2,6 +2,10 @@ // nominal types (but not on other types) and that they are type // checked. +// revisions: base nll +// ignore-compare-mode-nll +//[nll] compile-flags: -Z borrowck=mir + struct Foo; impl Foo { @@ -10,7 +14,8 @@ impl Foo { fn caller<'a>(x: &isize) { Foo.some_method::<&'a isize>(); - //~^ ERROR does not fulfill the required lifetime + //[base]~^ ERROR does not fulfill the required lifetime + //[nll]~^^ ERROR lifetime may not live long enough } fn main() { } diff --git a/src/test/ui/regions/regions-bounds.stderr b/src/test/ui/regions/regions-bounds.base.stderr similarity index 91% rename from src/test/ui/regions/regions-bounds.stderr rename to src/test/ui/regions/regions-bounds.base.stderr index 90227e574ad47..d853cdde336df 100644 --- a/src/test/ui/regions/regions-bounds.stderr +++ b/src/test/ui/regions/regions-bounds.base.stderr @@ -1,5 +1,5 @@ error[E0308]: mismatched types - --> $DIR/regions-bounds.rs:9:12 + --> $DIR/regions-bounds.rs:13:12 | LL | return e; | ^ lifetime mismatch @@ -7,18 +7,18 @@ LL | return e; = note: expected struct `TupleStruct<'b>` found struct `TupleStruct<'a>` note: the lifetime `'a` as defined here... - --> $DIR/regions-bounds.rs:8:10 + --> $DIR/regions-bounds.rs:12:10 | LL | fn a_fn1<'a,'b>(e: TupleStruct<'a>) -> TupleStruct<'b> { | ^^ note: ...does not necessarily outlive the lifetime `'b` as defined here - --> $DIR/regions-bounds.rs:8:13 + --> $DIR/regions-bounds.rs:12:13 | LL | fn a_fn1<'a,'b>(e: TupleStruct<'a>) -> TupleStruct<'b> { | ^^ error[E0308]: mismatched types - --> $DIR/regions-bounds.rs:13:12 + --> $DIR/regions-bounds.rs:19:12 | LL | return e; | ^ lifetime mismatch @@ -26,12 +26,12 @@ LL | return e; = note: expected struct `Struct<'b>` found struct `Struct<'a>` note: the lifetime `'a` as defined here... - --> $DIR/regions-bounds.rs:12:10 + --> $DIR/regions-bounds.rs:18:10 | LL | fn a_fn3<'a,'b>(e: Struct<'a>) -> Struct<'b> { | ^^ note: ...does not necessarily outlive the lifetime `'b` as defined here - --> $DIR/regions-bounds.rs:12:13 + --> $DIR/regions-bounds.rs:18:13 | LL | fn a_fn3<'a,'b>(e: Struct<'a>) -> Struct<'b> { | ^^ diff --git a/src/test/ui/regions/regions-bounds.nll.stderr b/src/test/ui/regions/regions-bounds.nll.stderr index 84226a5755319..7109220165f12 100644 --- a/src/test/ui/regions/regions-bounds.nll.stderr +++ b/src/test/ui/regions/regions-bounds.nll.stderr @@ -1,5 +1,5 @@ error: lifetime may not live long enough - --> $DIR/regions-bounds.rs:9:12 + --> $DIR/regions-bounds.rs:13:12 | LL | fn a_fn1<'a,'b>(e: TupleStruct<'a>) -> TupleStruct<'b> { | -- -- lifetime `'b` defined here @@ -11,7 +11,7 @@ LL | return e; = help: consider adding the following bound: `'a: 'b` error: lifetime may not live long enough - --> $DIR/regions-bounds.rs:13:12 + --> $DIR/regions-bounds.rs:19:12 | LL | fn a_fn3<'a,'b>(e: Struct<'a>) -> Struct<'b> { | -- -- lifetime `'b` defined here diff --git a/src/test/ui/regions/regions-bounds.rs b/src/test/ui/regions/regions-bounds.rs index d3e4e6e8712bf..b13dac49f8c85 100644 --- a/src/test/ui/regions/regions-bounds.rs +++ b/src/test/ui/regions/regions-bounds.rs @@ -2,15 +2,23 @@ // nominal types (but not on other types) and that they are type // checked. +// revisions: base nll +// ignore-compare-mode-nll +//[nll] compile-flags: -Z borrowck=mir + struct TupleStruct<'a>(&'a isize); struct Struct<'a> { x:&'a isize } fn a_fn1<'a,'b>(e: TupleStruct<'a>) -> TupleStruct<'b> { - return e; //~ ERROR mismatched types + return e; + //[base]~^ ERROR mismatched types + //[nll]~^^ ERROR lifetime may not live long enough } fn a_fn3<'a,'b>(e: Struct<'a>) -> Struct<'b> { - return e; //~ ERROR mismatched types + return e; + //[base]~^ ERROR mismatched types + //[nll]~^^ ERROR lifetime may not live long enough } fn main() { } diff --git a/src/test/ui/regions/regions-close-associated-type-into-object.stderr b/src/test/ui/regions/regions-close-associated-type-into-object.base.stderr similarity index 85% rename from src/test/ui/regions/regions-close-associated-type-into-object.stderr rename to src/test/ui/regions/regions-close-associated-type-into-object.base.stderr index 536a1b5e359cf..fbbb598040172 100644 --- a/src/test/ui/regions/regions-close-associated-type-into-object.stderr +++ b/src/test/ui/regions/regions-close-associated-type-into-object.base.stderr @@ -1,5 +1,5 @@ error[E0310]: the associated type `::Item` may not live long enough - --> $DIR/regions-close-associated-type-into-object.rs:15:5 + --> $DIR/regions-close-associated-type-into-object.rs:19:5 | LL | Box::new(item) | ^^^^^^^^^^^^^^ @@ -8,7 +8,7 @@ LL | Box::new(item) = note: ...so that the type `::Item` will meet its required lifetime bounds error[E0310]: the associated type `::Item` may not live long enough - --> $DIR/regions-close-associated-type-into-object.rs:22:5 + --> $DIR/regions-close-associated-type-into-object.rs:26:5 | LL | Box::new(item) | ^^^^^^^^^^^^^^ @@ -17,7 +17,7 @@ LL | Box::new(item) = note: ...so that the type `Box<::Item>` will meet its required lifetime bounds error[E0309]: the associated type `::Item` may not live long enough - --> $DIR/regions-close-associated-type-into-object.rs:28:5 + --> $DIR/regions-close-associated-type-into-object.rs:32:5 | LL | Box::new(item) | ^^^^^^^^^^^^^^ @@ -26,7 +26,7 @@ LL | Box::new(item) = note: ...so that the type `::Item` will meet its required lifetime bounds error[E0309]: the associated type `::Item` may not live long enough - --> $DIR/regions-close-associated-type-into-object.rs:35:5 + --> $DIR/regions-close-associated-type-into-object.rs:39:5 | LL | Box::new(item) | ^^^^^^^^^^^^^^ diff --git a/src/test/ui/regions/regions-close-associated-type-into-object.nll.stderr b/src/test/ui/regions/regions-close-associated-type-into-object.nll.stderr index f7dcaa9d97e7c..dd4b97aa5628a 100644 --- a/src/test/ui/regions/regions-close-associated-type-into-object.nll.stderr +++ b/src/test/ui/regions/regions-close-associated-type-into-object.nll.stderr @@ -1,5 +1,5 @@ error[E0310]: the associated type `::Item` may not live long enough - --> $DIR/regions-close-associated-type-into-object.rs:15:5 + --> $DIR/regions-close-associated-type-into-object.rs:19:5 | LL | Box::new(item) | ^^^^^^^^^^^^^^ @@ -8,7 +8,7 @@ LL | Box::new(item) = note: ...so that the type `::Item` will meet its required lifetime bounds error[E0310]: the associated type `::Item` may not live long enough - --> $DIR/regions-close-associated-type-into-object.rs:22:5 + --> $DIR/regions-close-associated-type-into-object.rs:26:5 | LL | Box::new(item) | ^^^^^^^^^^^^^^ @@ -17,7 +17,7 @@ LL | Box::new(item) = note: ...so that the type `::Item` will meet its required lifetime bounds error[E0309]: the associated type `::Item` may not live long enough - --> $DIR/regions-close-associated-type-into-object.rs:28:5 + --> $DIR/regions-close-associated-type-into-object.rs:32:5 | LL | Box::new(item) | ^^^^^^^^^^^^^^ @@ -26,7 +26,7 @@ LL | Box::new(item) = note: ...so that the type `::Item` will meet its required lifetime bounds error[E0309]: the associated type `::Item` may not live long enough - --> $DIR/regions-close-associated-type-into-object.rs:35:5 + --> $DIR/regions-close-associated-type-into-object.rs:39:5 | LL | Box::new(item) | ^^^^^^^^^^^^^^ diff --git a/src/test/ui/regions/regions-close-associated-type-into-object.rs b/src/test/ui/regions/regions-close-associated-type-into-object.rs index 428477e24899a..94199f5621228 100644 --- a/src/test/ui/regions/regions-close-associated-type-into-object.rs +++ b/src/test/ui/regions/regions-close-associated-type-into-object.rs @@ -1,3 +1,7 @@ +// revisions: base nll +// ignore-compare-mode-nll +//[nll] compile-flags: -Z borrowck=mir + trait X {} diff --git a/src/test/ui/regions/regions-close-object-into-object-2.stderr b/src/test/ui/regions/regions-close-object-into-object-2.base.stderr similarity index 92% rename from src/test/ui/regions/regions-close-object-into-object-2.stderr rename to src/test/ui/regions/regions-close-object-into-object-2.base.stderr index 4153f4f29bc28..ddf168ffd106b 100644 --- a/src/test/ui/regions/regions-close-object-into-object-2.stderr +++ b/src/test/ui/regions/regions-close-object-into-object-2.base.stderr @@ -1,5 +1,5 @@ error[E0759]: `v` has lifetime `'a` but it needs to satisfy a `'static` lifetime requirement - --> $DIR/regions-close-object-into-object-2.rs:9:16 + --> $DIR/regions-close-object-into-object-2.rs:13:16 | LL | fn g<'a, T: 'static>(v: Box + 'a>) -> Box { | ------------------ this data with lifetime `'a`... @@ -7,7 +7,7 @@ LL | Box::new(B(&*v)) as Box | ^^^ ...is used and required to live as long as `'static` here | note: `'static` lifetime requirement introduced by the return type - --> $DIR/regions-close-object-into-object-2.rs:8:60 + --> $DIR/regions-close-object-into-object-2.rs:12:60 | LL | fn g<'a, T: 'static>(v: Box + 'a>) -> Box { | ^^^^^^^ `'static` requirement introduced here diff --git a/src/test/ui/regions/regions-close-object-into-object-2.nll.stderr b/src/test/ui/regions/regions-close-object-into-object-2.nll.stderr index 6a0e958616101..1a79da2776b0a 100644 --- a/src/test/ui/regions/regions-close-object-into-object-2.nll.stderr +++ b/src/test/ui/regions/regions-close-object-into-object-2.nll.stderr @@ -1,5 +1,5 @@ error: lifetime may not live long enough - --> $DIR/regions-close-object-into-object-2.rs:9:5 + --> $DIR/regions-close-object-into-object-2.rs:13:5 | LL | fn g<'a, T: 'static>(v: Box + 'a>) -> Box { | -- lifetime `'a` defined here @@ -7,7 +7,7 @@ LL | Box::new(B(&*v)) as Box | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ returning this value requires that `'a` must outlive `'static` error[E0515]: cannot return value referencing local data `*v` - --> $DIR/regions-close-object-into-object-2.rs:9:5 + --> $DIR/regions-close-object-into-object-2.rs:13:5 | LL | Box::new(B(&*v)) as Box | ^^^^^^^^^^^---^^^^^^^^^^^^^^^^ diff --git a/src/test/ui/regions/regions-close-object-into-object-2.rs b/src/test/ui/regions/regions-close-object-into-object-2.rs index 9c41174e24d8d..33ea03f061e09 100644 --- a/src/test/ui/regions/regions-close-object-into-object-2.rs +++ b/src/test/ui/regions/regions-close-object-into-object-2.rs @@ -1,3 +1,7 @@ +// revisions: base nll +// ignore-compare-mode-nll +//[nll] compile-flags: -Z borrowck=mir + trait A { } struct B<'a, T:'a>(&'a (dyn A + 'a)); @@ -6,7 +10,10 @@ trait X { } impl<'a, T> X for B<'a, T> {} fn g<'a, T: 'static>(v: Box + 'a>) -> Box { - Box::new(B(&*v)) as Box //~ ERROR E0759 + Box::new(B(&*v)) as Box + //[base]~^ ERROR E0759 + //[nll]~^^ ERROR lifetime may not live long enough + //[nll]~| ERROR cannot return value referencing local data `*v` [E0515] } fn main() { } diff --git a/src/test/ui/regions/regions-close-object-into-object-4.stderr b/src/test/ui/regions/regions-close-object-into-object-4.base.stderr similarity index 91% rename from src/test/ui/regions/regions-close-object-into-object-4.stderr rename to src/test/ui/regions/regions-close-object-into-object-4.base.stderr index 2ea4b431b38da..33d4df3d19450 100644 --- a/src/test/ui/regions/regions-close-object-into-object-4.stderr +++ b/src/test/ui/regions/regions-close-object-into-object-4.base.stderr @@ -1,5 +1,5 @@ error[E0759]: `v` has lifetime `'a` but it needs to satisfy a `'static` lifetime requirement - --> $DIR/regions-close-object-into-object-4.rs:9:16 + --> $DIR/regions-close-object-into-object-4.rs:13:16 | LL | fn i<'a, T, U>(v: Box+'a>) -> Box { | ---------------- this data with lifetime `'a`... @@ -7,7 +7,7 @@ LL | Box::new(B(&*v)) as Box | ^^^ ...is used and required to live as long as `'static` here | note: `'static` lifetime requirement introduced by the return type - --> $DIR/regions-close-object-into-object-4.rs:8:52 + --> $DIR/regions-close-object-into-object-4.rs:12:52 | LL | fn i<'a, T, U>(v: Box+'a>) -> Box { | ^^^^^^^ `'static` requirement introduced here diff --git a/src/test/ui/regions/regions-close-object-into-object-4.nll.stderr b/src/test/ui/regions/regions-close-object-into-object-4.nll.stderr index 6a2429e51ecda..993b13ddbf803 100644 --- a/src/test/ui/regions/regions-close-object-into-object-4.nll.stderr +++ b/src/test/ui/regions/regions-close-object-into-object-4.nll.stderr @@ -1,5 +1,5 @@ error[E0310]: the parameter type `U` may not live long enough - --> $DIR/regions-close-object-into-object-4.rs:9:5 + --> $DIR/regions-close-object-into-object-4.rs:13:5 | LL | fn i<'a, T, U>(v: Box+'a>) -> Box { | - help: consider adding an explicit lifetime bound...: `U: 'static` @@ -7,7 +7,7 @@ LL | Box::new(B(&*v)) as Box | ^^^^^^^^ ...so that the type `U` will meet its required lifetime bounds error[E0310]: the parameter type `U` may not live long enough - --> $DIR/regions-close-object-into-object-4.rs:9:5 + --> $DIR/regions-close-object-into-object-4.rs:13:5 | LL | fn i<'a, T, U>(v: Box+'a>) -> Box { | - help: consider adding an explicit lifetime bound...: `U: 'static` @@ -15,7 +15,7 @@ LL | Box::new(B(&*v)) as Box | ^^^^^^^^^^^^^^^^ ...so that the type `U` will meet its required lifetime bounds error[E0310]: the parameter type `U` may not live long enough - --> $DIR/regions-close-object-into-object-4.rs:9:5 + --> $DIR/regions-close-object-into-object-4.rs:13:5 | LL | fn i<'a, T, U>(v: Box+'a>) -> Box { | - help: consider adding an explicit lifetime bound...: `U: 'static` @@ -23,7 +23,7 @@ LL | Box::new(B(&*v)) as Box | ^^^^^^^^^^^^^^^^ ...so that the type `U` will meet its required lifetime bounds error: lifetime may not live long enough - --> $DIR/regions-close-object-into-object-4.rs:9:5 + --> $DIR/regions-close-object-into-object-4.rs:13:5 | LL | fn i<'a, T, U>(v: Box+'a>) -> Box { | -- lifetime `'a` defined here @@ -31,7 +31,7 @@ LL | Box::new(B(&*v)) as Box | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ returning this value requires that `'a` must outlive `'static` error[E0515]: cannot return value referencing local data `*v` - --> $DIR/regions-close-object-into-object-4.rs:9:5 + --> $DIR/regions-close-object-into-object-4.rs:13:5 | LL | Box::new(B(&*v)) as Box | ^^^^^^^^^^^---^^^^^^^^^^^^^^^^ @@ -40,7 +40,7 @@ LL | Box::new(B(&*v)) as Box | returns a value referencing data owned by the current function error[E0310]: the parameter type `U` may not live long enough - --> $DIR/regions-close-object-into-object-4.rs:9:14 + --> $DIR/regions-close-object-into-object-4.rs:13:14 | LL | fn i<'a, T, U>(v: Box+'a>) -> Box { | - help: consider adding an explicit lifetime bound...: `U: 'static` diff --git a/src/test/ui/regions/regions-close-object-into-object-4.rs b/src/test/ui/regions/regions-close-object-into-object-4.rs index 2a06a2b7c0513..5a852b7329a0f 100644 --- a/src/test/ui/regions/regions-close-object-into-object-4.rs +++ b/src/test/ui/regions/regions-close-object-into-object-4.rs @@ -1,3 +1,7 @@ +// revisions: base nll +// ignore-compare-mode-nll +//[nll] compile-flags: -Z borrowck=mir + trait A { } struct B<'a, T:'a>(&'a (dyn A + 'a)); @@ -6,7 +10,15 @@ trait X { } impl<'a, T> X for B<'a, T> {} fn i<'a, T, U>(v: Box+'a>) -> Box { - Box::new(B(&*v)) as Box //~ ERROR E0759 + Box::new(B(&*v)) as Box + //[base]~^ ERROR E0759 + //[nll]~^^ ERROR the parameter type `U` may not live long enough [E0310] + //[nll]~| ERROR the parameter type `U` may not live long enough [E0310] + //[nll]~| ERROR the parameter type `U` may not live long enough [E0310] + //[nll]~| ERROR lifetime may not live long enough + //[nll]~| ERROR cannot return value referencing local data `*v` [E0515] + //[nll]~| ERROR the parameter type `U` may not live long enough [E0310] + } fn main() {} diff --git a/src/test/ui/regions/regions-close-object-into-object-5.stderr b/src/test/ui/regions/regions-close-object-into-object-5.base.stderr similarity index 84% rename from src/test/ui/regions/regions-close-object-into-object-5.stderr rename to src/test/ui/regions/regions-close-object-into-object-5.base.stderr index 512a7ab35fbfd..8b5a06bab7156 100644 --- a/src/test/ui/regions/regions-close-object-into-object-5.stderr +++ b/src/test/ui/regions/regions-close-object-into-object-5.base.stderr @@ -1,5 +1,5 @@ error[E0310]: the parameter type `T` may not live long enough - --> $DIR/regions-close-object-into-object-5.rs:17:5 + --> $DIR/regions-close-object-into-object-5.rs:21:5 | LL | fn f<'a, T, U>(v: Box + 'static>) -> Box { | - help: consider adding an explicit lifetime bound...: `T: 'static` @@ -8,13 +8,13 @@ LL | Box::new(B(&*v)) as Box | ^^^^^^^^ ...so that the type `T` will meet its required lifetime bounds... | note: ...that is required by this bound - --> $DIR/regions-close-object-into-object-5.rs:9:17 + --> $DIR/regions-close-object-into-object-5.rs:13:17 | LL | struct B<'a, T: 'a>(&'a (A + 'a)); | ^^ error[E0310]: the parameter type `T` may not live long enough - --> $DIR/regions-close-object-into-object-5.rs:17:5 + --> $DIR/regions-close-object-into-object-5.rs:21:5 | LL | fn f<'a, T, U>(v: Box + 'static>) -> Box { | - help: consider adding an explicit lifetime bound...: `T: 'static` @@ -23,7 +23,7 @@ LL | Box::new(B(&*v)) as Box | ^^^^^^^^^^^^^^^^ ...so that the type `B<'_, T>` will meet its required lifetime bounds error[E0310]: the parameter type `T` may not live long enough - --> $DIR/regions-close-object-into-object-5.rs:17:14 + --> $DIR/regions-close-object-into-object-5.rs:21:14 | LL | fn f<'a, T, U>(v: Box + 'static>) -> Box { | - help: consider adding an explicit lifetime bound...: `T: 'static` @@ -32,13 +32,13 @@ LL | Box::new(B(&*v)) as Box | ^ ...so that the type `T` will meet its required lifetime bounds... | note: ...that is required by this bound - --> $DIR/regions-close-object-into-object-5.rs:9:17 + --> $DIR/regions-close-object-into-object-5.rs:13:17 | LL | struct B<'a, T: 'a>(&'a (A + 'a)); | ^^ error[E0310]: the parameter type `T` may not live long enough - --> $DIR/regions-close-object-into-object-5.rs:17:14 + --> $DIR/regions-close-object-into-object-5.rs:21:14 | LL | fn f<'a, T, U>(v: Box + 'static>) -> Box { | - help: consider adding an explicit lifetime bound...: `T: 'static` @@ -47,13 +47,13 @@ LL | Box::new(B(&*v)) as Box | ^^^^^^ ...so that the type `T` will meet its required lifetime bounds... | note: ...that is required by this bound - --> $DIR/regions-close-object-into-object-5.rs:9:17 + --> $DIR/regions-close-object-into-object-5.rs:13:17 | LL | struct B<'a, T: 'a>(&'a (A + 'a)); | ^^ error[E0310]: the parameter type `T` may not live long enough - --> $DIR/regions-close-object-into-object-5.rs:17:16 + --> $DIR/regions-close-object-into-object-5.rs:21:16 | LL | fn f<'a, T, U>(v: Box + 'static>) -> Box { | - help: consider adding an explicit lifetime bound...: `T: 'static` @@ -62,7 +62,7 @@ LL | Box::new(B(&*v)) as Box | ^^^ ...so that the reference type `&dyn A` does not outlive the data it points at error[E0310]: the parameter type `T` may not live long enough - --> $DIR/regions-close-object-into-object-5.rs:17:16 + --> $DIR/regions-close-object-into-object-5.rs:21:16 | LL | fn f<'a, T, U>(v: Box + 'static>) -> Box { | - help: consider adding an explicit lifetime bound...: `T: 'static` @@ -71,7 +71,7 @@ LL | Box::new(B(&*v)) as Box | ^^^ ...so that the type `(dyn A + 'static)` is not borrowed for too long error[E0310]: the parameter type `T` may not live long enough - --> $DIR/regions-close-object-into-object-5.rs:17:16 + --> $DIR/regions-close-object-into-object-5.rs:21:16 | LL | fn f<'a, T, U>(v: Box + 'static>) -> Box { | - help: consider adding an explicit lifetime bound...: `T: 'static` diff --git a/src/test/ui/regions/regions-close-object-into-object-5.nll.stderr b/src/test/ui/regions/regions-close-object-into-object-5.nll.stderr index 54302cc6dca22..f4e3809e91613 100644 --- a/src/test/ui/regions/regions-close-object-into-object-5.nll.stderr +++ b/src/test/ui/regions/regions-close-object-into-object-5.nll.stderr @@ -1,5 +1,5 @@ error[E0310]: the parameter type `T` may not live long enough - --> $DIR/regions-close-object-into-object-5.rs:17:5 + --> $DIR/regions-close-object-into-object-5.rs:21:5 | LL | fn f<'a, T, U>(v: Box + 'static>) -> Box { | - help: consider adding an explicit lifetime bound...: `T: 'static` @@ -8,7 +8,7 @@ LL | Box::new(B(&*v)) as Box | ^^^^^^^^ ...so that the type `T` will meet its required lifetime bounds error[E0310]: the parameter type `T` may not live long enough - --> $DIR/regions-close-object-into-object-5.rs:17:5 + --> $DIR/regions-close-object-into-object-5.rs:21:5 | LL | fn f<'a, T, U>(v: Box + 'static>) -> Box { | - help: consider adding an explicit lifetime bound...: `T: 'static` @@ -17,7 +17,7 @@ LL | Box::new(B(&*v)) as Box | ^^^^^^^^^^^^^^^^ ...so that the type `T` will meet its required lifetime bounds error[E0310]: the parameter type `T` may not live long enough - --> $DIR/regions-close-object-into-object-5.rs:17:5 + --> $DIR/regions-close-object-into-object-5.rs:21:5 | LL | fn f<'a, T, U>(v: Box + 'static>) -> Box { | - help: consider adding an explicit lifetime bound...: `T: 'static` @@ -26,7 +26,7 @@ LL | Box::new(B(&*v)) as Box | ^^^^^^^^^^^^^^^^ ...so that the type `T` will meet its required lifetime bounds error[E0515]: cannot return value referencing local data `*v` - --> $DIR/regions-close-object-into-object-5.rs:17:5 + --> $DIR/regions-close-object-into-object-5.rs:21:5 | LL | Box::new(B(&*v)) as Box | ^^^^^^^^^^^---^^^^^^^^^^^^^^^^ @@ -35,7 +35,7 @@ LL | Box::new(B(&*v)) as Box | returns a value referencing data owned by the current function error[E0310]: the parameter type `T` may not live long enough - --> $DIR/regions-close-object-into-object-5.rs:17:14 + --> $DIR/regions-close-object-into-object-5.rs:21:14 | LL | fn f<'a, T, U>(v: Box + 'static>) -> Box { | - help: consider adding an explicit lifetime bound...: `T: 'static` diff --git a/src/test/ui/regions/regions-close-object-into-object-5.rs b/src/test/ui/regions/regions-close-object-into-object-5.rs index 5471c375b4990..0e5fec28d19b0 100644 --- a/src/test/ui/regions/regions-close-object-into-object-5.rs +++ b/src/test/ui/regions/regions-close-object-into-object-5.rs @@ -1,3 +1,7 @@ +// revisions: base nll +// ignore-compare-mode-nll +//[nll] compile-flags: -Z borrowck=mir + #![allow(warnings)] @@ -19,9 +23,10 @@ fn f<'a, T, U>(v: Box + 'static>) -> Box { //~| ERROR the parameter type `T` may not live long enough //~| ERROR the parameter type `T` may not live long enough //~| ERROR the parameter type `T` may not live long enough - //~| ERROR the parameter type `T` may not live long enough - //~| ERROR the parameter type `T` may not live long enough - //~| ERROR the parameter type `T` may not live long enough + //[base]~| ERROR the parameter type `T` may not live long enough + //[base]~| ERROR the parameter type `T` may not live long enough + //[base]~| ERROR the parameter type `T` may not live long enough + //[nll]~| ERROR cannot return value referencing local data `*v` [E0515] } fn main() {} diff --git a/src/test/ui/regions/regions-close-over-type-parameter-1.stderr b/src/test/ui/regions/regions-close-over-type-parameter-1.base.stderr similarity index 89% rename from src/test/ui/regions/regions-close-over-type-parameter-1.stderr rename to src/test/ui/regions/regions-close-over-type-parameter-1.base.stderr index 063c3b19a19cc..41dc03e86dd85 100644 --- a/src/test/ui/regions/regions-close-over-type-parameter-1.stderr +++ b/src/test/ui/regions/regions-close-over-type-parameter-1.base.stderr @@ -1,5 +1,5 @@ error[E0310]: the parameter type `A` may not live long enough - --> $DIR/regions-close-over-type-parameter-1.rs:12:5 + --> $DIR/regions-close-over-type-parameter-1.rs:15:5 | LL | fn make_object1(v: A) -> Box { | -- help: consider adding an explicit lifetime bound...: `A: 'static +` @@ -7,7 +7,7 @@ LL | Box::new(v) as Box | ^^^^^^^^^^^ ...so that the type `A` will meet its required lifetime bounds error[E0309]: the parameter type `A` may not live long enough - --> $DIR/regions-close-over-type-parameter-1.rs:21:5 + --> $DIR/regions-close-over-type-parameter-1.rs:24:5 | LL | fn make_object3<'a, 'b, A: SomeTrait + 'a>(v: A) -> Box { | -- help: consider adding an explicit lifetime bound...: `A: 'b +` diff --git a/src/test/ui/regions/regions-close-over-type-parameter-1.nll.stderr b/src/test/ui/regions/regions-close-over-type-parameter-1.nll.stderr index 063c3b19a19cc..41dc03e86dd85 100644 --- a/src/test/ui/regions/regions-close-over-type-parameter-1.nll.stderr +++ b/src/test/ui/regions/regions-close-over-type-parameter-1.nll.stderr @@ -1,5 +1,5 @@ error[E0310]: the parameter type `A` may not live long enough - --> $DIR/regions-close-over-type-parameter-1.rs:12:5 + --> $DIR/regions-close-over-type-parameter-1.rs:15:5 | LL | fn make_object1(v: A) -> Box { | -- help: consider adding an explicit lifetime bound...: `A: 'static +` @@ -7,7 +7,7 @@ LL | Box::new(v) as Box | ^^^^^^^^^^^ ...so that the type `A` will meet its required lifetime bounds error[E0309]: the parameter type `A` may not live long enough - --> $DIR/regions-close-over-type-parameter-1.rs:21:5 + --> $DIR/regions-close-over-type-parameter-1.rs:24:5 | LL | fn make_object3<'a, 'b, A: SomeTrait + 'a>(v: A) -> Box { | -- help: consider adding an explicit lifetime bound...: `A: 'b +` diff --git a/src/test/ui/regions/regions-close-over-type-parameter-1.rs b/src/test/ui/regions/regions-close-over-type-parameter-1.rs index 52d18c5d7a6fa..cf425bcd4f342 100644 --- a/src/test/ui/regions/regions-close-over-type-parameter-1.rs +++ b/src/test/ui/regions/regions-close-over-type-parameter-1.rs @@ -2,6 +2,9 @@ // an object. This should yield errors unless `A` (and the object) // both have suitable bounds. +// revisions: base nll +// ignore-compare-mode-nll +//[nll] compile-flags: -Z borrowck=mir trait SomeTrait { fn get(&self) -> isize; diff --git a/src/test/ui/regions/regions-close-over-type-parameter-multiple.stderr b/src/test/ui/regions/regions-close-over-type-parameter-multiple.base.stderr similarity index 77% rename from src/test/ui/regions/regions-close-over-type-parameter-multiple.stderr rename to src/test/ui/regions/regions-close-over-type-parameter-multiple.base.stderr index aa22fd96deb64..171203897d7d6 100644 --- a/src/test/ui/regions/regions-close-over-type-parameter-multiple.stderr +++ b/src/test/ui/regions/regions-close-over-type-parameter-multiple.base.stderr @@ -1,26 +1,26 @@ error[E0495]: cannot infer an appropriate lifetime due to conflicting requirements - --> $DIR/regions-close-over-type-parameter-multiple.rs:20:5 + --> $DIR/regions-close-over-type-parameter-multiple.rs:23:5 | LL | Box::new(v) as Box | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | note: first, the lifetime cannot outlive the lifetime `'a` as defined here... - --> $DIR/regions-close-over-type-parameter-multiple.rs:18:20 + --> $DIR/regions-close-over-type-parameter-multiple.rs:21:20 | LL | fn make_object_bad<'a,'b,'c,A:SomeTrait+'a+'b>(v: A) -> Box { | ^^ note: ...so that the declared lifetime parameter bounds are satisfied - --> $DIR/regions-close-over-type-parameter-multiple.rs:20:5 + --> $DIR/regions-close-over-type-parameter-multiple.rs:23:5 | LL | Box::new(v) as Box | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ note: but, the lifetime must be valid for the lifetime `'c` as defined here... - --> $DIR/regions-close-over-type-parameter-multiple.rs:18:26 + --> $DIR/regions-close-over-type-parameter-multiple.rs:21:26 | LL | fn make_object_bad<'a,'b,'c,A:SomeTrait+'a+'b>(v: A) -> Box { | ^^ note: ...so that the types are compatible - --> $DIR/regions-close-over-type-parameter-multiple.rs:20:5 + --> $DIR/regions-close-over-type-parameter-multiple.rs:23:5 | LL | Box::new(v) as Box | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/src/test/ui/regions/regions-close-over-type-parameter-multiple.nll.stderr b/src/test/ui/regions/regions-close-over-type-parameter-multiple.nll.stderr index 25566742099c2..66459957ed466 100644 --- a/src/test/ui/regions/regions-close-over-type-parameter-multiple.nll.stderr +++ b/src/test/ui/regions/regions-close-over-type-parameter-multiple.nll.stderr @@ -1,5 +1,5 @@ error: lifetime may not live long enough - --> $DIR/regions-close-over-type-parameter-multiple.rs:20:5 + --> $DIR/regions-close-over-type-parameter-multiple.rs:23:5 | LL | fn make_object_bad<'a,'b,'c,A:SomeTrait+'a+'b>(v: A) -> Box { | -- -- lifetime `'c` defined here diff --git a/src/test/ui/regions/regions-close-over-type-parameter-multiple.rs b/src/test/ui/regions/regions-close-over-type-parameter-multiple.rs index fc7696e7e0320..3d5f4e12665b8 100644 --- a/src/test/ui/regions/regions-close-over-type-parameter-multiple.rs +++ b/src/test/ui/regions/regions-close-over-type-parameter-multiple.rs @@ -1,6 +1,9 @@ // Various tests where we over type parameters with multiple lifetime // bounds. +// revisions: base nll +// ignore-compare-mode-nll +//[nll] compile-flags: -Z borrowck=mir trait SomeTrait { fn get(&self) -> isize; } @@ -17,7 +20,9 @@ fn make_object_good2<'a,'b,A:SomeTrait+'a+'b>(v: A) -> Box { fn make_object_bad<'a,'b,'c,A:SomeTrait+'a+'b>(v: A) -> Box { // A outlives 'a AND 'b...but not 'c. - Box::new(v) as Box //~ ERROR cannot infer an appropriate lifetime + Box::new(v) as Box + //[base]~^ ERROR cannot infer an appropriate lifetime + //[nll]~^^ ERROR lifetime may not live long enough } fn main() { diff --git a/src/test/ui/regions/regions-close-param-into-object.stderr b/src/test/ui/regions/regions-close-param-into-object.base.stderr similarity index 87% rename from src/test/ui/regions/regions-close-param-into-object.stderr rename to src/test/ui/regions/regions-close-param-into-object.base.stderr index 5c355bbb734b7..7e135c654505b 100644 --- a/src/test/ui/regions/regions-close-param-into-object.stderr +++ b/src/test/ui/regions/regions-close-param-into-object.base.stderr @@ -1,5 +1,5 @@ error[E0310]: the parameter type `T` may not live long enough - --> $DIR/regions-close-param-into-object.rs:6:5 + --> $DIR/regions-close-param-into-object.rs:10:5 | LL | fn p1(v: T) -> Box | - help: consider adding an explicit lifetime bound...: `T: 'static` @@ -8,7 +8,7 @@ LL | Box::new(v) | ^^^^^^^^^^^ ...so that the type `T` will meet its required lifetime bounds error[E0310]: the parameter type `T` may not live long enough - --> $DIR/regions-close-param-into-object.rs:12:5 + --> $DIR/regions-close-param-into-object.rs:16:5 | LL | fn p2(v: Box) -> Box | - help: consider adding an explicit lifetime bound...: `T: 'static` @@ -17,7 +17,7 @@ LL | Box::new(v) | ^^^^^^^^^^^ ...so that the type `Box` will meet its required lifetime bounds error[E0309]: the parameter type `T` may not live long enough - --> $DIR/regions-close-param-into-object.rs:18:5 + --> $DIR/regions-close-param-into-object.rs:22:5 | LL | fn p3<'a,T>(v: T) -> Box | - help: consider adding an explicit lifetime bound...: `T: 'a` @@ -26,7 +26,7 @@ LL | Box::new(v) | ^^^^^^^^^^^ ...so that the type `T` will meet its required lifetime bounds error[E0309]: the parameter type `T` may not live long enough - --> $DIR/regions-close-param-into-object.rs:24:5 + --> $DIR/regions-close-param-into-object.rs:28:5 | LL | fn p4<'a,T>(v: Box) -> Box | - help: consider adding an explicit lifetime bound...: `T: 'a` diff --git a/src/test/ui/regions/regions-close-param-into-object.nll.stderr b/src/test/ui/regions/regions-close-param-into-object.nll.stderr index f0464e299bbec..3fbc102263115 100644 --- a/src/test/ui/regions/regions-close-param-into-object.nll.stderr +++ b/src/test/ui/regions/regions-close-param-into-object.nll.stderr @@ -1,5 +1,5 @@ error[E0310]: the parameter type `T` may not live long enough - --> $DIR/regions-close-param-into-object.rs:6:5 + --> $DIR/regions-close-param-into-object.rs:10:5 | LL | fn p1(v: T) -> Box | - help: consider adding an explicit lifetime bound...: `T: 'static` @@ -8,7 +8,7 @@ LL | Box::new(v) | ^^^^^^^^^^^ ...so that the type `T` will meet its required lifetime bounds error[E0310]: the parameter type `T` may not live long enough - --> $DIR/regions-close-param-into-object.rs:12:5 + --> $DIR/regions-close-param-into-object.rs:16:5 | LL | fn p2(v: Box) -> Box | - help: consider adding an explicit lifetime bound...: `T: 'static` @@ -17,7 +17,7 @@ LL | Box::new(v) | ^^^^^^^^^^^ ...so that the type `T` will meet its required lifetime bounds error[E0309]: the parameter type `T` may not live long enough - --> $DIR/regions-close-param-into-object.rs:18:5 + --> $DIR/regions-close-param-into-object.rs:22:5 | LL | fn p3<'a,T>(v: T) -> Box | - help: consider adding an explicit lifetime bound...: `T: 'a` @@ -26,7 +26,7 @@ LL | Box::new(v) | ^^^^^^^^^^^ ...so that the type `T` will meet its required lifetime bounds error[E0309]: the parameter type `T` may not live long enough - --> $DIR/regions-close-param-into-object.rs:24:5 + --> $DIR/regions-close-param-into-object.rs:28:5 | LL | fn p4<'a,T>(v: Box) -> Box | - help: consider adding an explicit lifetime bound...: `T: 'a` diff --git a/src/test/ui/regions/regions-close-param-into-object.rs b/src/test/ui/regions/regions-close-param-into-object.rs index 2760e5eed9595..aab3ad202e6c0 100644 --- a/src/test/ui/regions/regions-close-param-into-object.rs +++ b/src/test/ui/regions/regions-close-param-into-object.rs @@ -1,3 +1,7 @@ +// revisions: base nll +// ignore-compare-mode-nll +//[nll] compile-flags: -Z borrowck=mir + trait X { fn foo(&self) {} } fn p1(v: T) -> Box diff --git a/src/test/ui/regions/regions-creating-enums3.stderr b/src/test/ui/regions/regions-creating-enums3.base.stderr similarity index 92% rename from src/test/ui/regions/regions-creating-enums3.stderr rename to src/test/ui/regions/regions-creating-enums3.base.stderr index 2fc1fc3f68128..68a7b473695cf 100644 --- a/src/test/ui/regions/regions-creating-enums3.stderr +++ b/src/test/ui/regions/regions-creating-enums3.base.stderr @@ -1,5 +1,5 @@ error[E0623]: lifetime mismatch - --> $DIR/regions-creating-enums3.rs:7:5 + --> $DIR/regions-creating-enums3.rs:11:5 | LL | fn mk_add_bad1<'a,'b>(x: &'a Ast<'a>, y: &'b Ast<'b>) -> Ast<'a> { | ----------- ------- diff --git a/src/test/ui/regions/regions-creating-enums3.nll.stderr b/src/test/ui/regions/regions-creating-enums3.nll.stderr index 41d609b56d233..8334dc7768701 100644 --- a/src/test/ui/regions/regions-creating-enums3.nll.stderr +++ b/src/test/ui/regions/regions-creating-enums3.nll.stderr @@ -1,5 +1,5 @@ error: lifetime may not live long enough - --> $DIR/regions-creating-enums3.rs:7:5 + --> $DIR/regions-creating-enums3.rs:11:5 | LL | fn mk_add_bad1<'a,'b>(x: &'a Ast<'a>, y: &'b Ast<'b>) -> Ast<'a> { | -- -- lifetime `'b` defined here diff --git a/src/test/ui/regions/regions-creating-enums3.rs b/src/test/ui/regions/regions-creating-enums3.rs index 3da0cb4cb8197..dcea761d33fd6 100644 --- a/src/test/ui/regions/regions-creating-enums3.rs +++ b/src/test/ui/regions/regions-creating-enums3.rs @@ -1,10 +1,16 @@ +// revisions: base nll +// ignore-compare-mode-nll +//[nll] compile-flags: -Z borrowck=mir + enum Ast<'a> { Num(usize), Add(&'a Ast<'a>, &'a Ast<'a>) } fn mk_add_bad1<'a,'b>(x: &'a Ast<'a>, y: &'b Ast<'b>) -> Ast<'a> { - Ast::Add(x, y) //~ ERROR lifetime mismatch [E0623] + Ast::Add(x, y) + //[base]~^ ERROR lifetime mismatch [E0623] + //[nll]~^^ ERROR lifetime may not live long enough } fn main() { diff --git a/src/test/ui/regions/regions-creating-enums4.stderr b/src/test/ui/regions/regions-creating-enums4.base.stderr similarity index 81% rename from src/test/ui/regions/regions-creating-enums4.stderr rename to src/test/ui/regions/regions-creating-enums4.base.stderr index 8b1b90f5b1a84..445a4291f27bb 100644 --- a/src/test/ui/regions/regions-creating-enums4.stderr +++ b/src/test/ui/regions/regions-creating-enums4.base.stderr @@ -1,28 +1,28 @@ error[E0495]: cannot infer an appropriate lifetime for lifetime parameter `'a` due to conflicting requirements - --> $DIR/regions-creating-enums4.rs:7:5 + --> $DIR/regions-creating-enums4.rs:11:5 | LL | Ast::Add(x, y) | ^^^^^^^^ | note: first, the lifetime cannot outlive the lifetime `'a` as defined here... - --> $DIR/regions-creating-enums4.rs:6:16 + --> $DIR/regions-creating-enums4.rs:10:16 | LL | fn mk_add_bad2<'a,'b>(x: &'a Ast<'a>, y: &'a Ast<'a>, z: &Ast) -> Ast<'b> { | ^^ note: ...so that the expression is assignable - --> $DIR/regions-creating-enums4.rs:7:14 + --> $DIR/regions-creating-enums4.rs:11:14 | LL | Ast::Add(x, y) | ^ = note: expected `&Ast<'_>` found `&Ast<'a>` note: but, the lifetime must be valid for the lifetime `'b` as defined here... - --> $DIR/regions-creating-enums4.rs:6:19 + --> $DIR/regions-creating-enums4.rs:10:19 | LL | fn mk_add_bad2<'a,'b>(x: &'a Ast<'a>, y: &'a Ast<'a>, z: &Ast) -> Ast<'b> { | ^^ note: ...so that the types are compatible - --> $DIR/regions-creating-enums4.rs:7:5 + --> $DIR/regions-creating-enums4.rs:11:5 | LL | Ast::Add(x, y) | ^^^^^^^^^^^^^^ diff --git a/src/test/ui/regions/regions-creating-enums4.nll.stderr b/src/test/ui/regions/regions-creating-enums4.nll.stderr index 91cf57e099df9..e215c63d39d5a 100644 --- a/src/test/ui/regions/regions-creating-enums4.nll.stderr +++ b/src/test/ui/regions/regions-creating-enums4.nll.stderr @@ -1,5 +1,5 @@ error: lifetime may not live long enough - --> $DIR/regions-creating-enums4.rs:7:5 + --> $DIR/regions-creating-enums4.rs:11:5 | LL | fn mk_add_bad2<'a,'b>(x: &'a Ast<'a>, y: &'a Ast<'a>, z: &Ast) -> Ast<'b> { | -- -- lifetime `'b` defined here diff --git a/src/test/ui/regions/regions-creating-enums4.rs b/src/test/ui/regions/regions-creating-enums4.rs index 11d3d83115121..18bd592b1c3eb 100644 --- a/src/test/ui/regions/regions-creating-enums4.rs +++ b/src/test/ui/regions/regions-creating-enums4.rs @@ -1,10 +1,16 @@ +// revisions: base nll +// ignore-compare-mode-nll +//[nll] compile-flags: -Z borrowck=mir + enum Ast<'a> { Num(usize), Add(&'a Ast<'a>, &'a Ast<'a>) } fn mk_add_bad2<'a,'b>(x: &'a Ast<'a>, y: &'a Ast<'a>, z: &Ast) -> Ast<'b> { - Ast::Add(x, y) //~ ERROR cannot infer + Ast::Add(x, y) + //[base]~^ ERROR cannot infer + //[nll]~^^ ERROR lifetime may not live long enough } fn main() { diff --git a/src/test/ui/regions/regions-early-bound-error-method.stderr b/src/test/ui/regions/regions-early-bound-error-method.base.stderr similarity index 76% rename from src/test/ui/regions/regions-early-bound-error-method.stderr rename to src/test/ui/regions/regions-early-bound-error-method.base.stderr index 99a5f0ce4cd80..9e1f2b0e5bd1a 100644 --- a/src/test/ui/regions/regions-early-bound-error-method.stderr +++ b/src/test/ui/regions/regions-early-bound-error-method.base.stderr @@ -1,16 +1,16 @@ error[E0312]: lifetime of reference outlives lifetime of borrowed content... - --> $DIR/regions-early-bound-error-method.rs:20:9 + --> $DIR/regions-early-bound-error-method.rs:24:9 | LL | g2.get() | ^^^^^^^^ | note: ...the reference is valid for the lifetime `'a` as defined here... - --> $DIR/regions-early-bound-error-method.rs:18:6 + --> $DIR/regions-early-bound-error-method.rs:22:6 | LL | impl<'a> Box<'a> { | ^^ note: ...but the borrowed content is only valid for the lifetime `'b` as defined here - --> $DIR/regions-early-bound-error-method.rs:19:11 + --> $DIR/regions-early-bound-error-method.rs:23:11 | LL | fn or<'b,G:GetRef<'b>>(&self, g2: G) -> &'a isize { | ^^ diff --git a/src/test/ui/regions/regions-early-bound-error-method.nll.stderr b/src/test/ui/regions/regions-early-bound-error-method.nll.stderr index 7f10c051f2998..98389ed0ca5b6 100644 --- a/src/test/ui/regions/regions-early-bound-error-method.nll.stderr +++ b/src/test/ui/regions/regions-early-bound-error-method.nll.stderr @@ -1,5 +1,5 @@ error: lifetime may not live long enough - --> $DIR/regions-early-bound-error-method.rs:20:9 + --> $DIR/regions-early-bound-error-method.rs:24:9 | LL | impl<'a> Box<'a> { | -- lifetime `'a` defined here diff --git a/src/test/ui/regions/regions-early-bound-error-method.rs b/src/test/ui/regions/regions-early-bound-error-method.rs index 32428143ef9d9..44ee19fa898b8 100644 --- a/src/test/ui/regions/regions-early-bound-error-method.rs +++ b/src/test/ui/regions/regions-early-bound-error-method.rs @@ -1,6 +1,10 @@ // Tests that you can use a fn lifetime parameter as part of // the value for a type parameter in a bound. +// revisions: base nll +// ignore-compare-mode-nll +//[nll] compile-flags: -Z borrowck=mir + trait GetRef<'a> { fn get(&self) -> &'a isize; } @@ -18,7 +22,8 @@ impl<'a> GetRef<'a> for Box<'a> { impl<'a> Box<'a> { fn or<'b,G:GetRef<'b>>(&self, g2: G) -> &'a isize { g2.get() - //~^ ERROR E0312 + //[base]~^ ERROR E0312 + //[nll]~^^ ERROR lifetime may not live long enough } } diff --git a/src/test/ui/regions/regions-early-bound-error.stderr b/src/test/ui/regions/regions-early-bound-error.base.stderr similarity index 81% rename from src/test/ui/regions/regions-early-bound-error.stderr rename to src/test/ui/regions/regions-early-bound-error.base.stderr index df9e979eacf0f..e1b60536d296f 100644 --- a/src/test/ui/regions/regions-early-bound-error.stderr +++ b/src/test/ui/regions/regions-early-bound-error.base.stderr @@ -1,16 +1,16 @@ error[E0312]: lifetime of reference outlives lifetime of borrowed content... - --> $DIR/regions-early-bound-error.rs:19:5 + --> $DIR/regions-early-bound-error.rs:23:5 | LL | g1.get() | ^^^^^^^^ | note: ...the reference is valid for the lifetime `'b` as defined here... - --> $DIR/regions-early-bound-error.rs:18:11 + --> $DIR/regions-early-bound-error.rs:22:11 | LL | fn get<'a,'b,G:GetRef<'a, isize>>(g1: G, b: &'b isize) -> &'b isize { | ^^ note: ...but the borrowed content is only valid for the lifetime `'a` as defined here - --> $DIR/regions-early-bound-error.rs:18:8 + --> $DIR/regions-early-bound-error.rs:22:8 | LL | fn get<'a,'b,G:GetRef<'a, isize>>(g1: G, b: &'b isize) -> &'b isize { | ^^ diff --git a/src/test/ui/regions/regions-early-bound-error.nll.stderr b/src/test/ui/regions/regions-early-bound-error.nll.stderr index eb4cd5ca72ea1..f57249e4e8f77 100644 --- a/src/test/ui/regions/regions-early-bound-error.nll.stderr +++ b/src/test/ui/regions/regions-early-bound-error.nll.stderr @@ -1,5 +1,5 @@ error: lifetime may not live long enough - --> $DIR/regions-early-bound-error.rs:19:5 + --> $DIR/regions-early-bound-error.rs:23:5 | LL | fn get<'a,'b,G:GetRef<'a, isize>>(g1: G, b: &'b isize) -> &'b isize { | -- -- lifetime `'b` defined here diff --git a/src/test/ui/regions/regions-early-bound-error.rs b/src/test/ui/regions/regions-early-bound-error.rs index 78dad4f2649d1..372596cd5f4b1 100644 --- a/src/test/ui/regions/regions-early-bound-error.rs +++ b/src/test/ui/regions/regions-early-bound-error.rs @@ -1,6 +1,10 @@ // Tests that you can use a fn lifetime parameter as part of // the value for a type parameter in a bound. +// revisions: base nll +// ignore-compare-mode-nll +//[nll] compile-flags: -Z borrowck=mir + trait GetRef<'a, T> { fn get(&self) -> &'a T; } @@ -17,7 +21,8 @@ impl<'a,T:Clone> GetRef<'a,T> for Box<'a,T> { fn get<'a,'b,G:GetRef<'a, isize>>(g1: G, b: &'b isize) -> &'b isize { g1.get() - //~^ ERROR E0312 + //[base]~^ ERROR E0312 + //[nll]~^^ ERROR lifetime may not live long enough } fn main() { diff --git a/src/test/ui/regions/regions-fn-subtyping-return-static-fail.stderr b/src/test/ui/regions/regions-fn-subtyping-return-static-fail.base.stderr similarity index 85% rename from src/test/ui/regions/regions-fn-subtyping-return-static-fail.stderr rename to src/test/ui/regions/regions-fn-subtyping-return-static-fail.base.stderr index c9ce936c7d43f..2182d8f661ff8 100644 --- a/src/test/ui/regions/regions-fn-subtyping-return-static-fail.stderr +++ b/src/test/ui/regions/regions-fn-subtyping-return-static-fail.base.stderr @@ -1,5 +1,5 @@ error[E0308]: mismatched types - --> $DIR/regions-fn-subtyping-return-static-fail.rs:48:12 + --> $DIR/regions-fn-subtyping-return-static-fail.rs:52:12 | LL | want_G(baz); | ^^^ one type is more general than the other diff --git a/src/test/ui/regions/regions-fn-subtyping-return-static-fail.nll.stderr b/src/test/ui/regions/regions-fn-subtyping-return-static-fail.nll.stderr index c2956cd89580f..0bca2cfbefd9f 100644 --- a/src/test/ui/regions/regions-fn-subtyping-return-static-fail.nll.stderr +++ b/src/test/ui/regions/regions-fn-subtyping-return-static-fail.nll.stderr @@ -1,5 +1,5 @@ error[E0308]: mismatched types - --> $DIR/regions-fn-subtyping-return-static-fail.rs:48:5 + --> $DIR/regions-fn-subtyping-return-static-fail.rs:52:5 | LL | want_G(baz); | ^^^^^^^^^^^ one type is more general than the other diff --git a/src/test/ui/regions/regions-fn-subtyping-return-static-fail.rs b/src/test/ui/regions/regions-fn-subtyping-return-static-fail.rs index 539221b5a046c..05c6ac0cb1ae4 100644 --- a/src/test/ui/regions/regions-fn-subtyping-return-static-fail.rs +++ b/src/test/ui/regions/regions-fn-subtyping-return-static-fail.rs @@ -6,6 +6,10 @@ // This can safely be considered to be an instance of `F` because all // lifetimes are sublifetimes of 'static. +// revisions: base nll +// ignore-compare-mode-nll +//[nll] compile-flags: -Z borrowck=mir + #![allow(dead_code)] #![allow(unused_variables)] diff --git a/src/test/ui/regions/regions-free-region-ordering-callee.stderr b/src/test/ui/regions/regions-free-region-ordering-callee.base.stderr similarity index 90% rename from src/test/ui/regions/regions-free-region-ordering-callee.stderr rename to src/test/ui/regions/regions-free-region-ordering-callee.base.stderr index 4648bf046bc77..ae6d95dd4691d 100644 --- a/src/test/ui/regions/regions-free-region-ordering-callee.stderr +++ b/src/test/ui/regions/regions-free-region-ordering-callee.base.stderr @@ -1,5 +1,5 @@ error[E0623]: lifetime mismatch - --> $DIR/regions-free-region-ordering-callee.rs:13:5 + --> $DIR/regions-free-region-ordering-callee.rs:17:5 | LL | fn ordering2<'a, 'b>(x: &'a &'b usize, y: &'a usize) -> &'b usize { | ------------- --------- @@ -10,7 +10,7 @@ LL | &*y | ^^^ ...but data from `x` is returned here error[E0623]: lifetime mismatch - --> $DIR/regions-free-region-ordering-callee.rs:18:24 + --> $DIR/regions-free-region-ordering-callee.rs:24:24 | LL | fn ordering3<'a, 'b>(x: &'a usize, y: &'b usize) -> &'a &'b usize { | --------- ------------- diff --git a/src/test/ui/regions/regions-free-region-ordering-callee.nll.stderr b/src/test/ui/regions/regions-free-region-ordering-callee.nll.stderr index f61f068a4861b..7dfff2bb060d3 100644 --- a/src/test/ui/regions/regions-free-region-ordering-callee.nll.stderr +++ b/src/test/ui/regions/regions-free-region-ordering-callee.nll.stderr @@ -1,5 +1,5 @@ error: lifetime may not live long enough - --> $DIR/regions-free-region-ordering-callee.rs:13:5 + --> $DIR/regions-free-region-ordering-callee.rs:17:5 | LL | fn ordering2<'a, 'b>(x: &'a &'b usize, y: &'a usize) -> &'b usize { | -- -- lifetime `'b` defined here @@ -12,7 +12,7 @@ LL | &*y = help: consider adding the following bound: `'a: 'b` error: lifetime may not live long enough - --> $DIR/regions-free-region-ordering-callee.rs:18:12 + --> $DIR/regions-free-region-ordering-callee.rs:24:12 | LL | fn ordering3<'a, 'b>(x: &'a usize, y: &'b usize) -> &'a &'b usize { | -- -- lifetime `'b` defined here diff --git a/src/test/ui/regions/regions-free-region-ordering-callee.rs b/src/test/ui/regions/regions-free-region-ordering-callee.rs index ee9a977a74f2d..eca863f2e7958 100644 --- a/src/test/ui/regions/regions-free-region-ordering-callee.rs +++ b/src/test/ui/regions/regions-free-region-ordering-callee.rs @@ -2,6 +2,10 @@ // that appear in their parameter list. See also // regions-free-region-ordering-caller.rs +// revisions: base nll +// ignore-compare-mode-nll +//[nll] compile-flags: -Z borrowck=mir + fn ordering1<'a, 'b>(x: &'a &'b usize) -> &'a usize { // It is safe to assume that 'a <= 'b due to the type of x let y: &'b usize = &**x; @@ -10,13 +14,16 @@ fn ordering1<'a, 'b>(x: &'a &'b usize) -> &'a usize { fn ordering2<'a, 'b>(x: &'a &'b usize, y: &'a usize) -> &'b usize { // However, it is not safe to assume that 'b <= 'a - &*y //~ ERROR lifetime mismatch [E0623] + &*y + //[base]~^ ERROR lifetime mismatch [E0623] + //[nll]~^^ ERROR lifetime may not live long enough } fn ordering3<'a, 'b>(x: &'a usize, y: &'b usize) -> &'a &'b usize { // Do not infer an ordering from the return value. let z: &'b usize = &*x; - //~^ ERROR lifetime mismatch [E0623] + //[base]~^ ERROR lifetime mismatch [E0623] + //[nll]~^^ ERROR lifetime may not live long enough panic!(); } diff --git a/src/test/ui/regions/regions-free-region-ordering-incorrect.stderr b/src/test/ui/regions/regions-free-region-ordering-incorrect.base.stderr similarity index 75% rename from src/test/ui/regions/regions-free-region-ordering-incorrect.stderr rename to src/test/ui/regions/regions-free-region-ordering-incorrect.base.stderr index b0a8f4af3973d..eb4ffce89a325 100644 --- a/src/test/ui/regions/regions-free-region-ordering-incorrect.stderr +++ b/src/test/ui/regions/regions-free-region-ordering-incorrect.base.stderr @@ -1,26 +1,26 @@ error[E0495]: cannot infer an appropriate lifetime for borrow expression due to conflicting requirements - --> $DIR/regions-free-region-ordering-incorrect.rs:17:21 + --> $DIR/regions-free-region-ordering-incorrect.rs:21:21 | LL | None => &self.val | ^^^^^^^^^ | note: first, the lifetime cannot outlive the lifetime `'a` as defined here... - --> $DIR/regions-free-region-ordering-incorrect.rs:14:12 + --> $DIR/regions-free-region-ordering-incorrect.rs:18:12 | LL | fn get<'a>(&'a self) -> &'b T { | ^^ note: ...so that reference does not outlive borrowed content - --> $DIR/regions-free-region-ordering-incorrect.rs:17:21 + --> $DIR/regions-free-region-ordering-incorrect.rs:21:21 | LL | None => &self.val | ^^^^^^^^^ note: but, the lifetime must be valid for the lifetime `'b` as defined here... - --> $DIR/regions-free-region-ordering-incorrect.rs:13:6 + --> $DIR/regions-free-region-ordering-incorrect.rs:17:6 | LL | impl<'b, T> Node<'b, T> { | ^^ note: ...so that reference does not outlive borrowed content - --> $DIR/regions-free-region-ordering-incorrect.rs:15:9 + --> $DIR/regions-free-region-ordering-incorrect.rs:19:9 | LL | / match self.next { LL | | Some(ref next) => next.get(), diff --git a/src/test/ui/regions/regions-free-region-ordering-incorrect.nll.stderr b/src/test/ui/regions/regions-free-region-ordering-incorrect.nll.stderr index f7c75033c0486..336cfd3e6c529 100644 --- a/src/test/ui/regions/regions-free-region-ordering-incorrect.nll.stderr +++ b/src/test/ui/regions/regions-free-region-ordering-incorrect.nll.stderr @@ -1,5 +1,5 @@ error: lifetime may not live long enough - --> $DIR/regions-free-region-ordering-incorrect.rs:15:9 + --> $DIR/regions-free-region-ordering-incorrect.rs:19:9 | LL | impl<'b, T> Node<'b, T> { | -- lifetime `'b` defined here diff --git a/src/test/ui/regions/regions-free-region-ordering-incorrect.rs b/src/test/ui/regions/regions-free-region-ordering-incorrect.rs index 65e3f52609eeb..43427d13ffa71 100644 --- a/src/test/ui/regions/regions-free-region-ordering-incorrect.rs +++ b/src/test/ui/regions/regions-free-region-ordering-incorrect.rs @@ -5,6 +5,10 @@ // // This test began its life as a test for issue #4325. +// revisions: base nll +// ignore-compare-mode-nll +//[nll] compile-flags: -Z borrowck=mir + struct Node<'b, T: 'b> { val: T, next: Option<&'b Node<'b, T>> @@ -12,9 +16,9 @@ struct Node<'b, T: 'b> { impl<'b, T> Node<'b, T> { fn get<'a>(&'a self) -> &'b T { - match self.next { + match self.next { //[nll]~ ERROR lifetime may not live long enough Some(ref next) => next.get(), - None => &self.val //~ ERROR cannot infer + None => &self.val //[base]~ ERROR cannot infer } } } diff --git a/src/test/ui/regions/regions-implied-bounds-projection-gap-1.stderr b/src/test/ui/regions/regions-implied-bounds-projection-gap-1.base.stderr similarity index 87% rename from src/test/ui/regions/regions-implied-bounds-projection-gap-1.stderr rename to src/test/ui/regions/regions-implied-bounds-projection-gap-1.base.stderr index ea59ea11a143c..ef68674a18f5e 100644 --- a/src/test/ui/regions/regions-implied-bounds-projection-gap-1.stderr +++ b/src/test/ui/regions/regions-implied-bounds-projection-gap-1.base.stderr @@ -1,5 +1,5 @@ error[E0309]: the parameter type `T` may not live long enough - --> $DIR/regions-implied-bounds-projection-gap-1.rs:16:10 + --> $DIR/regions-implied-bounds-projection-gap-1.rs:20:10 | LL | fn func<'x, T:Trait1<'x>>(t: &'x T::Foo) | -- help: consider adding an explicit lifetime bound...: `T: 'x +` diff --git a/src/test/ui/regions/regions-implied-bounds-projection-gap-1.nll.stderr b/src/test/ui/regions/regions-implied-bounds-projection-gap-1.nll.stderr index 0e1db8acf1fae..6d63de6d6bd95 100644 --- a/src/test/ui/regions/regions-implied-bounds-projection-gap-1.nll.stderr +++ b/src/test/ui/regions/regions-implied-bounds-projection-gap-1.nll.stderr @@ -1,5 +1,5 @@ error[E0309]: the parameter type `T` may not live long enough - --> $DIR/regions-implied-bounds-projection-gap-1.rs:16:5 + --> $DIR/regions-implied-bounds-projection-gap-1.rs:20:5 | LL | fn func<'x, T:Trait1<'x>>(t: &'x T::Foo) | -- help: consider adding an explicit lifetime bound...: `T: 'x +` diff --git a/src/test/ui/regions/regions-implied-bounds-projection-gap-1.rs b/src/test/ui/regions/regions-implied-bounds-projection-gap-1.rs index 38fc9c462da4e..f11fc207b91c6 100644 --- a/src/test/ui/regions/regions-implied-bounds-projection-gap-1.rs +++ b/src/test/ui/regions/regions-implied-bounds-projection-gap-1.rs @@ -3,6 +3,10 @@ // there might be other ways for the caller of `func` to show that // `T::Foo: 'x` holds (e.g., where-clause). +// revisions: base nll +// ignore-compare-mode-nll +//[nll] compile-flags: -Z borrowck=mir + trait Trait1<'x> { type Foo; } diff --git a/src/test/ui/regions/regions-infer-bound-from-trait-self.stderr b/src/test/ui/regions/regions-infer-bound-from-trait-self.base.stderr similarity index 82% rename from src/test/ui/regions/regions-infer-bound-from-trait-self.stderr rename to src/test/ui/regions/regions-infer-bound-from-trait-self.base.stderr index 97a3947bc0a2a..faa638aa28119 100644 --- a/src/test/ui/regions/regions-infer-bound-from-trait-self.stderr +++ b/src/test/ui/regions/regions-infer-bound-from-trait-self.base.stderr @@ -1,5 +1,5 @@ error[E0309]: the parameter type `Self` may not live long enough - --> $DIR/regions-infer-bound-from-trait-self.rs:46:9 + --> $DIR/regions-infer-bound-from-trait-self.rs:50:9 | LL | check_bound(x, self) | ^^^^^^^^^^^ @@ -7,7 +7,7 @@ LL | check_bound(x, self) = help: consider adding an explicit lifetime bound `Self: 'a`... = note: ...so that the type `Self` will meet its required lifetime bounds... note: ...that is required by this bound - --> $DIR/regions-infer-bound-from-trait-self.rs:12:21 + --> $DIR/regions-infer-bound-from-trait-self.rs:16:21 | LL | fn check_bound<'a,A:'a>(x: Inv<'a>, a: A) { } | ^^ diff --git a/src/test/ui/regions/regions-infer-bound-from-trait-self.nll.stderr b/src/test/ui/regions/regions-infer-bound-from-trait-self.nll.stderr index e88f79a3a8c54..9c886c42c72ac 100644 --- a/src/test/ui/regions/regions-infer-bound-from-trait-self.nll.stderr +++ b/src/test/ui/regions/regions-infer-bound-from-trait-self.nll.stderr @@ -1,5 +1,5 @@ error[E0309]: the parameter type `Self` may not live long enough - --> $DIR/regions-infer-bound-from-trait-self.rs:46:9 + --> $DIR/regions-infer-bound-from-trait-self.rs:50:9 | LL | check_bound(x, self) | ^^^^^^^^^^^^^^^^^^^^ diff --git a/src/test/ui/regions/regions-infer-bound-from-trait-self.rs b/src/test/ui/regions/regions-infer-bound-from-trait-self.rs index d15bfffe9d926..ef8be05b2d26a 100644 --- a/src/test/ui/regions/regions-infer-bound-from-trait-self.rs +++ b/src/test/ui/regions/regions-infer-bound-from-trait-self.rs @@ -1,6 +1,10 @@ // Test that we can derive lifetime bounds on `Self` from trait // inheritance. +// revisions: base nll +// ignore-compare-mode-nll +//[nll] compile-flags: -Z borrowck=mir + trait Static : 'static { } trait Is<'a> : 'a { } diff --git a/src/test/ui/regions/regions-infer-bound-from-trait.stderr b/src/test/ui/regions/regions-infer-bound-from-trait.base.stderr similarity index 87% rename from src/test/ui/regions/regions-infer-bound-from-trait.stderr rename to src/test/ui/regions/regions-infer-bound-from-trait.base.stderr index fd1090d2dbd17..6a7e8ba134753 100644 --- a/src/test/ui/regions/regions-infer-bound-from-trait.stderr +++ b/src/test/ui/regions/regions-infer-bound-from-trait.base.stderr @@ -1,5 +1,5 @@ error[E0309]: the parameter type `A` may not live long enough - --> $DIR/regions-infer-bound-from-trait.rs:33:5 + --> $DIR/regions-infer-bound-from-trait.rs:37:5 | LL | fn bar1<'a,A>(x: Inv<'a>, a: A) { | - help: consider adding an explicit lifetime bound...: `A: 'a` @@ -7,13 +7,13 @@ LL | check_bound(x, a) | ^^^^^^^^^^^ ...so that the type `A` will meet its required lifetime bounds... | note: ...that is required by this bound - --> $DIR/regions-infer-bound-from-trait.rs:12:21 + --> $DIR/regions-infer-bound-from-trait.rs:16:21 | LL | fn check_bound<'a,A:'a>(x: Inv<'a>, a: A) { } | ^^ error[E0309]: the parameter type `A` may not live long enough - --> $DIR/regions-infer-bound-from-trait.rs:37:5 + --> $DIR/regions-infer-bound-from-trait.rs:41:5 | LL | fn bar2<'a,'b,A:Is<'b>>(x: Inv<'a>, y: Inv<'b>, a: A) { | -- help: consider adding an explicit lifetime bound...: `A: 'a +` @@ -21,7 +21,7 @@ LL | check_bound(x, a) | ^^^^^^^^^^^ ...so that the type `A` will meet its required lifetime bounds... | note: ...that is required by this bound - --> $DIR/regions-infer-bound-from-trait.rs:12:21 + --> $DIR/regions-infer-bound-from-trait.rs:16:21 | LL | fn check_bound<'a,A:'a>(x: Inv<'a>, a: A) { } | ^^ diff --git a/src/test/ui/regions/regions-infer-bound-from-trait.nll.stderr b/src/test/ui/regions/regions-infer-bound-from-trait.nll.stderr index fe07749954404..4aa4b468eaa72 100644 --- a/src/test/ui/regions/regions-infer-bound-from-trait.nll.stderr +++ b/src/test/ui/regions/regions-infer-bound-from-trait.nll.stderr @@ -1,5 +1,5 @@ error[E0309]: the parameter type `A` may not live long enough - --> $DIR/regions-infer-bound-from-trait.rs:33:5 + --> $DIR/regions-infer-bound-from-trait.rs:37:5 | LL | fn bar1<'a,A>(x: Inv<'a>, a: A) { | - help: consider adding an explicit lifetime bound...: `A: 'a` @@ -7,7 +7,7 @@ LL | check_bound(x, a) | ^^^^^^^^^^^^^^^^^ ...so that the type `A` will meet its required lifetime bounds error[E0309]: the parameter type `A` may not live long enough - --> $DIR/regions-infer-bound-from-trait.rs:37:5 + --> $DIR/regions-infer-bound-from-trait.rs:41:5 | LL | fn bar2<'a,'b,A:Is<'b>>(x: Inv<'a>, y: Inv<'b>, a: A) { | -- help: consider adding an explicit lifetime bound...: `A: 'a +` diff --git a/src/test/ui/regions/regions-infer-bound-from-trait.rs b/src/test/ui/regions/regions-infer-bound-from-trait.rs index 610452182f885..96f9125313bf9 100644 --- a/src/test/ui/regions/regions-infer-bound-from-trait.rs +++ b/src/test/ui/regions/regions-infer-bound-from-trait.rs @@ -1,6 +1,10 @@ // Test that we can derive lifetime bounds on type parameters // from trait inheritance. +// revisions: base nll +// ignore-compare-mode-nll +//[nll] compile-flags: -Z borrowck=mir + trait Static : 'static { } trait Is<'a> : 'a { } diff --git a/src/test/ui/regions/regions-infer-contravariance-due-to-decl.stderr b/src/test/ui/regions/regions-infer-contravariance-due-to-decl.base.stderr similarity index 90% rename from src/test/ui/regions/regions-infer-contravariance-due-to-decl.stderr rename to src/test/ui/regions/regions-infer-contravariance-due-to-decl.base.stderr index f3a0358b90fb0..fbe2c0da6e262 100644 --- a/src/test/ui/regions/regions-infer-contravariance-due-to-decl.stderr +++ b/src/test/ui/regions/regions-infer-contravariance-due-to-decl.base.stderr @@ -1,5 +1,5 @@ error[E0623]: lifetime mismatch - --> $DIR/regions-infer-contravariance-due-to-decl.rs:25:35 + --> $DIR/regions-infer-contravariance-due-to-decl.rs:29:35 | LL | fn use_<'short,'long>(c: Contravariant<'short>, | --------------------- these two types are declared with different lifetimes... diff --git a/src/test/ui/regions/regions-infer-contravariance-due-to-decl.nll.stderr b/src/test/ui/regions/regions-infer-contravariance-due-to-decl.nll.stderr index 94b80852d0124..0b1bf5271a779 100644 --- a/src/test/ui/regions/regions-infer-contravariance-due-to-decl.nll.stderr +++ b/src/test/ui/regions/regions-infer-contravariance-due-to-decl.nll.stderr @@ -1,5 +1,5 @@ error: lifetime may not live long enough - --> $DIR/regions-infer-contravariance-due-to-decl.rs:25:12 + --> $DIR/regions-infer-contravariance-due-to-decl.rs:29:12 | LL | fn use_<'short,'long>(c: Contravariant<'short>, | ------ ----- lifetime `'long` defined here diff --git a/src/test/ui/regions/regions-infer-contravariance-due-to-decl.rs b/src/test/ui/regions/regions-infer-contravariance-due-to-decl.rs index 84161388a6e61..233f72fd29649 100644 --- a/src/test/ui/regions/regions-infer-contravariance-due-to-decl.rs +++ b/src/test/ui/regions/regions-infer-contravariance-due-to-decl.rs @@ -4,6 +4,10 @@ // Note: see variance-regions-*.rs for the tests that check that the // variance inference works in the first place. +// revisions: base nll +// ignore-compare-mode-nll +//[nll] compile-flags: -Z borrowck=mir + use std::marker; // This is contravariant with respect to 'a, meaning that @@ -22,7 +26,9 @@ fn use_<'short,'long>(c: Contravariant<'short>, // 'short <= 'long, this would be true if the Contravariant type were // covariant with respect to its parameter 'a. - let _: Contravariant<'long> = c; //~ ERROR E0623 + let _: Contravariant<'long> = c; + //[base]~^ ERROR E0623 + //[nll]~^^ ERROR lifetime may not live long enough } fn main() {} diff --git a/src/test/ui/regions/regions-infer-covariance-due-to-decl.stderr b/src/test/ui/regions/regions-infer-covariance-due-to-decl.base.stderr similarity index 89% rename from src/test/ui/regions/regions-infer-covariance-due-to-decl.stderr rename to src/test/ui/regions/regions-infer-covariance-due-to-decl.base.stderr index c3e2075fbc37e..bb22e15af6991 100644 --- a/src/test/ui/regions/regions-infer-covariance-due-to-decl.stderr +++ b/src/test/ui/regions/regions-infer-covariance-due-to-decl.base.stderr @@ -1,5 +1,5 @@ error[E0623]: lifetime mismatch - --> $DIR/regions-infer-covariance-due-to-decl.rs:22:32 + --> $DIR/regions-infer-covariance-due-to-decl.rs:26:32 | LL | fn use_<'short,'long>(c: Covariant<'long>, | ---------------- diff --git a/src/test/ui/regions/regions-infer-covariance-due-to-decl.nll.stderr b/src/test/ui/regions/regions-infer-covariance-due-to-decl.nll.stderr index f44a0fad59b2e..4d72b8471dcb2 100644 --- a/src/test/ui/regions/regions-infer-covariance-due-to-decl.nll.stderr +++ b/src/test/ui/regions/regions-infer-covariance-due-to-decl.nll.stderr @@ -1,5 +1,5 @@ error: lifetime may not live long enough - --> $DIR/regions-infer-covariance-due-to-decl.rs:22:12 + --> $DIR/regions-infer-covariance-due-to-decl.rs:26:12 | LL | fn use_<'short,'long>(c: Covariant<'long>, | ------ ----- lifetime `'long` defined here diff --git a/src/test/ui/regions/regions-infer-covariance-due-to-decl.rs b/src/test/ui/regions/regions-infer-covariance-due-to-decl.rs index b5079206578dc..c4225e76967ef 100644 --- a/src/test/ui/regions/regions-infer-covariance-due-to-decl.rs +++ b/src/test/ui/regions/regions-infer-covariance-due-to-decl.rs @@ -4,6 +4,10 @@ // Note: see variance-regions-*.rs for the tests that check that the // variance inference works in the first place. +// revisions: base nll +// ignore-compare-mode-nll +//[nll] compile-flags: -Z borrowck=mir + use std::marker; struct Covariant<'a> { @@ -19,7 +23,9 @@ fn use_<'short,'long>(c: Covariant<'long>, // 'short <= 'long, this would be true if the Covariant type were // contravariant with respect to its parameter 'a. - let _: Covariant<'short> = c; //~ ERROR E0623 + let _: Covariant<'short> = c; + //[base]~^ ERROR E0623 + //[nll]~^^ ERROR lifetime may not live long enough } fn main() {} diff --git a/src/test/ui/regions/regions-infer-invariance-due-to-decl.stderr b/src/test/ui/regions/regions-infer-invariance-due-to-decl.base.stderr similarity index 81% rename from src/test/ui/regions/regions-infer-invariance-due-to-decl.stderr rename to src/test/ui/regions/regions-infer-invariance-due-to-decl.base.stderr index afd522aa00316..dc7d0005ca268 100644 --- a/src/test/ui/regions/regions-infer-invariance-due-to-decl.stderr +++ b/src/test/ui/regions/regions-infer-invariance-due-to-decl.base.stderr @@ -1,5 +1,5 @@ error[E0308]: mismatched types - --> $DIR/regions-infer-invariance-due-to-decl.rs:12:5 + --> $DIR/regions-infer-invariance-due-to-decl.rs:16:5 | LL | b_isize | ^^^^^^^ lifetime mismatch @@ -7,7 +7,7 @@ LL | b_isize = note: expected struct `Invariant<'static>` found struct `Invariant<'r>` note: the lifetime `'r` as defined here... - --> $DIR/regions-infer-invariance-due-to-decl.rs:11:23 + --> $DIR/regions-infer-invariance-due-to-decl.rs:15:23 | LL | fn to_longer_lifetime<'r>(b_isize: Invariant<'r>) -> Invariant<'static> { | ^^ diff --git a/src/test/ui/regions/regions-infer-invariance-due-to-decl.nll.stderr b/src/test/ui/regions/regions-infer-invariance-due-to-decl.nll.stderr index c8c7808e06c5f..d7b7f9883a763 100644 --- a/src/test/ui/regions/regions-infer-invariance-due-to-decl.nll.stderr +++ b/src/test/ui/regions/regions-infer-invariance-due-to-decl.nll.stderr @@ -1,5 +1,5 @@ error: lifetime may not live long enough - --> $DIR/regions-infer-invariance-due-to-decl.rs:12:5 + --> $DIR/regions-infer-invariance-due-to-decl.rs:16:5 | LL | fn to_longer_lifetime<'r>(b_isize: Invariant<'r>) -> Invariant<'static> { | -- lifetime `'r` defined here diff --git a/src/test/ui/regions/regions-infer-invariance-due-to-decl.rs b/src/test/ui/regions/regions-infer-invariance-due-to-decl.rs index e0fa904e8fe37..6433773b2d186 100644 --- a/src/test/ui/regions/regions-infer-invariance-due-to-decl.rs +++ b/src/test/ui/regions/regions-infer-invariance-due-to-decl.rs @@ -1,3 +1,7 @@ +// revisions: base nll +// ignore-compare-mode-nll +//[nll] compile-flags: -Z borrowck=mir + use std::marker; struct Invariant<'a> { @@ -9,7 +13,9 @@ fn to_same_lifetime<'r>(b_isize: Invariant<'r>) { } fn to_longer_lifetime<'r>(b_isize: Invariant<'r>) -> Invariant<'static> { - b_isize //~ ERROR mismatched types + b_isize + //[base]~^ ERROR mismatched types + //[nll]~^^ ERROR lifetime may not live long enough } fn main() { diff --git a/src/test/ui/regions/regions-infer-invariance-due-to-mutability-4.stderr b/src/test/ui/regions/regions-infer-invariance-due-to-mutability-3.base.stderr similarity index 79% rename from src/test/ui/regions/regions-infer-invariance-due-to-mutability-4.stderr rename to src/test/ui/regions/regions-infer-invariance-due-to-mutability-3.base.stderr index 04d11b5b7c71c..b2530d7b6cd0b 100644 --- a/src/test/ui/regions/regions-infer-invariance-due-to-mutability-4.stderr +++ b/src/test/ui/regions/regions-infer-invariance-due-to-mutability-3.base.stderr @@ -1,5 +1,5 @@ error[E0308]: mismatched types - --> $DIR/regions-infer-invariance-due-to-mutability-4.rs:10:5 + --> $DIR/regions-infer-invariance-due-to-mutability-3.rs:14:5 | LL | b_isize | ^^^^^^^ lifetime mismatch @@ -7,7 +7,7 @@ LL | b_isize = note: expected struct `Invariant<'static>` found struct `Invariant<'r>` note: the lifetime `'r` as defined here... - --> $DIR/regions-infer-invariance-due-to-mutability-4.rs:9:23 + --> $DIR/regions-infer-invariance-due-to-mutability-3.rs:13:23 | LL | fn to_longer_lifetime<'r>(b_isize: Invariant<'r>) -> Invariant<'static> { | ^^ diff --git a/src/test/ui/regions/regions-infer-invariance-due-to-mutability-3.nll.stderr b/src/test/ui/regions/regions-infer-invariance-due-to-mutability-3.nll.stderr index 1165011c1f4fc..37fa5e3bf4477 100644 --- a/src/test/ui/regions/regions-infer-invariance-due-to-mutability-3.nll.stderr +++ b/src/test/ui/regions/regions-infer-invariance-due-to-mutability-3.nll.stderr @@ -1,5 +1,5 @@ error: lifetime may not live long enough - --> $DIR/regions-infer-invariance-due-to-mutability-3.rs:10:5 + --> $DIR/regions-infer-invariance-due-to-mutability-3.rs:14:5 | LL | fn to_longer_lifetime<'r>(b_isize: Invariant<'r>) -> Invariant<'static> { | -- lifetime `'r` defined here diff --git a/src/test/ui/regions/regions-infer-invariance-due-to-mutability-3.rs b/src/test/ui/regions/regions-infer-invariance-due-to-mutability-3.rs index 5843598ab48e4..4690f9d8b08fc 100644 --- a/src/test/ui/regions/regions-infer-invariance-due-to-mutability-3.rs +++ b/src/test/ui/regions/regions-infer-invariance-due-to-mutability-3.rs @@ -1,3 +1,7 @@ +// revisions: base nll +// ignore-compare-mode-nll +//[nll] compile-flags: -Z borrowck=mir + struct Invariant<'a> { f: Box, } @@ -7,7 +11,9 @@ fn to_same_lifetime<'r>(b_isize: Invariant<'r>) { } fn to_longer_lifetime<'r>(b_isize: Invariant<'r>) -> Invariant<'static> { - b_isize //~ ERROR mismatched types + b_isize + //[base]~^ ERROR mismatched types + //[nll]~^^ ERROR lifetime may not live long enough } fn main() { diff --git a/src/test/ui/regions/regions-infer-invariance-due-to-mutability-3.stderr b/src/test/ui/regions/regions-infer-invariance-due-to-mutability-4.base.stderr similarity index 79% rename from src/test/ui/regions/regions-infer-invariance-due-to-mutability-3.stderr rename to src/test/ui/regions/regions-infer-invariance-due-to-mutability-4.base.stderr index bb594f3676e37..12774ca92e232 100644 --- a/src/test/ui/regions/regions-infer-invariance-due-to-mutability-3.stderr +++ b/src/test/ui/regions/regions-infer-invariance-due-to-mutability-4.base.stderr @@ -1,5 +1,5 @@ error[E0308]: mismatched types - --> $DIR/regions-infer-invariance-due-to-mutability-3.rs:10:5 + --> $DIR/regions-infer-invariance-due-to-mutability-4.rs:14:5 | LL | b_isize | ^^^^^^^ lifetime mismatch @@ -7,7 +7,7 @@ LL | b_isize = note: expected struct `Invariant<'static>` found struct `Invariant<'r>` note: the lifetime `'r` as defined here... - --> $DIR/regions-infer-invariance-due-to-mutability-3.rs:9:23 + --> $DIR/regions-infer-invariance-due-to-mutability-4.rs:13:23 | LL | fn to_longer_lifetime<'r>(b_isize: Invariant<'r>) -> Invariant<'static> { | ^^ diff --git a/src/test/ui/regions/regions-infer-invariance-due-to-mutability-4.nll.stderr b/src/test/ui/regions/regions-infer-invariance-due-to-mutability-4.nll.stderr index f3973a93bad84..1b3ef7bc02894 100644 --- a/src/test/ui/regions/regions-infer-invariance-due-to-mutability-4.nll.stderr +++ b/src/test/ui/regions/regions-infer-invariance-due-to-mutability-4.nll.stderr @@ -1,5 +1,5 @@ error: lifetime may not live long enough - --> $DIR/regions-infer-invariance-due-to-mutability-4.rs:10:5 + --> $DIR/regions-infer-invariance-due-to-mutability-4.rs:14:5 | LL | fn to_longer_lifetime<'r>(b_isize: Invariant<'r>) -> Invariant<'static> { | -- lifetime `'r` defined here diff --git a/src/test/ui/regions/regions-infer-invariance-due-to-mutability-4.rs b/src/test/ui/regions/regions-infer-invariance-due-to-mutability-4.rs index f0af18cf61804..8e257c4fd0ebe 100644 --- a/src/test/ui/regions/regions-infer-invariance-due-to-mutability-4.rs +++ b/src/test/ui/regions/regions-infer-invariance-due-to-mutability-4.rs @@ -1,3 +1,7 @@ +// revisions: base nll +// ignore-compare-mode-nll +//[nll] compile-flags: -Z borrowck=mir + struct Invariant<'a> { f: Box *mut &'a isize + 'static>, } @@ -7,7 +11,9 @@ fn to_same_lifetime<'r>(b_isize: Invariant<'r>) { } fn to_longer_lifetime<'r>(b_isize: Invariant<'r>) -> Invariant<'static> { - b_isize //~ ERROR mismatched types + b_isize + //[base]~^ ERROR mismatched types + //[nll]~^^ ERROR lifetime may not live long enough } fn main() { diff --git a/src/test/ui/regions/regions-infer-not-param.stderr b/src/test/ui/regions/regions-infer-not-param.base.stderr similarity index 84% rename from src/test/ui/regions/regions-infer-not-param.stderr rename to src/test/ui/regions/regions-infer-not-param.base.stderr index a23bdeb834fad..f43274163d046 100644 --- a/src/test/ui/regions/regions-infer-not-param.stderr +++ b/src/test/ui/regions/regions-infer-not-param.base.stderr @@ -1,5 +1,5 @@ error[E0308]: mismatched types - --> $DIR/regions-infer-not-param.rs:15:54 + --> $DIR/regions-infer-not-param.rs:19:54 | LL | fn take_direct<'a,'b>(p: Direct<'a>) -> Direct<'b> { p } | ^ lifetime mismatch @@ -7,18 +7,18 @@ LL | fn take_direct<'a,'b>(p: Direct<'a>) -> Direct<'b> { p } = note: expected struct `Direct<'b>` found struct `Direct<'a>` note: the lifetime `'a` as defined here... - --> $DIR/regions-infer-not-param.rs:15:16 + --> $DIR/regions-infer-not-param.rs:19:16 | LL | fn take_direct<'a,'b>(p: Direct<'a>) -> Direct<'b> { p } | ^^ note: ...does not necessarily outlive the lifetime `'b` as defined here - --> $DIR/regions-infer-not-param.rs:15:19 + --> $DIR/regions-infer-not-param.rs:19:19 | LL | fn take_direct<'a,'b>(p: Direct<'a>) -> Direct<'b> { p } | ^^ error[E0308]: mismatched types - --> $DIR/regions-infer-not-param.rs:19:63 + --> $DIR/regions-infer-not-param.rs:25:63 | LL | fn take_indirect2<'a,'b>(p: Indirect2<'a>) -> Indirect2<'b> { p } | ^ lifetime mismatch @@ -26,18 +26,18 @@ LL | fn take_indirect2<'a,'b>(p: Indirect2<'a>) -> Indirect2<'b> { p } = note: expected struct `Indirect2<'b>` found struct `Indirect2<'a>` note: the lifetime `'a` as defined here... - --> $DIR/regions-infer-not-param.rs:19:19 + --> $DIR/regions-infer-not-param.rs:25:19 | LL | fn take_indirect2<'a,'b>(p: Indirect2<'a>) -> Indirect2<'b> { p } | ^^ note: ...does not necessarily outlive the lifetime `'b` as defined here - --> $DIR/regions-infer-not-param.rs:19:22 + --> $DIR/regions-infer-not-param.rs:25:22 | LL | fn take_indirect2<'a,'b>(p: Indirect2<'a>) -> Indirect2<'b> { p } | ^^ error[E0308]: mismatched types - --> $DIR/regions-infer-not-param.rs:19:63 + --> $DIR/regions-infer-not-param.rs:25:63 | LL | fn take_indirect2<'a,'b>(p: Indirect2<'a>) -> Indirect2<'b> { p } | ^ lifetime mismatch @@ -45,12 +45,12 @@ LL | fn take_indirect2<'a,'b>(p: Indirect2<'a>) -> Indirect2<'b> { p } = note: expected struct `Indirect2<'b>` found struct `Indirect2<'a>` note: the lifetime `'b` as defined here... - --> $DIR/regions-infer-not-param.rs:19:22 + --> $DIR/regions-infer-not-param.rs:25:22 | LL | fn take_indirect2<'a,'b>(p: Indirect2<'a>) -> Indirect2<'b> { p } | ^^ note: ...does not necessarily outlive the lifetime `'a` as defined here - --> $DIR/regions-infer-not-param.rs:19:19 + --> $DIR/regions-infer-not-param.rs:25:19 | LL | fn take_indirect2<'a,'b>(p: Indirect2<'a>) -> Indirect2<'b> { p } | ^^ diff --git a/src/test/ui/regions/regions-infer-not-param.nll.stderr b/src/test/ui/regions/regions-infer-not-param.nll.stderr index f4875e49c3da4..95e6b03c350a3 100644 --- a/src/test/ui/regions/regions-infer-not-param.nll.stderr +++ b/src/test/ui/regions/regions-infer-not-param.nll.stderr @@ -1,5 +1,5 @@ error: lifetime may not live long enough - --> $DIR/regions-infer-not-param.rs:15:54 + --> $DIR/regions-infer-not-param.rs:19:54 | LL | fn take_direct<'a,'b>(p: Direct<'a>) -> Direct<'b> { p } | -- -- lifetime `'b` defined here ^ function was supposed to return data with lifetime `'b` but it is returning data with lifetime `'a` @@ -9,7 +9,7 @@ LL | fn take_direct<'a,'b>(p: Direct<'a>) -> Direct<'b> { p } = help: consider adding the following bound: `'a: 'b` error: lifetime may not live long enough - --> $DIR/regions-infer-not-param.rs:19:63 + --> $DIR/regions-infer-not-param.rs:25:63 | LL | fn take_indirect2<'a,'b>(p: Indirect2<'a>) -> Indirect2<'b> { p } | -- -- lifetime `'b` defined here ^ function was supposed to return data with lifetime `'a` but it is returning data with lifetime `'b` @@ -22,7 +22,7 @@ LL | fn take_indirect2<'a,'b>(p: Indirect2<'a>) -> Indirect2<'b> { p } = help: see for more information about variance error: lifetime may not live long enough - --> $DIR/regions-infer-not-param.rs:19:63 + --> $DIR/regions-infer-not-param.rs:25:63 | LL | fn take_indirect2<'a,'b>(p: Indirect2<'a>) -> Indirect2<'b> { p } | -- -- lifetime `'b` defined here ^ function was supposed to return data with lifetime `'b` but it is returning data with lifetime `'a` diff --git a/src/test/ui/regions/regions-infer-not-param.rs b/src/test/ui/regions/regions-infer-not-param.rs index 7643be64d5b23..0b8af5bc152ba 100644 --- a/src/test/ui/regions/regions-infer-not-param.rs +++ b/src/test/ui/regions/regions-infer-not-param.rs @@ -1,3 +1,7 @@ +// revisions: base nll +// ignore-compare-mode-nll +//[nll] compile-flags: -Z borrowck=mir + struct Direct<'a> { f: &'a isize } @@ -12,15 +16,20 @@ struct Indirect2<'a> { g: Box) + 'static> } -fn take_direct<'a,'b>(p: Direct<'a>) -> Direct<'b> { p } //~ ERROR mismatched types +fn take_direct<'a,'b>(p: Direct<'a>) -> Direct<'b> { p } +//[base]~^ ERROR mismatched types +//[nll]~^^ ERROR lifetime may not live long enough fn take_indirect1(p: Indirect1) -> Indirect1 { p } -fn take_indirect2<'a,'b>(p: Indirect2<'a>) -> Indirect2<'b> { p } //~ ERROR mismatched types -//~| expected struct `Indirect2<'b>` -//~| found struct `Indirect2<'a>` -//~| ERROR mismatched types -//~| expected struct `Indirect2<'b>` -//~| found struct `Indirect2<'a>` +fn take_indirect2<'a,'b>(p: Indirect2<'a>) -> Indirect2<'b> { p } +//[base]~^ ERROR mismatched types +//[base]~| expected struct `Indirect2<'b>` +//[base]~| found struct `Indirect2<'a>` +//[base]~| ERROR mismatched types +//[base]~| expected struct `Indirect2<'b>` +//[base]~| found struct `Indirect2<'a>` +//[nll]~^^^^^^^ ERROR lifetime may not live long enough +//[nll]~| ERROR lifetime may not live long enough fn main() {} diff --git a/src/test/ui/regions/regions-infer-paramd-indirect.stderr b/src/test/ui/regions/regions-infer-paramd-indirect.base.stderr similarity index 79% rename from src/test/ui/regions/regions-infer-paramd-indirect.stderr rename to src/test/ui/regions/regions-infer-paramd-indirect.base.stderr index d2b369fb07b9c..1d4471f910d30 100644 --- a/src/test/ui/regions/regions-infer-paramd-indirect.stderr +++ b/src/test/ui/regions/regions-infer-paramd-indirect.base.stderr @@ -1,5 +1,5 @@ error[E0308]: mismatched types - --> $DIR/regions-infer-paramd-indirect.rs:22:18 + --> $DIR/regions-infer-paramd-indirect.rs:26:18 | LL | self.f = b; | ^ lifetime mismatch @@ -7,12 +7,12 @@ LL | self.f = b; = note: expected struct `Box>` found struct `Box>` note: the anonymous lifetime defined here... - --> $DIR/regions-infer-paramd-indirect.rs:21:36 + --> $DIR/regions-infer-paramd-indirect.rs:25:36 | LL | fn set_f_bad(&mut self, b: Box) { | ^ note: ...does not necessarily outlive the lifetime `'a` as defined here - --> $DIR/regions-infer-paramd-indirect.rs:16:6 + --> $DIR/regions-infer-paramd-indirect.rs:20:6 | LL | impl<'a> SetF<'a> for C<'a> { | ^^ diff --git a/src/test/ui/regions/regions-infer-paramd-indirect.nll.stderr b/src/test/ui/regions/regions-infer-paramd-indirect.nll.stderr index afabdc1de1c7d..96377cbdab4ae 100644 --- a/src/test/ui/regions/regions-infer-paramd-indirect.nll.stderr +++ b/src/test/ui/regions/regions-infer-paramd-indirect.nll.stderr @@ -1,5 +1,5 @@ error: lifetime may not live long enough - --> $DIR/regions-infer-paramd-indirect.rs:22:9 + --> $DIR/regions-infer-paramd-indirect.rs:26:9 | LL | impl<'a> SetF<'a> for C<'a> { | -- lifetime `'a` defined here diff --git a/src/test/ui/regions/regions-infer-paramd-indirect.rs b/src/test/ui/regions/regions-infer-paramd-indirect.rs index 3b18bbf1df3d0..060306f611e1d 100644 --- a/src/test/ui/regions/regions-infer-paramd-indirect.rs +++ b/src/test/ui/regions/regions-infer-paramd-indirect.rs @@ -1,6 +1,10 @@ // Check that we correctly infer that b and c must be region // parameterized because they reference a which requires a region. +// revisions: base nll +// ignore-compare-mode-nll +//[nll] compile-flags: -Z borrowck=mir + type A<'a> = &'a isize; type B<'a> = Box>; @@ -20,10 +24,11 @@ impl<'a> SetF<'a> for C<'a> { fn set_f_bad(&mut self, b: Box) { self.f = b; - //~^ ERROR mismatched types - //~| expected struct `Box>` - //~| found struct `Box>` - //~| lifetime mismatch + //[base]~^ ERROR mismatched types + //[base]~| expected struct `Box>` + //[base]~| found struct `Box>` + //[base]~| lifetime mismatch + //[nll]~^^^^^ ERROR lifetime may not live long enough } } diff --git a/src/test/ui/regions/regions-lifetime-bounds-on-fns.stderr b/src/test/ui/regions/regions-lifetime-bounds-on-fns.base.stderr similarity index 88% rename from src/test/ui/regions/regions-lifetime-bounds-on-fns.stderr rename to src/test/ui/regions/regions-lifetime-bounds-on-fns.base.stderr index 2b2dd0dbbf250..e57b06aac3927 100644 --- a/src/test/ui/regions/regions-lifetime-bounds-on-fns.stderr +++ b/src/test/ui/regions/regions-lifetime-bounds-on-fns.base.stderr @@ -1,5 +1,5 @@ error[E0623]: lifetime mismatch - --> $DIR/regions-lifetime-bounds-on-fns.rs:8:10 + --> $DIR/regions-lifetime-bounds-on-fns.rs:12:10 | LL | fn b<'a, 'b>(x: &mut &'a isize, y: &mut &'b isize) { | --------- --------- these two types are declared with different lifetimes... @@ -8,7 +8,7 @@ LL | *x = *y; | ^^ ...but data from `y` flows into `x` here error[E0623]: lifetime mismatch - --> $DIR/regions-lifetime-bounds-on-fns.rs:14:7 + --> $DIR/regions-lifetime-bounds-on-fns.rs:20:7 | LL | fn c<'a,'b>(x: &mut &'a isize, y: &mut &'b isize) { | --------- --------- these two types are declared with different lifetimes... @@ -17,7 +17,7 @@ LL | a(x, y); | ^ ...but data from `y` flows into `x` here error[E0308]: mismatched types - --> $DIR/regions-lifetime-bounds-on-fns.rs:20:43 + --> $DIR/regions-lifetime-bounds-on-fns.rs:28:43 | LL | let _: fn(&mut &isize, &mut &isize) = a; | ^ one type is more general than the other diff --git a/src/test/ui/regions/regions-lifetime-bounds-on-fns.nll.stderr b/src/test/ui/regions/regions-lifetime-bounds-on-fns.nll.stderr index ee3dcef1cb5c4..7fe8b4bf57fc1 100644 --- a/src/test/ui/regions/regions-lifetime-bounds-on-fns.nll.stderr +++ b/src/test/ui/regions/regions-lifetime-bounds-on-fns.nll.stderr @@ -1,5 +1,5 @@ error: lifetime may not live long enough - --> $DIR/regions-lifetime-bounds-on-fns.rs:8:5 + --> $DIR/regions-lifetime-bounds-on-fns.rs:12:5 | LL | fn b<'a, 'b>(x: &mut &'a isize, y: &mut &'b isize) { | -- -- lifetime `'b` defined here @@ -12,7 +12,7 @@ LL | *x = *y; = help: consider adding the following bound: `'b: 'a` error: lifetime may not live long enough - --> $DIR/regions-lifetime-bounds-on-fns.rs:14:5 + --> $DIR/regions-lifetime-bounds-on-fns.rs:20:5 | LL | fn c<'a,'b>(x: &mut &'a isize, y: &mut &'b isize) { | -- -- lifetime `'b` defined here @@ -28,7 +28,7 @@ LL | a(x, y); = help: see for more information about variance error[E0308]: mismatched types - --> $DIR/regions-lifetime-bounds-on-fns.rs:20:12 + --> $DIR/regions-lifetime-bounds-on-fns.rs:28:12 | LL | let _: fn(&mut &isize, &mut &isize) = a; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ one type is more general than the other @@ -37,7 +37,7 @@ LL | let _: fn(&mut &isize, &mut &isize) = a; found fn pointer `for<'r, 's> fn(&'r mut &isize, &'s mut &isize)` error[E0308]: mismatched types - --> $DIR/regions-lifetime-bounds-on-fns.rs:20:12 + --> $DIR/regions-lifetime-bounds-on-fns.rs:28:12 | LL | let _: fn(&mut &isize, &mut &isize) = a; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ one type is more general than the other diff --git a/src/test/ui/regions/regions-lifetime-bounds-on-fns.rs b/src/test/ui/regions/regions-lifetime-bounds-on-fns.rs index 7d7f62e19792f..97c08d8ab0e3c 100644 --- a/src/test/ui/regions/regions-lifetime-bounds-on-fns.rs +++ b/src/test/ui/regions/regions-lifetime-bounds-on-fns.rs @@ -1,3 +1,7 @@ +// revisions: base nll +// ignore-compare-mode-nll +//[nll] compile-flags: -Z borrowck=mir + fn a<'a, 'b:'a>(x: &mut &'a isize, y: &mut &'b isize) { // Note: this is legal because of the `'b:'a` declaration. *x = *y; @@ -5,19 +9,25 @@ fn a<'a, 'b:'a>(x: &mut &'a isize, y: &mut &'b isize) { fn b<'a, 'b>(x: &mut &'a isize, y: &mut &'b isize) { // Illegal now because there is no `'b:'a` declaration. - *x = *y; //~ ERROR E0623 + *x = *y; + //[base]~^ ERROR lifetime mismatch [E0623] + //[nll]~^^ ERROR lifetime may not live long enough } fn c<'a,'b>(x: &mut &'a isize, y: &mut &'b isize) { // Here we try to call `foo` but do not know that `'a` and `'b` are // related as required. - a(x, y); //~ ERROR lifetime mismatch [E0623] + a(x, y); + //[base]~^ ERROR lifetime mismatch [E0623] + //[nll]~^^ ERROR lifetime may not live long enough } fn d() { // 'a and 'b are early bound in the function `a` because they appear // inconstraints: - let _: fn(&mut &isize, &mut &isize) = a; //~ ERROR E0308 + let _: fn(&mut &isize, &mut &isize) = a; + //~^ ERROR mismatched types [E0308] + //[nll]~^^ ERROR mismatched types [E0308] } fn e() { diff --git a/src/test/ui/regions/regions-nested-fns.stderr b/src/test/ui/regions/regions-nested-fns.base.stderr similarity index 85% rename from src/test/ui/regions/regions-nested-fns.stderr rename to src/test/ui/regions/regions-nested-fns.base.stderr index 11affcaaa79ca..37ce569e761ba 100644 --- a/src/test/ui/regions/regions-nested-fns.stderr +++ b/src/test/ui/regions/regions-nested-fns.base.stderr @@ -1,40 +1,46 @@ error[E0495]: cannot infer an appropriate lifetime due to conflicting requirements - --> $DIR/regions-nested-fns.rs:5:18 + --> $DIR/regions-nested-fns.rs:9:18 | LL | let mut ay = &y; | ^^ | note: first, the lifetime cannot outlive the anonymous lifetime #1 defined here... - --> $DIR/regions-nested-fns.rs:7:58 + --> $DIR/regions-nested-fns.rs:13:58 | LL | ignore:: FnMut(&'z isize)>>(Box::new(|z| { | __________________________________________________________^ LL | | ay = x; LL | | ay = &y; +LL | | LL | | ay = z; +LL | | LL | | })); | |_____^ note: ...so that reference does not outlive borrowed content - --> $DIR/regions-nested-fns.rs:10:14 + --> $DIR/regions-nested-fns.rs:17:14 | LL | ay = z; | ^ note: but, the lifetime must be valid for the anonymous lifetime #1 defined here... - --> $DIR/regions-nested-fns.rs:13:72 + --> $DIR/regions-nested-fns.rs:21:72 | LL | ignore::< Box FnMut(&'z isize) -> &'z isize>>(Box::new(|z| { | ________________________________________________________________________^ LL | | if false { return x; } +LL | | +LL | | LL | | if false { return ay; } LL | | return z; LL | | })); | |_____^ note: ...so that the types are compatible - --> $DIR/regions-nested-fns.rs:13:76 + --> $DIR/regions-nested-fns.rs:21:76 | LL | ignore::< Box FnMut(&'z isize) -> &'z isize>>(Box::new(|z| { | ____________________________________________________________________________^ LL | | if false { return x; } +LL | | +LL | | LL | | if false { return ay; } LL | | return z; LL | | })); @@ -43,23 +49,25 @@ LL | | })); found `&isize` error[E0312]: lifetime of reference outlives lifetime of borrowed content... - --> $DIR/regions-nested-fns.rs:14:27 + --> $DIR/regions-nested-fns.rs:22:27 | LL | if false { return x; } | ^ | note: ...the reference is valid for the anonymous lifetime #1 defined here... - --> $DIR/regions-nested-fns.rs:13:72 + --> $DIR/regions-nested-fns.rs:21:72 | LL | ignore::< Box FnMut(&'z isize) -> &'z isize>>(Box::new(|z| { | ________________________________________________________________________^ LL | | if false { return x; } +LL | | +LL | | LL | | if false { return ay; } LL | | return z; LL | | })); | |_____^ note: ...but the borrowed content is only valid for the lifetime `'x` as defined here - --> $DIR/regions-nested-fns.rs:3:11 + --> $DIR/regions-nested-fns.rs:7:11 | LL | fn nested<'x>(x: &'x isize) { | ^^ diff --git a/src/test/ui/regions/regions-nested-fns.nll.stderr b/src/test/ui/regions/regions-nested-fns.nll.stderr index a0cfa36247228..6f2a89994b047 100644 --- a/src/test/ui/regions/regions-nested-fns.nll.stderr +++ b/src/test/ui/regions/regions-nested-fns.nll.stderr @@ -1,9 +1,9 @@ error[E0521]: borrowed data escapes outside of closure - --> $DIR/regions-nested-fns.rs:10:9 + --> $DIR/regions-nested-fns.rs:17:9 | LL | let mut ay = &y; | ------ `ay` declared here, outside of the closure body -LL | +... LL | ignore:: FnMut(&'z isize)>>(Box::new(|z| { | - `z` is a reference that is only valid in the closure body ... @@ -11,7 +11,7 @@ LL | ay = z; | ^^^^^^ `z` escapes the closure body here error[E0597]: `y` does not live long enough - --> $DIR/regions-nested-fns.rs:5:18 + --> $DIR/regions-nested-fns.rs:9:18 | LL | let mut ay = &y; | ^^ borrowed value does not live long enough @@ -23,7 +23,7 @@ LL | } | - `y` dropped here while still borrowed error[E0597]: `y` does not live long enough - --> $DIR/regions-nested-fns.rs:9:15 + --> $DIR/regions-nested-fns.rs:15:15 | LL | ignore:: FnMut(&'z isize)>>(Box::new(|z| { | --- value captured here @@ -38,7 +38,7 @@ LL | } | - `y` dropped here while still borrowed error: lifetime may not live long enough - --> $DIR/regions-nested-fns.rs:14:27 + --> $DIR/regions-nested-fns.rs:22:27 | LL | fn nested<'x>(x: &'x isize) { | -- lifetime `'x` defined here diff --git a/src/test/ui/regions/regions-nested-fns.rs b/src/test/ui/regions/regions-nested-fns.rs index c02d4e0ce453b..8cc39792bd978 100644 --- a/src/test/ui/regions/regions-nested-fns.rs +++ b/src/test/ui/regions/regions-nested-fns.rs @@ -1,17 +1,27 @@ +// revisions: base nll +// ignore-compare-mode-nll +//[nll] compile-flags: -Z borrowck=mir + fn ignore(t: T) {} fn nested<'x>(x: &'x isize) { let y = 3; - let mut ay = &y; //~ ERROR E0495 + let mut ay = &y; + //[base]~^ ERROR E0495 + //[nll]~^^ ERROR `y` does not live long enough [E0597] ignore:: FnMut(&'z isize)>>(Box::new(|z| { ay = x; ay = &y; + //[nll]~^ ERROR `y` does not live long enough ay = z; + //[nll]~^ ERROR borrowed data escapes outside of closure [E0521] })); ignore::< Box FnMut(&'z isize) -> &'z isize>>(Box::new(|z| { - if false { return x; } //~ ERROR E0312 + if false { return x; } + //[base]~^ ERROR E0312 + //[nll]~^^ ERROR lifetime may not live long enough if false { return ay; } return z; })); diff --git a/src/test/ui/regions/regions-outlives-projection-container.stderr b/src/test/ui/regions/regions-outlives-projection-container.base.stderr similarity index 75% rename from src/test/ui/regions/regions-outlives-projection-container.stderr rename to src/test/ui/regions/regions-outlives-projection-container.base.stderr index 8c2b2c1e24ae1..9a66f67ea6ec4 100644 --- a/src/test/ui/regions/regions-outlives-projection-container.stderr +++ b/src/test/ui/regions/regions-outlives-projection-container.base.stderr @@ -1,67 +1,67 @@ error[E0491]: in type `&'a WithAssoc>`, reference has a longer lifetime than the data it references - --> $DIR/regions-outlives-projection-container.rs:36:13 + --> $DIR/regions-outlives-projection-container.rs:40:13 | LL | let _x: &'a WithAssoc> = loop { }; | ^^^^^^^^^^^^^^^^^^^^^^^^^^ | note: the pointer is valid for the lifetime `'a` as defined here - --> $DIR/regions-outlives-projection-container.rs:28:15 + --> $DIR/regions-outlives-projection-container.rs:32:15 | LL | fn with_assoc<'a,'b>() { | ^^ note: but the referenced data is only valid for the lifetime `'b` as defined here - --> $DIR/regions-outlives-projection-container.rs:28:18 + --> $DIR/regions-outlives-projection-container.rs:32:18 | LL | fn with_assoc<'a,'b>() { | ^^ error[E0491]: in type `&'a WithoutAssoc>`, reference has a longer lifetime than the data it references - --> $DIR/regions-outlives-projection-container.rs:54:13 + --> $DIR/regions-outlives-projection-container.rs:59:13 | LL | let _x: &'a WithoutAssoc> = loop { }; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | note: the pointer is valid for the lifetime `'a` as defined here - --> $DIR/regions-outlives-projection-container.rs:50:18 + --> $DIR/regions-outlives-projection-container.rs:55:18 | LL | fn without_assoc<'a,'b>() { | ^^ note: but the referenced data is only valid for the lifetime `'b` as defined here - --> $DIR/regions-outlives-projection-container.rs:50:21 + --> $DIR/regions-outlives-projection-container.rs:55:21 | LL | fn without_assoc<'a,'b>() { | ^^ error[E0491]: in type `&'a WithAssoc>`, reference has a longer lifetime than the data it references - --> $DIR/regions-outlives-projection-container.rs:63:12 + --> $DIR/regions-outlives-projection-container.rs:69:12 | LL | call::<&'a WithAssoc>>(); | ^^^^^^^^^^^^^^^^^^^^^^^^^^ | note: the pointer is valid for the lifetime `'a` as defined here - --> $DIR/regions-outlives-projection-container.rs:58:20 + --> $DIR/regions-outlives-projection-container.rs:64:20 | LL | fn call_with_assoc<'a,'b>() { | ^^ note: but the referenced data is only valid for the lifetime `'b` as defined here - --> $DIR/regions-outlives-projection-container.rs:58:23 + --> $DIR/regions-outlives-projection-container.rs:64:23 | LL | fn call_with_assoc<'a,'b>() { | ^^ error[E0491]: in type `&'a WithoutAssoc>`, reference has a longer lifetime than the data it references - --> $DIR/regions-outlives-projection-container.rs:70:12 + --> $DIR/regions-outlives-projection-container.rs:77:12 | LL | call::<&'a WithoutAssoc>>(); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | note: the pointer is valid for the lifetime `'a` as defined here - --> $DIR/regions-outlives-projection-container.rs:67:23 + --> $DIR/regions-outlives-projection-container.rs:74:23 | LL | fn call_without_assoc<'a,'b>() { | ^^ note: but the referenced data is only valid for the lifetime `'b` as defined here - --> $DIR/regions-outlives-projection-container.rs:67:26 + --> $DIR/regions-outlives-projection-container.rs:74:26 | LL | fn call_without_assoc<'a,'b>() { | ^^ diff --git a/src/test/ui/regions/regions-outlives-projection-container.nll.stderr b/src/test/ui/regions/regions-outlives-projection-container.nll.stderr index 073a31900227e..d93eef9ce0b5c 100644 --- a/src/test/ui/regions/regions-outlives-projection-container.nll.stderr +++ b/src/test/ui/regions/regions-outlives-projection-container.nll.stderr @@ -1,5 +1,5 @@ error: lifetime may not live long enough - --> $DIR/regions-outlives-projection-container.rs:36:13 + --> $DIR/regions-outlives-projection-container.rs:40:13 | LL | fn with_assoc<'a,'b>() { | -- -- lifetime `'b` defined here @@ -12,7 +12,7 @@ LL | let _x: &'a WithAssoc> = loop { }; = help: consider adding the following bound: `'b: 'a` error: lifetime may not live long enough - --> $DIR/regions-outlives-projection-container.rs:54:13 + --> $DIR/regions-outlives-projection-container.rs:59:13 | LL | fn without_assoc<'a,'b>() { | -- -- lifetime `'b` defined here @@ -25,7 +25,7 @@ LL | let _x: &'a WithoutAssoc> = loop { }; = help: consider adding the following bound: `'b: 'a` error: lifetime may not live long enough - --> $DIR/regions-outlives-projection-container.rs:63:5 + --> $DIR/regions-outlives-projection-container.rs:69:5 | LL | fn call_with_assoc<'a,'b>() { | -- -- lifetime `'b` defined here @@ -38,7 +38,7 @@ LL | call::<&'a WithAssoc>>(); = help: consider adding the following bound: `'b: 'a` error: lifetime may not live long enough - --> $DIR/regions-outlives-projection-container.rs:70:5 + --> $DIR/regions-outlives-projection-container.rs:77:5 | LL | fn call_without_assoc<'a,'b>() { | -- -- lifetime `'b` defined here diff --git a/src/test/ui/regions/regions-outlives-projection-container.rs b/src/test/ui/regions/regions-outlives-projection-container.rs index 3afc600becb6e..ccfd2213b6f33 100644 --- a/src/test/ui/regions/regions-outlives-projection-container.rs +++ b/src/test/ui/regions/regions-outlives-projection-container.rs @@ -2,6 +2,10 @@ // type of a bound that appears in the where clause on a struct must // outlive the location in which the type appears. Issue #22246. +// revisions: base nll +// ignore-compare-mode-nll +//[nll] compile-flags: -Z borrowck=mir + #![allow(dead_code)] #![feature(rustc_attrs)] @@ -34,7 +38,8 @@ fn with_assoc<'a,'b>() { // FIXME (#54943) NLL doesn't enforce WF condition in unreachable code if // `_x` is changed to `_` let _x: &'a WithAssoc> = loop { }; - //~^ ERROR reference has a longer lifetime + //[base]~^ ERROR reference has a longer lifetime + //[nll]~^^ ERROR lifetime may not live long enough } fn with_assoc1<'a,'b>() where 'b : 'a { @@ -52,7 +57,8 @@ fn without_assoc<'a,'b>() { // that `'b:'a` holds because the `'b` appears in `TheType<'b>`. let _x: &'a WithoutAssoc> = loop { }; - //~^ ERROR reference has a longer lifetime + //[base]~^ ERROR reference has a longer lifetime + //[nll]~^^ ERROR lifetime may not live long enough } fn call_with_assoc<'a,'b>() { @@ -61,13 +67,16 @@ fn call_with_assoc<'a,'b>() { // no data. call::<&'a WithAssoc>>(); - //~^ ERROR reference has a longer lifetime + //[base]~^ ERROR reference has a longer lifetime + //[nll]~^^ ERROR lifetime may not live long enough } fn call_without_assoc<'a,'b>() { // As `without_assoc`, but in a distinct scenario. - call::<&'a WithoutAssoc>>(); //~ ERROR reference has a longer lifetime + call::<&'a WithoutAssoc>>(); + //[base]~^ ERROR reference has a longer lifetime + //[nll]~^^ ERROR lifetime may not live long enough } fn call() { } diff --git a/src/test/ui/regions/regions-proc-bound-capture.stderr b/src/test/ui/regions/regions-proc-bound-capture.base.stderr similarity index 93% rename from src/test/ui/regions/regions-proc-bound-capture.stderr rename to src/test/ui/regions/regions-proc-bound-capture.base.stderr index 2ebe874da9350..427c6f4ec8c3c 100644 --- a/src/test/ui/regions/regions-proc-bound-capture.stderr +++ b/src/test/ui/regions/regions-proc-bound-capture.base.stderr @@ -1,5 +1,5 @@ error[E0759]: `x` has an anonymous lifetime `'_` but it needs to satisfy a `'static` lifetime requirement - --> $DIR/regions-proc-bound-capture.rs:9:14 + --> $DIR/regions-proc-bound-capture.rs:13:14 | LL | fn static_proc(x: &isize) -> Box (isize) + 'static> { | ------ this data with an anonymous lifetime `'_`... @@ -8,7 +8,7 @@ LL | Box::new(move || { *x }) | ^^^^^^^^^^^^^^ ...is used and required to live as long as `'static` here | note: `'static` lifetime requirement introduced by the return type - --> $DIR/regions-proc-bound-capture.rs:7:59 + --> $DIR/regions-proc-bound-capture.rs:11:59 | LL | fn static_proc(x: &isize) -> Box (isize) + 'static> { | ^^^^^^^ `'static` requirement introduced here diff --git a/src/test/ui/regions/regions-proc-bound-capture.nll.stderr b/src/test/ui/regions/regions-proc-bound-capture.nll.stderr index 75890b8581537..6120a53eb0955 100644 --- a/src/test/ui/regions/regions-proc-bound-capture.nll.stderr +++ b/src/test/ui/regions/regions-proc-bound-capture.nll.stderr @@ -1,5 +1,5 @@ error: lifetime may not live long enough - --> $DIR/regions-proc-bound-capture.rs:9:5 + --> $DIR/regions-proc-bound-capture.rs:13:5 | LL | fn static_proc(x: &isize) -> Box (isize) + 'static> { | - let's call the lifetime of this reference `'1` diff --git a/src/test/ui/regions/regions-proc-bound-capture.rs b/src/test/ui/regions/regions-proc-bound-capture.rs index 55d964ac53405..1033163c8dd9c 100644 --- a/src/test/ui/regions/regions-proc-bound-capture.rs +++ b/src/test/ui/regions/regions-proc-bound-capture.rs @@ -1,3 +1,7 @@ +// revisions: base nll +// ignore-compare-mode-nll +//[nll] compile-flags: -Z borrowck=mir + fn borrowed_proc<'a>(x: &'a isize) -> Box(isize) + 'a> { // This is legal, because the region bound on `proc` // states that it captures `x`. @@ -6,7 +10,9 @@ fn borrowed_proc<'a>(x: &'a isize) -> Box(isize) + 'a> { fn static_proc(x: &isize) -> Box (isize) + 'static> { // This is illegal, because the region bound on `proc` is 'static. - Box::new(move || { *x }) //~ ERROR E0759 + Box::new(move || { *x }) + //[base]~^ ERROR E0759 + //[nll]~^^ ERROR lifetime may not live long enough } fn main() { } diff --git a/src/test/ui/regions/regions-reborrow-from-shorter-mut-ref-mut-ref.stderr b/src/test/ui/regions/regions-reborrow-from-shorter-mut-ref-mut-ref.base.stderr similarity index 89% rename from src/test/ui/regions/regions-reborrow-from-shorter-mut-ref-mut-ref.stderr rename to src/test/ui/regions/regions-reborrow-from-shorter-mut-ref-mut-ref.base.stderr index aca3a1ed05728..7ecdb0cd15e9e 100644 --- a/src/test/ui/regions/regions-reborrow-from-shorter-mut-ref-mut-ref.stderr +++ b/src/test/ui/regions/regions-reborrow-from-shorter-mut-ref-mut-ref.base.stderr @@ -1,5 +1,5 @@ error[E0623]: lifetime mismatch - --> $DIR/regions-reborrow-from-shorter-mut-ref-mut-ref.rs:4:5 + --> $DIR/regions-reborrow-from-shorter-mut-ref-mut-ref.rs:8:5 | LL | fn copy_borrowed_ptr<'a, 'b, 'c>(p: &'a mut &'b mut &'c mut isize) -> &'b mut isize { | ----------------------------- ------------- diff --git a/src/test/ui/regions/regions-reborrow-from-shorter-mut-ref-mut-ref.nll.stderr b/src/test/ui/regions/regions-reborrow-from-shorter-mut-ref-mut-ref.nll.stderr index dc905d076bb7d..519ada7bdfc96 100644 --- a/src/test/ui/regions/regions-reborrow-from-shorter-mut-ref-mut-ref.nll.stderr +++ b/src/test/ui/regions/regions-reborrow-from-shorter-mut-ref-mut-ref.nll.stderr @@ -1,5 +1,5 @@ error: lifetime may not live long enough - --> $DIR/regions-reborrow-from-shorter-mut-ref-mut-ref.rs:4:5 + --> $DIR/regions-reborrow-from-shorter-mut-ref-mut-ref.rs:8:5 | LL | fn copy_borrowed_ptr<'a, 'b, 'c>(p: &'a mut &'b mut &'c mut isize) -> &'b mut isize { | -- -- lifetime `'b` defined here diff --git a/src/test/ui/regions/regions-reborrow-from-shorter-mut-ref-mut-ref.rs b/src/test/ui/regions/regions-reborrow-from-shorter-mut-ref-mut-ref.rs index 35aca8be25beb..c4ad05010fb6d 100644 --- a/src/test/ui/regions/regions-reborrow-from-shorter-mut-ref-mut-ref.rs +++ b/src/test/ui/regions/regions-reborrow-from-shorter-mut-ref-mut-ref.rs @@ -1,7 +1,13 @@ // Issue #8624. Test for reborrowing with 3 levels, not just two. +// revisions: base nll +// ignore-compare-mode-nll +//[nll] compile-flags: -Z borrowck=mir + fn copy_borrowed_ptr<'a, 'b, 'c>(p: &'a mut &'b mut &'c mut isize) -> &'b mut isize { - &mut ***p //~ ERROR lifetime mismatch [E0623] + &mut ***p + //[base]~^ ERROR lifetime mismatch [E0623] + //[nll]~^^ ERROR lifetime may not live long enough } fn main() { diff --git a/src/test/ui/regions/regions-reborrow-from-shorter-mut-ref.stderr b/src/test/ui/regions/regions-reborrow-from-shorter-mut-ref.base.stderr similarity index 90% rename from src/test/ui/regions/regions-reborrow-from-shorter-mut-ref.stderr rename to src/test/ui/regions/regions-reborrow-from-shorter-mut-ref.base.stderr index a9916dbe4f5ef..3cb7de1585090 100644 --- a/src/test/ui/regions/regions-reborrow-from-shorter-mut-ref.stderr +++ b/src/test/ui/regions/regions-reborrow-from-shorter-mut-ref.base.stderr @@ -1,5 +1,5 @@ error[E0623]: lifetime mismatch - --> $DIR/regions-reborrow-from-shorter-mut-ref.rs:6:5 + --> $DIR/regions-reborrow-from-shorter-mut-ref.rs:10:5 | LL | fn copy_borrowed_ptr<'a, 'b>(p: &'a mut &'b mut isize) -> &'b mut isize { | --------------------- ------------- diff --git a/src/test/ui/regions/regions-reborrow-from-shorter-mut-ref.nll.stderr b/src/test/ui/regions/regions-reborrow-from-shorter-mut-ref.nll.stderr index c98ec477417bd..4dd2a83739ca7 100644 --- a/src/test/ui/regions/regions-reborrow-from-shorter-mut-ref.nll.stderr +++ b/src/test/ui/regions/regions-reborrow-from-shorter-mut-ref.nll.stderr @@ -1,5 +1,5 @@ error: lifetime may not live long enough - --> $DIR/regions-reborrow-from-shorter-mut-ref.rs:6:5 + --> $DIR/regions-reborrow-from-shorter-mut-ref.rs:10:5 | LL | fn copy_borrowed_ptr<'a, 'b>(p: &'a mut &'b mut isize) -> &'b mut isize { | -- -- lifetime `'b` defined here diff --git a/src/test/ui/regions/regions-reborrow-from-shorter-mut-ref.rs b/src/test/ui/regions/regions-reborrow-from-shorter-mut-ref.rs index 77041ab4f05cb..c41e76e4d2a11 100644 --- a/src/test/ui/regions/regions-reborrow-from-shorter-mut-ref.rs +++ b/src/test/ui/regions/regions-reborrow-from-shorter-mut-ref.rs @@ -2,8 +2,14 @@ // pointer which is backed by another `&'a mut` can only be done // for `'a` (which must be a sublifetime of `'b`). +// revisions: base nll +// ignore-compare-mode-nll +//[nll] compile-flags: -Z borrowck=mir + fn copy_borrowed_ptr<'a, 'b>(p: &'a mut &'b mut isize) -> &'b mut isize { - &mut **p //~ ERROR lifetime mismatch [E0623] + &mut **p + //[base]~^ ERROR lifetime mismatch [E0623] + //[nll]~^^ ERROR lifetime may not live long enough } fn main() { diff --git a/src/test/ui/regions/regions-ret-borrowed-1.stderr b/src/test/ui/regions/regions-ret-borrowed-1.base.stderr similarity index 78% rename from src/test/ui/regions/regions-ret-borrowed-1.stderr rename to src/test/ui/regions/regions-ret-borrowed-1.base.stderr index 86df7bfeb7062..d102f93a64771 100644 --- a/src/test/ui/regions/regions-ret-borrowed-1.stderr +++ b/src/test/ui/regions/regions-ret-borrowed-1.base.stderr @@ -1,28 +1,28 @@ error[E0495]: cannot infer an appropriate lifetime due to conflicting requirements - --> $DIR/regions-ret-borrowed-1.rs:10:14 + --> $DIR/regions-ret-borrowed-1.rs:14:14 | LL | with(|o| o) | ^ | note: first, the lifetime cannot outlive the anonymous lifetime #1 defined here... - --> $DIR/regions-ret-borrowed-1.rs:10:10 + --> $DIR/regions-ret-borrowed-1.rs:14:10 | LL | with(|o| o) | ^^^^^ note: ...so that the types are compatible - --> $DIR/regions-ret-borrowed-1.rs:10:14 + --> $DIR/regions-ret-borrowed-1.rs:14:14 | LL | with(|o| o) | ^ = note: expected `&isize` found `&isize` note: but, the lifetime must be valid for the lifetime `'a` as defined here... - --> $DIR/regions-ret-borrowed-1.rs:9:14 + --> $DIR/regions-ret-borrowed-1.rs:13:14 | LL | fn return_it<'a>() -> &'a isize { | ^^ note: ...so that reference does not outlive borrowed content - --> $DIR/regions-ret-borrowed-1.rs:10:5 + --> $DIR/regions-ret-borrowed-1.rs:14:5 | LL | with(|o| o) | ^^^^^^^^^^^ diff --git a/src/test/ui/regions/regions-ret-borrowed-1.nll.stderr b/src/test/ui/regions/regions-ret-borrowed-1.nll.stderr index 0784e894ea920..4fdadccab15f9 100644 --- a/src/test/ui/regions/regions-ret-borrowed-1.nll.stderr +++ b/src/test/ui/regions/regions-ret-borrowed-1.nll.stderr @@ -1,5 +1,5 @@ error: lifetime may not live long enough - --> $DIR/regions-ret-borrowed-1.rs:10:14 + --> $DIR/regions-ret-borrowed-1.rs:14:14 | LL | with(|o| o) | -- ^ returning this value requires that `'1` must outlive `'2` diff --git a/src/test/ui/regions/regions-ret-borrowed-1.rs b/src/test/ui/regions/regions-ret-borrowed-1.rs index 1be5edee599c4..fed631320b442 100644 --- a/src/test/ui/regions/regions-ret-borrowed-1.rs +++ b/src/test/ui/regions/regions-ret-borrowed-1.rs @@ -2,13 +2,18 @@ // some point regions-ret-borrowed reported an error but this file did // not, due to special hardcoding around the anonymous region. +// revisions: base nll +// ignore-compare-mode-nll +//[nll] compile-flags: -Z borrowck=mir + fn with(f: F) -> R where F: for<'a> FnOnce(&'a isize) -> R { f(&3) } fn return_it<'a>() -> &'a isize { with(|o| o) - //~^ ERROR cannot infer + //[base]~^ ERROR cannot infer an appropriate lifetime due to conflicting requirements [E0495] + //[nll]~^^ ERROR lifetime may not live long enough } fn main() { diff --git a/src/test/ui/regions/regions-ret-borrowed.stderr b/src/test/ui/regions/regions-ret-borrowed.base.stderr similarity index 79% rename from src/test/ui/regions/regions-ret-borrowed.stderr rename to src/test/ui/regions/regions-ret-borrowed.base.stderr index b9a06d974334c..62b42b5dd1171 100644 --- a/src/test/ui/regions/regions-ret-borrowed.stderr +++ b/src/test/ui/regions/regions-ret-borrowed.base.stderr @@ -1,28 +1,28 @@ error[E0495]: cannot infer an appropriate lifetime due to conflicting requirements - --> $DIR/regions-ret-borrowed.rs:13:14 + --> $DIR/regions-ret-borrowed.rs:17:14 | LL | with(|o| o) | ^ | note: first, the lifetime cannot outlive the anonymous lifetime #1 defined here... - --> $DIR/regions-ret-borrowed.rs:13:10 + --> $DIR/regions-ret-borrowed.rs:17:10 | LL | with(|o| o) | ^^^^^ note: ...so that the types are compatible - --> $DIR/regions-ret-borrowed.rs:13:14 + --> $DIR/regions-ret-borrowed.rs:17:14 | LL | with(|o| o) | ^ = note: expected `&isize` found `&isize` note: but, the lifetime must be valid for the lifetime `'a` as defined here... - --> $DIR/regions-ret-borrowed.rs:12:14 + --> $DIR/regions-ret-borrowed.rs:16:14 | LL | fn return_it<'a>() -> &'a isize { | ^^ note: ...so that reference does not outlive borrowed content - --> $DIR/regions-ret-borrowed.rs:13:5 + --> $DIR/regions-ret-borrowed.rs:17:5 | LL | with(|o| o) | ^^^^^^^^^^^ diff --git a/src/test/ui/regions/regions-ret-borrowed.nll.stderr b/src/test/ui/regions/regions-ret-borrowed.nll.stderr index d9be5ef89cceb..d3ea5bd875f9b 100644 --- a/src/test/ui/regions/regions-ret-borrowed.nll.stderr +++ b/src/test/ui/regions/regions-ret-borrowed.nll.stderr @@ -1,5 +1,5 @@ error: lifetime may not live long enough - --> $DIR/regions-ret-borrowed.rs:13:14 + --> $DIR/regions-ret-borrowed.rs:17:14 | LL | with(|o| o) | -- ^ returning this value requires that `'1` must outlive `'2` diff --git a/src/test/ui/regions/regions-ret-borrowed.rs b/src/test/ui/regions/regions-ret-borrowed.rs index 5fca92d68b65c..2b6855d1c71ef 100644 --- a/src/test/ui/regions/regions-ret-borrowed.rs +++ b/src/test/ui/regions/regions-ret-borrowed.rs @@ -5,13 +5,18 @@ // used to successfully compile because we failed to account for the // fact that fn(x: &isize) rebound the region &. +// revisions: base nll +// ignore-compare-mode-nll +//[nll] compile-flags: -Z borrowck=mir + fn with(f: F) -> R where F: FnOnce(&isize) -> R { f(&3) } fn return_it<'a>() -> &'a isize { with(|o| o) - //~^ ERROR cannot infer + //[base]~^ ERROR cannot infer an appropriate lifetime due to conflicting requirements [E0495] + //[nll]~^^ ERROR lifetime may not live long enough } fn main() { diff --git a/src/test/ui/regions/regions-static-bound.stderr b/src/test/ui/regions/regions-static-bound.base.stderr similarity index 86% rename from src/test/ui/regions/regions-static-bound.stderr rename to src/test/ui/regions/regions-static-bound.base.stderr index b8e69e02609d6..b37ce1e76bdfd 100644 --- a/src/test/ui/regions/regions-static-bound.stderr +++ b/src/test/ui/regions/regions-static-bound.base.stderr @@ -1,18 +1,18 @@ error[E0312]: lifetime of reference outlives lifetime of borrowed content... - --> $DIR/regions-static-bound.rs:6:5 + --> $DIR/regions-static-bound.rs:10:5 | LL | t | ^ | = note: ...the reference is valid for the static lifetime... note: ...but the borrowed content is only valid for the lifetime `'a` as defined here - --> $DIR/regions-static-bound.rs:5:24 + --> $DIR/regions-static-bound.rs:9:24 | LL | fn static_id_wrong_way<'a>(t: &'a ()) -> &'static () where 'static: 'a { | ^^ error[E0759]: `u` has an anonymous lifetime `'_` but it needs to satisfy a `'static` lifetime requirement - --> $DIR/regions-static-bound.rs:10:5 + --> $DIR/regions-static-bound.rs:16:5 | LL | fn error(u: &(), v: &()) { | --- this data with an anonymous lifetime `'_`... @@ -20,22 +20,22 @@ LL | static_id(&u); | ^^^^^^^^^ -- ...is used here... | note: ...and is required to live as long as `'static` here - --> $DIR/regions-static-bound.rs:10:5 + --> $DIR/regions-static-bound.rs:16:5 | LL | static_id(&u); | ^^^^^^^^^ error[E0759]: `v` has an anonymous lifetime `'_` but it needs to satisfy a `'static` lifetime requirement - --> $DIR/regions-static-bound.rs:11:5 + --> $DIR/regions-static-bound.rs:19:5 | LL | fn error(u: &(), v: &()) { | --- this data with an anonymous lifetime `'_`... -LL | static_id(&u); +... LL | static_id_indirect(&v); | ^^^^^^^^^^^^^^^^^^ -- ...is used here... | note: ...and is required to live as long as `'static` here - --> $DIR/regions-static-bound.rs:11:5 + --> $DIR/regions-static-bound.rs:19:5 | LL | static_id_indirect(&v); | ^^^^^^^^^^^^^^^^^^ diff --git a/src/test/ui/regions/regions-static-bound.nll.stderr b/src/test/ui/regions/regions-static-bound.nll.stderr index 699638c7ef9b2..d228c42f99579 100644 --- a/src/test/ui/regions/regions-static-bound.nll.stderr +++ b/src/test/ui/regions/regions-static-bound.nll.stderr @@ -1,5 +1,5 @@ error: lifetime may not live long enough - --> $DIR/regions-static-bound.rs:6:5 + --> $DIR/regions-static-bound.rs:10:5 | LL | fn static_id_wrong_way<'a>(t: &'a ()) -> &'static () where 'static: 'a { | -- lifetime `'a` defined here @@ -7,7 +7,7 @@ LL | t | ^ returning this value requires that `'a` must outlive `'static` error[E0521]: borrowed data escapes outside of function - --> $DIR/regions-static-bound.rs:10:5 + --> $DIR/regions-static-bound.rs:16:5 | LL | fn error(u: &(), v: &()) { | - - let's call the lifetime of this reference `'1` @@ -20,13 +20,13 @@ LL | static_id(&u); | argument requires that `'1` must outlive `'static` error[E0521]: borrowed data escapes outside of function - --> $DIR/regions-static-bound.rs:11:5 + --> $DIR/regions-static-bound.rs:19:5 | LL | fn error(u: &(), v: &()) { | - - let's call the lifetime of this reference `'2` | | | `v` is a reference that is only valid in the function body -LL | static_id(&u); +... LL | static_id_indirect(&v); | ^^^^^^^^^^^^^^^^^^^^^^ | | diff --git a/src/test/ui/regions/regions-static-bound.rs b/src/test/ui/regions/regions-static-bound.rs index a977a8b36d056..058b717c95daa 100644 --- a/src/test/ui/regions/regions-static-bound.rs +++ b/src/test/ui/regions/regions-static-bound.rs @@ -1,14 +1,24 @@ +// revisions: base nll +// ignore-compare-mode-nll +//[nll] compile-flags: -Z borrowck=mir + fn static_id<'a,'b>(t: &'a ()) -> &'static () where 'a: 'static { t } fn static_id_indirect<'a,'b>(t: &'a ()) -> &'static () where 'a: 'b, 'b: 'static { t } fn static_id_wrong_way<'a>(t: &'a ()) -> &'static () where 'static: 'a { - t //~ ERROR E0312 + t + //[base]~^ ERROR E0312 + //[nll]~^^ ERROR lifetime may not live long enough } fn error(u: &(), v: &()) { - static_id(&u); //~ ERROR `u` has an anonymous lifetime `'_` but it needs to satisfy a `'static` lifetime requirement [E0759] - static_id_indirect(&v); //~ ERROR `v` has an anonymous lifetime `'_` but it needs to satisfy a `'static` lifetime requirement [E0759] + static_id(&u); + //[base]~^ ERROR `u` has an anonymous lifetime `'_` but it needs to satisfy a `'static` lifetime requirement [E0759] + //[nll]~^^ ERROR borrowed data escapes outside of function [E0521] + static_id_indirect(&v); + //[base]~^ ERROR `v` has an anonymous lifetime `'_` but it needs to satisfy a `'static` lifetime requirement [E0759] + //[nll]~^^ ERROR borrowed data escapes outside of function [E0521] } fn main() {} diff --git a/src/test/ui/regions/regions-trait-object-subtyping.stderr b/src/test/ui/regions/regions-trait-object-subtyping.base.stderr similarity index 76% rename from src/test/ui/regions/regions-trait-object-subtyping.stderr rename to src/test/ui/regions/regions-trait-object-subtyping.base.stderr index d45ca94ad27fa..9f52136f0c08b 100644 --- a/src/test/ui/regions/regions-trait-object-subtyping.stderr +++ b/src/test/ui/regions/regions-trait-object-subtyping.base.stderr @@ -1,43 +1,43 @@ error[E0478]: lifetime bound not satisfied - --> $DIR/regions-trait-object-subtyping.rs:15:5 + --> $DIR/regions-trait-object-subtyping.rs:19:5 | LL | x | ^ | note: lifetime parameter instantiated with the lifetime `'a` as defined here - --> $DIR/regions-trait-object-subtyping.rs:13:9 + --> $DIR/regions-trait-object-subtyping.rs:17:9 | LL | fn foo3<'a,'b>(x: &'a mut dyn Dummy) -> &'b mut dyn Dummy { | ^^ note: but lifetime parameter must outlive the lifetime `'b` as defined here - --> $DIR/regions-trait-object-subtyping.rs:13:12 + --> $DIR/regions-trait-object-subtyping.rs:17:12 | LL | fn foo3<'a,'b>(x: &'a mut dyn Dummy) -> &'b mut dyn Dummy { | ^^ error[E0495]: cannot infer an appropriate lifetime for automatic coercion due to conflicting requirements - --> $DIR/regions-trait-object-subtyping.rs:15:5 + --> $DIR/regions-trait-object-subtyping.rs:19:5 | LL | x | ^ | note: first, the lifetime cannot outlive the lifetime `'a` as defined here... - --> $DIR/regions-trait-object-subtyping.rs:13:9 + --> $DIR/regions-trait-object-subtyping.rs:17:9 | LL | fn foo3<'a,'b>(x: &'a mut dyn Dummy) -> &'b mut dyn Dummy { | ^^ note: ...so that reference does not outlive borrowed content - --> $DIR/regions-trait-object-subtyping.rs:15:5 + --> $DIR/regions-trait-object-subtyping.rs:19:5 | LL | x | ^ note: but, the lifetime must be valid for the lifetime `'b` as defined here... - --> $DIR/regions-trait-object-subtyping.rs:13:12 + --> $DIR/regions-trait-object-subtyping.rs:17:12 | LL | fn foo3<'a,'b>(x: &'a mut dyn Dummy) -> &'b mut dyn Dummy { | ^^ note: ...so that the types are compatible - --> $DIR/regions-trait-object-subtyping.rs:15:5 + --> $DIR/regions-trait-object-subtyping.rs:19:5 | LL | x | ^ @@ -45,7 +45,7 @@ LL | x found `&mut (dyn Dummy + 'b)` error[E0308]: mismatched types - --> $DIR/regions-trait-object-subtyping.rs:22:5 + --> $DIR/regions-trait-object-subtyping.rs:28:5 | LL | x | ^ lifetime mismatch @@ -53,12 +53,12 @@ LL | x = note: expected struct `Wrapper<&'b mut (dyn Dummy + 'b)>` found struct `Wrapper<&'a mut (dyn Dummy + 'a)>` note: the lifetime `'b` as defined here... - --> $DIR/regions-trait-object-subtyping.rs:20:15 + --> $DIR/regions-trait-object-subtyping.rs:26:15 | LL | fn foo4<'a:'b,'b>(x: Wrapper<&'a mut dyn Dummy>) -> Wrapper<&'b mut dyn Dummy> { | ^^ note: ...does not necessarily outlive the lifetime `'a` as defined here - --> $DIR/regions-trait-object-subtyping.rs:20:9 + --> $DIR/regions-trait-object-subtyping.rs:26:9 | LL | fn foo4<'a:'b,'b>(x: Wrapper<&'a mut dyn Dummy>) -> Wrapper<&'b mut dyn Dummy> { | ^^ diff --git a/src/test/ui/regions/regions-trait-object-subtyping.nll.stderr b/src/test/ui/regions/regions-trait-object-subtyping.nll.stderr index 1b3a116d508fa..c8cec3bd37797 100644 --- a/src/test/ui/regions/regions-trait-object-subtyping.nll.stderr +++ b/src/test/ui/regions/regions-trait-object-subtyping.nll.stderr @@ -1,5 +1,5 @@ error: lifetime may not live long enough - --> $DIR/regions-trait-object-subtyping.rs:15:5 + --> $DIR/regions-trait-object-subtyping.rs:19:5 | LL | fn foo3<'a,'b>(x: &'a mut dyn Dummy) -> &'b mut dyn Dummy { | -- -- lifetime `'b` defined here @@ -15,7 +15,7 @@ LL | x = help: see for more information about variance error: lifetime may not live long enough - --> $DIR/regions-trait-object-subtyping.rs:22:5 + --> $DIR/regions-trait-object-subtyping.rs:28:5 | LL | fn foo4<'a:'b,'b>(x: Wrapper<&'a mut dyn Dummy>) -> Wrapper<&'b mut dyn Dummy> { | -- -- lifetime `'b` defined here diff --git a/src/test/ui/regions/regions-trait-object-subtyping.rs b/src/test/ui/regions/regions-trait-object-subtyping.rs index 5b36194870ef6..f108fc81cea4f 100644 --- a/src/test/ui/regions/regions-trait-object-subtyping.rs +++ b/src/test/ui/regions/regions-trait-object-subtyping.rs @@ -1,3 +1,7 @@ +// revisions: base nll +// ignore-compare-mode-nll +//[nll] compile-flags: -Z borrowck=mir + trait Dummy { fn dummy(&self); } fn foo1<'a:'b,'b>(x: &'a mut (dyn Dummy+'a)) -> &'b mut (dyn Dummy+'b) { @@ -12,14 +16,18 @@ fn foo2<'a:'b,'b>(x: &'b mut (dyn Dummy+'a)) -> &'b mut (dyn Dummy+'b) { fn foo3<'a,'b>(x: &'a mut dyn Dummy) -> &'b mut dyn Dummy { // Without knowing 'a:'b, we can't coerce - x //~ ERROR lifetime bound not satisfied - //~^ ERROR cannot infer an appropriate lifetime + x + //[base]~^ ERROR lifetime bound not satisfied + //[base]~| ERROR cannot infer an appropriate lifetime + //[nll]~^^^ ERROR lifetime may not live long enough } struct Wrapper(T); fn foo4<'a:'b,'b>(x: Wrapper<&'a mut dyn Dummy>) -> Wrapper<&'b mut dyn Dummy> { // We can't coerce because it is packed in `Wrapper` - x //~ ERROR mismatched types + x + //[base]~^ ERROR mismatched types + //[nll]~^^ ERROR lifetime may not live long enough } fn main() {} diff --git a/src/test/ui/regions/regions-variance-contravariant-use-covariant-in-second-position.stderr b/src/test/ui/regions/regions-variance-contravariant-use-covariant-in-second-position.base.stderr similarity index 96% rename from src/test/ui/regions/regions-variance-contravariant-use-covariant-in-second-position.stderr rename to src/test/ui/regions/regions-variance-contravariant-use-covariant-in-second-position.base.stderr index 98f7a8136da91..23b3dea885d79 100644 --- a/src/test/ui/regions/regions-variance-contravariant-use-covariant-in-second-position.stderr +++ b/src/test/ui/regions/regions-variance-contravariant-use-covariant-in-second-position.base.stderr @@ -1,5 +1,5 @@ error[E0623]: lifetime mismatch - --> $DIR/regions-variance-contravariant-use-covariant-in-second-position.rs:25:30 + --> $DIR/regions-variance-contravariant-use-covariant-in-second-position.rs:29:30 | LL | fn use_<'short,'long>(c: S<'long, 'short>, | ---------------- this type is declared with multiple lifetimes... diff --git a/src/test/ui/regions/regions-variance-contravariant-use-covariant-in-second-position.nll.stderr b/src/test/ui/regions/regions-variance-contravariant-use-covariant-in-second-position.nll.stderr index 5352be430fbc5..f364f423f4ecf 100644 --- a/src/test/ui/regions/regions-variance-contravariant-use-covariant-in-second-position.nll.stderr +++ b/src/test/ui/regions/regions-variance-contravariant-use-covariant-in-second-position.nll.stderr @@ -1,5 +1,5 @@ error: lifetime may not live long enough - --> $DIR/regions-variance-contravariant-use-covariant-in-second-position.rs:25:12 + --> $DIR/regions-variance-contravariant-use-covariant-in-second-position.rs:29:12 | LL | fn use_<'short,'long>(c: S<'long, 'short>, | ------ ----- lifetime `'long` defined here diff --git a/src/test/ui/regions/regions-variance-contravariant-use-covariant-in-second-position.rs b/src/test/ui/regions/regions-variance-contravariant-use-covariant-in-second-position.rs index 8ddd041d45731..4bf32ec308247 100644 --- a/src/test/ui/regions/regions-variance-contravariant-use-covariant-in-second-position.rs +++ b/src/test/ui/regions/regions-variance-contravariant-use-covariant-in-second-position.rs @@ -4,6 +4,10 @@ // Note: see variance-regions-*.rs for the tests that check that the // variance inference works in the first place. +// revisions: base nll +// ignore-compare-mode-nll +//[nll] compile-flags: -Z borrowck=mir + // `S` is contravariant with respect to both parameters. struct S<'a, 'b> { f: &'a isize, @@ -22,7 +26,9 @@ fn use_<'short,'long>(c: S<'long, 'short>, // 'short <= 'long, this would be true if the Contravariant type were // covariant with respect to its parameter 'a. - let _: S<'long, 'long> = c; //~ ERROR E0623 + let _: S<'long, 'long> = c; + //[base]~^ ERROR E0623 + //[nll]~^^ ERROR lifetime may not live long enough } fn main() {} diff --git a/src/test/ui/regions/regions-variance-contravariant-use-covariant.stderr b/src/test/ui/regions/regions-variance-contravariant-use-covariant.base.stderr similarity index 89% rename from src/test/ui/regions/regions-variance-contravariant-use-covariant.stderr rename to src/test/ui/regions/regions-variance-contravariant-use-covariant.base.stderr index e7c106cbbe3d1..8eca0d4d12125 100644 --- a/src/test/ui/regions/regions-variance-contravariant-use-covariant.stderr +++ b/src/test/ui/regions/regions-variance-contravariant-use-covariant.base.stderr @@ -1,5 +1,5 @@ error[E0623]: lifetime mismatch - --> $DIR/regions-variance-contravariant-use-covariant.rs:23:35 + --> $DIR/regions-variance-contravariant-use-covariant.rs:27:35 | LL | fn use_<'short,'long>(c: Contravariant<'short>, | --------------------- these two types are declared with different lifetimes... diff --git a/src/test/ui/regions/regions-variance-contravariant-use-covariant.nll.stderr b/src/test/ui/regions/regions-variance-contravariant-use-covariant.nll.stderr index 22c9b915bb9ee..bc6dd6e69ed08 100644 --- a/src/test/ui/regions/regions-variance-contravariant-use-covariant.nll.stderr +++ b/src/test/ui/regions/regions-variance-contravariant-use-covariant.nll.stderr @@ -1,5 +1,5 @@ error: lifetime may not live long enough - --> $DIR/regions-variance-contravariant-use-covariant.rs:23:12 + --> $DIR/regions-variance-contravariant-use-covariant.rs:27:12 | LL | fn use_<'short,'long>(c: Contravariant<'short>, | ------ ----- lifetime `'long` defined here diff --git a/src/test/ui/regions/regions-variance-contravariant-use-covariant.rs b/src/test/ui/regions/regions-variance-contravariant-use-covariant.rs index cbdf62ecb613f..ea08a7092305e 100644 --- a/src/test/ui/regions/regions-variance-contravariant-use-covariant.rs +++ b/src/test/ui/regions/regions-variance-contravariant-use-covariant.rs @@ -4,6 +4,10 @@ // Note: see variance-regions-*.rs for the tests that check that the // variance inference works in the first place. +// revisions: base nll +// ignore-compare-mode-nll +//[nll] compile-flags: -Z borrowck=mir + // This is contravariant with respect to 'a, meaning that // Contravariant<'long> <: Contravariant<'short> iff // 'short <= 'long @@ -20,7 +24,9 @@ fn use_<'short,'long>(c: Contravariant<'short>, // 'short <= 'long, this would be true if the Contravariant type were // covariant with respect to its parameter 'a. - let _: Contravariant<'long> = c; //~ ERROR E0623 + let _: Contravariant<'long> = c; + //[base]~^ ERROR E0623 + //[nll]~^^ ERROR lifetime may not live long enough } fn main() {} diff --git a/src/test/ui/regions/regions-variance-covariant-use-contravariant.stderr b/src/test/ui/regions/regions-variance-covariant-use-contravariant.base.stderr similarity index 88% rename from src/test/ui/regions/regions-variance-covariant-use-contravariant.stderr rename to src/test/ui/regions/regions-variance-covariant-use-contravariant.base.stderr index e5e5261ba993f..565de38ee11df 100644 --- a/src/test/ui/regions/regions-variance-covariant-use-contravariant.stderr +++ b/src/test/ui/regions/regions-variance-covariant-use-contravariant.base.stderr @@ -1,5 +1,5 @@ error[E0623]: lifetime mismatch - --> $DIR/regions-variance-covariant-use-contravariant.rs:23:32 + --> $DIR/regions-variance-covariant-use-contravariant.rs:27:32 | LL | fn use_<'short,'long>(c: Covariant<'long>, | ---------------- diff --git a/src/test/ui/regions/regions-variance-covariant-use-contravariant.nll.stderr b/src/test/ui/regions/regions-variance-covariant-use-contravariant.nll.stderr index a07181ad553e6..9d3cebc9a4d56 100644 --- a/src/test/ui/regions/regions-variance-covariant-use-contravariant.nll.stderr +++ b/src/test/ui/regions/regions-variance-covariant-use-contravariant.nll.stderr @@ -1,5 +1,5 @@ error: lifetime may not live long enough - --> $DIR/regions-variance-covariant-use-contravariant.rs:23:12 + --> $DIR/regions-variance-covariant-use-contravariant.rs:27:12 | LL | fn use_<'short,'long>(c: Covariant<'long>, | ------ ----- lifetime `'long` defined here diff --git a/src/test/ui/regions/regions-variance-covariant-use-contravariant.rs b/src/test/ui/regions/regions-variance-covariant-use-contravariant.rs index 9aa0c81927197..748ad84840a07 100644 --- a/src/test/ui/regions/regions-variance-covariant-use-contravariant.rs +++ b/src/test/ui/regions/regions-variance-covariant-use-contravariant.rs @@ -4,6 +4,10 @@ // Note: see variance-regions-*.rs for the tests that check that the // variance inference works in the first place. +// revisions: base nll +// ignore-compare-mode-nll +//[nll] compile-flags: -Z borrowck=mir + // This is covariant with respect to 'a, meaning that // Covariant<'foo> <: Covariant<'static> because // 'foo <= 'static @@ -20,7 +24,9 @@ fn use_<'short,'long>(c: Covariant<'long>, // 'short <= 'long, this would be true if the Covariant type were // contravariant with respect to its parameter 'a. - let _: Covariant<'short> = c; //~ ERROR E0623 + let _: Covariant<'short> = c; + //[base]~^ ERROR E0623 + //[nll]~^^ ERROR lifetime may not live long enough } fn main() {} diff --git a/src/test/ui/regions/regions-variance-invariant-use-contravariant.stderr b/src/test/ui/regions/regions-variance-invariant-use-contravariant.base.stderr similarity index 88% rename from src/test/ui/regions/regions-variance-invariant-use-contravariant.stderr rename to src/test/ui/regions/regions-variance-invariant-use-contravariant.base.stderr index 2a2d5d019a129..e2e8958f53eca 100644 --- a/src/test/ui/regions/regions-variance-invariant-use-contravariant.stderr +++ b/src/test/ui/regions/regions-variance-invariant-use-contravariant.base.stderr @@ -1,5 +1,5 @@ error[E0623]: lifetime mismatch - --> $DIR/regions-variance-invariant-use-contravariant.rs:20:32 + --> $DIR/regions-variance-invariant-use-contravariant.rs:24:32 | LL | fn use_<'short,'long>(c: Invariant<'long>, | ---------------- diff --git a/src/test/ui/regions/regions-variance-invariant-use-contravariant.nll.stderr b/src/test/ui/regions/regions-variance-invariant-use-contravariant.nll.stderr index b35a2cb905dc3..b4ccb1693a753 100644 --- a/src/test/ui/regions/regions-variance-invariant-use-contravariant.nll.stderr +++ b/src/test/ui/regions/regions-variance-invariant-use-contravariant.nll.stderr @@ -1,5 +1,5 @@ error: lifetime may not live long enough - --> $DIR/regions-variance-invariant-use-contravariant.rs:20:12 + --> $DIR/regions-variance-invariant-use-contravariant.rs:24:12 | LL | fn use_<'short,'long>(c: Invariant<'long>, | ------ ----- lifetime `'long` defined here diff --git a/src/test/ui/regions/regions-variance-invariant-use-contravariant.rs b/src/test/ui/regions/regions-variance-invariant-use-contravariant.rs index 663b23b37d46a..788f9b1b4d0f3 100644 --- a/src/test/ui/regions/regions-variance-invariant-use-contravariant.rs +++ b/src/test/ui/regions/regions-variance-invariant-use-contravariant.rs @@ -4,6 +4,10 @@ // Note: see variance-regions-*.rs for the tests that check that the // variance inference works in the first place. +// revisions: base nll +// ignore-compare-mode-nll +//[nll] compile-flags: -Z borrowck=mir + struct Invariant<'a> { f: &'a mut &'a isize } @@ -17,7 +21,9 @@ fn use_<'short,'long>(c: Invariant<'long>, // 'short <= 'long, this would be true if the Invariant type were // contravariant with respect to its parameter 'a. - let _: Invariant<'short> = c; //~ ERROR E0623 + let _: Invariant<'short> = c; + //[base]~^ ERROR E0623 + //[nll]~^^ ERROR lifetime may not live long enough } fn main() { } diff --git a/src/test/ui/regions/regions-variance-invariant-use-covariant.stderr b/src/test/ui/regions/regions-variance-invariant-use-covariant.base.stderr similarity index 80% rename from src/test/ui/regions/regions-variance-invariant-use-covariant.stderr rename to src/test/ui/regions/regions-variance-invariant-use-covariant.base.stderr index 7801517595d33..da91db1b91862 100644 --- a/src/test/ui/regions/regions-variance-invariant-use-covariant.stderr +++ b/src/test/ui/regions/regions-variance-invariant-use-covariant.base.stderr @@ -1,5 +1,5 @@ error[E0308]: mismatched types - --> $DIR/regions-variance-invariant-use-covariant.rs:17:33 + --> $DIR/regions-variance-invariant-use-covariant.rs:21:33 | LL | let _: Invariant<'static> = c; | ^ lifetime mismatch @@ -7,7 +7,7 @@ LL | let _: Invariant<'static> = c; = note: expected struct `Invariant<'static>` found struct `Invariant<'b>` note: the lifetime `'b` as defined here... - --> $DIR/regions-variance-invariant-use-covariant.rs:11:9 + --> $DIR/regions-variance-invariant-use-covariant.rs:15:9 | LL | fn use_<'b>(c: Invariant<'b>) { | ^^ diff --git a/src/test/ui/regions/regions-variance-invariant-use-covariant.nll.stderr b/src/test/ui/regions/regions-variance-invariant-use-covariant.nll.stderr index 761e78d179e41..7b05c357589e9 100644 --- a/src/test/ui/regions/regions-variance-invariant-use-covariant.nll.stderr +++ b/src/test/ui/regions/regions-variance-invariant-use-covariant.nll.stderr @@ -1,5 +1,5 @@ error: lifetime may not live long enough - --> $DIR/regions-variance-invariant-use-covariant.rs:17:12 + --> $DIR/regions-variance-invariant-use-covariant.rs:21:12 | LL | fn use_<'b>(c: Invariant<'b>) { | -- lifetime `'b` defined here diff --git a/src/test/ui/regions/regions-variance-invariant-use-covariant.rs b/src/test/ui/regions/regions-variance-invariant-use-covariant.rs index 07482e6fd19e1..4b7da4493acff 100644 --- a/src/test/ui/regions/regions-variance-invariant-use-covariant.rs +++ b/src/test/ui/regions/regions-variance-invariant-use-covariant.rs @@ -4,6 +4,10 @@ // Note: see variance-regions-*.rs for the tests that check that the // variance inference works in the first place. +// revisions: base nll +// ignore-compare-mode-nll +//[nll] compile-flags: -Z borrowck=mir + struct Invariant<'a> { f: &'a mut &'a isize } @@ -14,7 +18,9 @@ fn use_<'b>(c: Invariant<'b>) { // Since 'b <= 'static, this would be true if Invariant were covariant // with respect to its parameter 'a. - let _: Invariant<'static> = c; //~ ERROR mismatched types + let _: Invariant<'static> = c; + //[base]~^ ERROR mismatched types [E0308] + //[nll]~^^ ERROR lifetime may not live long enough } fn main() { }