diff --git a/src/test/ui/nll/issue-50716.stderr b/src/test/ui/nll/issue-50716.base.stderr similarity index 88% rename from src/test/ui/nll/issue-50716.stderr rename to src/test/ui/nll/issue-50716.base.stderr index be68d252f32f0..0dcf06481427d 100644 --- a/src/test/ui/nll/issue-50716.stderr +++ b/src/test/ui/nll/issue-50716.base.stderr @@ -1,5 +1,5 @@ error[E0308]: mismatched types - --> $DIR/issue-50716.rs:14:9 + --> $DIR/issue-50716.rs:18:9 | LL | let _x = *s; | ^^ lifetime mismatch @@ -7,7 +7,7 @@ LL | let _x = *s; = note: expected type `<<&'a T as A>::X as Sized>` found type `<<&'static T as A>::X as Sized>` note: the lifetime `'a` as defined here... - --> $DIR/issue-50716.rs:9:8 + --> $DIR/issue-50716.rs:13:8 | LL | fn foo<'a, T: 'static>(s: Box<<&'a T as A>::X>) | ^^ diff --git a/src/test/ui/nll/issue-50716.nll.stderr b/src/test/ui/nll/issue-50716.nll.stderr index 38dd1b5f6fe73..a8f4d694ba7d1 100644 --- a/src/test/ui/nll/issue-50716.nll.stderr +++ b/src/test/ui/nll/issue-50716.nll.stderr @@ -1,5 +1,5 @@ error: lifetime may not live long enough - --> $DIR/issue-50716.rs:14:14 + --> $DIR/issue-50716.rs:18:14 | LL | fn foo<'a, T: 'static>(s: Box<<&'a T as A>::X>) | -- lifetime `'a` defined here diff --git a/src/test/ui/nll/issue-50716.rs b/src/test/ui/nll/issue-50716.rs index c2fc345fa2ba2..bd44d3eff9fc8 100644 --- a/src/test/ui/nll/issue-50716.rs +++ b/src/test/ui/nll/issue-50716.rs @@ -2,6 +2,10 @@ // Regression test for the issue #50716: NLL ignores lifetimes bounds // derived from `Sized` requirements +// revisions: base nll +// ignore-compare-mode-nll +//[nll] compile-flags: -Z borrowck=mir + trait A { type X: ?Sized; } diff --git a/src/test/ui/nll/issue-52742.stderr b/src/test/ui/nll/issue-52742.base.stderr similarity index 85% rename from src/test/ui/nll/issue-52742.stderr rename to src/test/ui/nll/issue-52742.base.stderr index 67bac14b6e4e1..259f378f70b5c 100644 --- a/src/test/ui/nll/issue-52742.stderr +++ b/src/test/ui/nll/issue-52742.base.stderr @@ -1,16 +1,16 @@ error[E0312]: lifetime of reference outlives lifetime of borrowed content... - --> $DIR/issue-52742.rs:12:18 + --> $DIR/issue-52742.rs:17:18 | LL | self.y = b.z | ^^^ | note: ...the reference is valid for the lifetime `'_` as defined here... - --> $DIR/issue-52742.rs:10:10 + --> $DIR/issue-52742.rs:15:10 | LL | impl Foo<'_, '_> { | ^^ note: ...but the borrowed content is only valid for the anonymous lifetime defined here - --> $DIR/issue-52742.rs:11:31 + --> $DIR/issue-52742.rs:16:31 | LL | fn take_bar(&mut self, b: Bar<'_>) { | ^^^^^^^ diff --git a/src/test/ui/nll/issue-52742.nll.stderr b/src/test/ui/nll/issue-52742.nll.stderr index 0f6d6cd4fa180..6828418a78ec1 100644 --- a/src/test/ui/nll/issue-52742.nll.stderr +++ b/src/test/ui/nll/issue-52742.nll.stderr @@ -1,5 +1,5 @@ error: lifetime may not live long enough - --> $DIR/issue-52742.rs:12:9 + --> $DIR/issue-52742.rs:17:9 | LL | fn take_bar(&mut self, b: Bar<'_>) { | --------- -- let's call this `'1` diff --git a/src/test/ui/nll/issue-52742.rs b/src/test/ui/nll/issue-52742.rs index d3e201b8ae8e7..5ec5770c5c206 100644 --- a/src/test/ui/nll/issue-52742.rs +++ b/src/test/ui/nll/issue-52742.rs @@ -1,3 +1,8 @@ +// revisions: base nll +// ignore-compare-mode-nll +//[nll] compile-flags: -Z borrowck=mir + + struct Foo<'a, 'b> { x: &'a u32, y: &'b u32, diff --git a/src/test/ui/nll/issue-55394.stderr b/src/test/ui/nll/issue-55394.base.stderr similarity index 83% rename from src/test/ui/nll/issue-55394.stderr rename to src/test/ui/nll/issue-55394.base.stderr index 197f8dfa2abe7..cc87954732c4e 100644 --- a/src/test/ui/nll/issue-55394.stderr +++ b/src/test/ui/nll/issue-55394.base.stderr @@ -1,26 +1,26 @@ error[E0495]: cannot infer an appropriate lifetime for lifetime parameter `'s` due to conflicting requirements - --> $DIR/issue-55394.rs:9:9 + --> $DIR/issue-55394.rs:13:9 | LL | Foo { bar } | ^^^ | note: first, the lifetime cannot outlive the anonymous lifetime defined here... - --> $DIR/issue-55394.rs:8:17 + --> $DIR/issue-55394.rs:12:17 | LL | fn new(bar: &mut Bar) -> Self { | ^^^^^^^^ note: ...so that reference does not outlive borrowed content - --> $DIR/issue-55394.rs:9:15 + --> $DIR/issue-55394.rs:13:15 | LL | Foo { bar } | ^^^ note: but, the lifetime must be valid for the lifetime `'_` as defined here... - --> $DIR/issue-55394.rs:7:10 + --> $DIR/issue-55394.rs:11:10 | LL | impl Foo<'_> { | ^^ note: ...so that the types are compatible - --> $DIR/issue-55394.rs:9:9 + --> $DIR/issue-55394.rs:13:9 | LL | Foo { bar } | ^^^^^^^^^^^ diff --git a/src/test/ui/nll/issue-55394.nll.stderr b/src/test/ui/nll/issue-55394.nll.stderr index 24b8c84b4a96a..c166c458c5013 100644 --- a/src/test/ui/nll/issue-55394.nll.stderr +++ b/src/test/ui/nll/issue-55394.nll.stderr @@ -1,5 +1,5 @@ error: lifetime may not live long enough - --> $DIR/issue-55394.rs:9:9 + --> $DIR/issue-55394.rs:13:9 | LL | fn new(bar: &mut Bar) -> Self { | - ---- return type is Foo<'2> diff --git a/src/test/ui/nll/issue-55394.rs b/src/test/ui/nll/issue-55394.rs index f813d1c915cf6..9c4fcdf641909 100644 --- a/src/test/ui/nll/issue-55394.rs +++ b/src/test/ui/nll/issue-55394.rs @@ -1,3 +1,7 @@ +// revisions: base nll +// ignore-compare-mode-nll +//[nll] compile-flags: -Z borrowck=mir + struct Bar; struct Foo<'s> { diff --git a/src/test/ui/nll/issue-55401.stderr b/src/test/ui/nll/issue-55401.base.stderr similarity index 89% rename from src/test/ui/nll/issue-55401.stderr rename to src/test/ui/nll/issue-55401.base.stderr index 55c51d532e779..d4e9f2b4154ef 100644 --- a/src/test/ui/nll/issue-55401.stderr +++ b/src/test/ui/nll/issue-55401.base.stderr @@ -1,12 +1,12 @@ error[E0312]: lifetime of reference outlives lifetime of borrowed content... - --> $DIR/issue-55401.rs:3:5 + --> $DIR/issue-55401.rs:7:5 | LL | *y | ^^ | = 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/issue-55401.rs:1:47 + --> $DIR/issue-55401.rs:5:47 | LL | fn static_to_a_to_static_through_ref_in_tuple<'a>(x: &'a u32) -> &'static u32 { | ^^ diff --git a/src/test/ui/nll/issue-55401.nll.stderr b/src/test/ui/nll/issue-55401.nll.stderr index 4f797f26a1a7c..1318dc6765714 100644 --- a/src/test/ui/nll/issue-55401.nll.stderr +++ b/src/test/ui/nll/issue-55401.nll.stderr @@ -1,5 +1,5 @@ error: lifetime may not live long enough - --> $DIR/issue-55401.rs:3:5 + --> $DIR/issue-55401.rs:7:5 | LL | fn static_to_a_to_static_through_ref_in_tuple<'a>(x: &'a u32) -> &'static u32 { | -- lifetime `'a` defined here diff --git a/src/test/ui/nll/issue-55401.rs b/src/test/ui/nll/issue-55401.rs index fc45824e903c8..10f38c53dfdc7 100644 --- a/src/test/ui/nll/issue-55401.rs +++ b/src/test/ui/nll/issue-55401.rs @@ -1,3 +1,7 @@ +// revisions: base nll +// ignore-compare-mode-nll +//[nll] compile-flags: -Z borrowck=mir + fn static_to_a_to_static_through_ref_in_tuple<'a>(x: &'a u32) -> &'static u32 { let (ref y, _z): (&'a u32, u32) = (&22, 44); *y //~ ERROR diff --git a/src/test/ui/nll/lub-if.stderr b/src/test/ui/nll/lub-if.base.stderr similarity index 88% rename from src/test/ui/nll/lub-if.stderr rename to src/test/ui/nll/lub-if.base.stderr index a12c48582c79e..ea9f5d4b2b1aa 100644 --- a/src/test/ui/nll/lub-if.stderr +++ b/src/test/ui/nll/lub-if.base.stderr @@ -1,25 +1,25 @@ error[E0312]: lifetime of reference outlives lifetime of borrowed content... - --> $DIR/lub-if.rs:28:9 + --> $DIR/lub-if.rs:32:9 | LL | s | ^ | = 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/lub-if.rs:23:17 + --> $DIR/lub-if.rs:27:17 | LL | pub fn opt_str2<'a>(maybestr: &'a Option) -> &'static str { | ^^ error[E0312]: lifetime of reference outlives lifetime of borrowed content... - --> $DIR/lub-if.rs:35:9 + --> $DIR/lub-if.rs:41:9 | LL | s | ^ | = 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/lub-if.rs:32:17 + --> $DIR/lub-if.rs:38:17 | LL | pub fn opt_str3<'a>(maybestr: &'a Option) -> &'static str { | ^^ diff --git a/src/test/ui/nll/lub-if.nll.stderr b/src/test/ui/nll/lub-if.nll.stderr index 832688f5162b3..2fd6e69628d47 100644 --- a/src/test/ui/nll/lub-if.nll.stderr +++ b/src/test/ui/nll/lub-if.nll.stderr @@ -1,5 +1,5 @@ error: lifetime may not live long enough - --> $DIR/lub-if.rs:28:9 + --> $DIR/lub-if.rs:32:9 | LL | pub fn opt_str2<'a>(maybestr: &'a Option) -> &'static str { | -- lifetime `'a` defined here @@ -8,7 +8,7 @@ LL | s | ^ returning this value requires that `'a` must outlive `'static` error: lifetime may not live long enough - --> $DIR/lub-if.rs:35:9 + --> $DIR/lub-if.rs:41:9 | LL | pub fn opt_str3<'a>(maybestr: &'a Option) -> &'static str { | -- lifetime `'a` defined here diff --git a/src/test/ui/nll/lub-if.rs b/src/test/ui/nll/lub-if.rs index 132b83810ead7..18561d63935e7 100644 --- a/src/test/ui/nll/lub-if.rs +++ b/src/test/ui/nll/lub-if.rs @@ -2,6 +2,10 @@ // of the various arms, particularly in the case where regions are // involved. +// revisions: base nll +// ignore-compare-mode-nll +//[nll] compile-flags: -Z borrowck=mir + pub fn opt_str0<'a>(maybestr: &'a Option) -> &'a str { if maybestr.is_none() { "(none)" @@ -25,14 +29,18 @@ pub fn opt_str2<'a>(maybestr: &'a Option) -> &'static str { "(none)" } else { let s: &'a str = maybestr.as_ref().unwrap(); - s //~ ERROR E0312 + s + //[base]~^ ERROR E0312 + //[nll]~^^ ERROR lifetime may not live long enough } } pub fn opt_str3<'a>(maybestr: &'a Option) -> &'static str { if maybestr.is_some() { let s: &'a str = maybestr.as_ref().unwrap(); - s //~ ERROR E0312 + s + //[base]~^ ERROR E0312 + //[nll]~^^ ERROR lifetime may not live long enough } else { "(none)" } diff --git a/src/test/ui/nll/lub-match.stderr b/src/test/ui/nll/lub-match.base.stderr similarity index 87% rename from src/test/ui/nll/lub-match.stderr rename to src/test/ui/nll/lub-match.base.stderr index 04d50f5ebf471..38952133160ed 100644 --- a/src/test/ui/nll/lub-match.stderr +++ b/src/test/ui/nll/lub-match.base.stderr @@ -1,25 +1,25 @@ error[E0312]: lifetime of reference outlives lifetime of borrowed content... - --> $DIR/lub-match.rs:30:13 + --> $DIR/lub-match.rs:34:13 | LL | s | ^ | = 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/lub-match.rs:25:17 + --> $DIR/lub-match.rs:29:17 | LL | pub fn opt_str2<'a>(maybestr: &'a Option) -> &'static str { | ^^ error[E0312]: lifetime of reference outlives lifetime of borrowed content... - --> $DIR/lub-match.rs:39:13 + --> $DIR/lub-match.rs:45:13 | LL | s | ^ | = 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/lub-match.rs:35:17 + --> $DIR/lub-match.rs:41:17 | LL | pub fn opt_str3<'a>(maybestr: &'a Option) -> &'static str { | ^^ diff --git a/src/test/ui/nll/lub-match.nll.stderr b/src/test/ui/nll/lub-match.nll.stderr index 3a344a77d2c2d..c78d0cb641dc8 100644 --- a/src/test/ui/nll/lub-match.nll.stderr +++ b/src/test/ui/nll/lub-match.nll.stderr @@ -1,5 +1,5 @@ error: lifetime may not live long enough - --> $DIR/lub-match.rs:30:13 + --> $DIR/lub-match.rs:34:13 | LL | pub fn opt_str2<'a>(maybestr: &'a Option) -> &'static str { | -- lifetime `'a` defined here @@ -8,7 +8,7 @@ LL | s | ^ returning this value requires that `'a` must outlive `'static` error: lifetime may not live long enough - --> $DIR/lub-match.rs:39:13 + --> $DIR/lub-match.rs:45:13 | LL | pub fn opt_str3<'a>(maybestr: &'a Option) -> &'static str { | -- lifetime `'a` defined here diff --git a/src/test/ui/nll/lub-match.rs b/src/test/ui/nll/lub-match.rs index 1cd4a02a3ef55..084d8b95f5893 100644 --- a/src/test/ui/nll/lub-match.rs +++ b/src/test/ui/nll/lub-match.rs @@ -2,6 +2,10 @@ // of the various arms, particularly in the case where regions are // involved. +// revisions: base nll +// ignore-compare-mode-nll +//[nll] compile-flags: -Z borrowck=mir + pub fn opt_str0<'a>(maybestr: &'a Option) -> &'a str { match *maybestr { Some(ref s) => { @@ -27,7 +31,9 @@ pub fn opt_str2<'a>(maybestr: &'a Option) -> &'static str { None => "(none)", Some(ref s) => { let s: &'a str = s; - s //~ ERROR E0312 + s + //[base]~^ ERROR E0312 + //[nll]~^^ ERROR lifetime may not live long enough } } } @@ -36,7 +42,9 @@ pub fn opt_str3<'a>(maybestr: &'a Option) -> &'static str { match *maybestr { Some(ref s) => { let s: &'a str = s; - s //~ ERROR E0312 + s + //[base]~^ ERROR E0312 + //[nll]~^^ ERROR lifetime may not live long enough } None => "(none)", } diff --git a/src/test/ui/nll/type-alias-free-regions.stderr b/src/test/ui/nll/type-alias-free-regions.base.stderr similarity index 79% rename from src/test/ui/nll/type-alias-free-regions.stderr rename to src/test/ui/nll/type-alias-free-regions.base.stderr index 71f5f8fb17668..010535fec6dd4 100644 --- a/src/test/ui/nll/type-alias-free-regions.stderr +++ b/src/test/ui/nll/type-alias-free-regions.base.stderr @@ -1,28 +1,28 @@ error[E0495]: cannot infer an appropriate lifetime for lifetime parameter `'a` due to conflicting requirements - --> $DIR/type-alias-free-regions.rs:17:9 + --> $DIR/type-alias-free-regions.rs:21:9 | LL | C { f: b } | ^ | note: first, the lifetime cannot outlive the anonymous lifetime defined here... - --> $DIR/type-alias-free-regions.rs:16:24 + --> $DIR/type-alias-free-regions.rs:20:24 | LL | fn from_box(b: Box) -> Self { | ^ note: ...so that the expression is assignable - --> $DIR/type-alias-free-regions.rs:17:16 + --> $DIR/type-alias-free-regions.rs:21:16 | LL | C { f: b } | ^ = note: expected `Box>` found `Box>` note: but, the lifetime must be valid for the lifetime `'a` as defined here... - --> $DIR/type-alias-free-regions.rs:15:6 + --> $DIR/type-alias-free-regions.rs:19:6 | LL | impl<'a> FromBox<'a> for C<'a> { | ^^ note: ...so that the types are compatible - --> $DIR/type-alias-free-regions.rs:17:9 + --> $DIR/type-alias-free-regions.rs:21:9 | LL | C { f: b } | ^^^^^^^^^^ @@ -30,30 +30,30 @@ LL | C { f: b } found `C<'_>` error[E0495]: cannot infer an appropriate lifetime due to conflicting requirements - --> $DIR/type-alias-free-regions.rs:27:16 + --> $DIR/type-alias-free-regions.rs:31:16 | LL | C { f: Box::new(b.0) } | ^^^^^^^^^^^^^ | note: first, the lifetime cannot outlive the anonymous lifetime defined here... - --> $DIR/type-alias-free-regions.rs:26:23 + --> $DIR/type-alias-free-regions.rs:30:23 | LL | fn from_tuple(b: (B,)) -> Self { | ^ note: ...so that the expression is assignable - --> $DIR/type-alias-free-regions.rs:27:25 + --> $DIR/type-alias-free-regions.rs:31:25 | LL | C { f: Box::new(b.0) } | ^^^ = note: expected `Box<&isize>` found `Box<&isize>` note: but, the lifetime must be valid for the lifetime `'a` as defined here... - --> $DIR/type-alias-free-regions.rs:25:6 + --> $DIR/type-alias-free-regions.rs:29:6 | LL | impl<'a> FromTuple<'a> for C<'a> { | ^^ note: ...so that the types are compatible - --> $DIR/type-alias-free-regions.rs:27:9 + --> $DIR/type-alias-free-regions.rs:31:9 | LL | C { f: Box::new(b.0) } | ^^^^^^^^^^^^^^^^^^^^^^ diff --git a/src/test/ui/nll/type-alias-free-regions.nll.stderr b/src/test/ui/nll/type-alias-free-regions.nll.stderr index 45fd5a2f1d657..6b746602d7ffd 100644 --- a/src/test/ui/nll/type-alias-free-regions.nll.stderr +++ b/src/test/ui/nll/type-alias-free-regions.nll.stderr @@ -1,5 +1,5 @@ error: lifetime may not live long enough - --> $DIR/type-alias-free-regions.rs:17:9 + --> $DIR/type-alias-free-regions.rs:21:9 | LL | impl<'a> FromBox<'a> for C<'a> { | -- lifetime `'a` defined here @@ -9,7 +9,7 @@ LL | C { f: b } | ^^^^^^^^^^ associated function was supposed to return data with lifetime `'a` but it is returning data with lifetime `'1` error: lifetime may not live long enough - --> $DIR/type-alias-free-regions.rs:27:9 + --> $DIR/type-alias-free-regions.rs:31:9 | LL | impl<'a> FromTuple<'a> for C<'a> { | -- lifetime `'a` defined here diff --git a/src/test/ui/nll/type-alias-free-regions.rs b/src/test/ui/nll/type-alias-free-regions.rs index fd5566f35d514..59ef034493770 100644 --- a/src/test/ui/nll/type-alias-free-regions.rs +++ b/src/test/ui/nll/type-alias-free-regions.rs @@ -1,6 +1,10 @@ // Test that we don't assume that type aliases have the same type parameters // as the type they alias and then panic when we see this. +// revisions: base nll +// ignore-compare-mode-nll +//[nll] compile-flags: -Z borrowck=mir + type A<'a> = &'a isize; type B<'a> = Box>; diff --git a/src/test/ui/nll/user-annotations/constant-in-expr-inherent-1.stderr b/src/test/ui/nll/user-annotations/constant-in-expr-inherent-1.base.stderr similarity index 90% rename from src/test/ui/nll/user-annotations/constant-in-expr-inherent-1.stderr rename to src/test/ui/nll/user-annotations/constant-in-expr-inherent-1.base.stderr index 4a6378b84f1e6..ba17994b43766 100644 --- a/src/test/ui/nll/user-annotations/constant-in-expr-inherent-1.stderr +++ b/src/test/ui/nll/user-annotations/constant-in-expr-inherent-1.base.stderr @@ -1,5 +1,5 @@ error[E0759]: `fn` parameter has lifetime `'a` but it needs to satisfy a `'static` lifetime requirement - --> $DIR/constant-in-expr-inherent-1.rs:8:5 + --> $DIR/constant-in-expr-inherent-1.rs:12:5 | LL | fn foo<'a>(_: &'a u32) -> &'static u32 { | ------- this data with lifetime `'a`... diff --git a/src/test/ui/nll/user-annotations/constant-in-expr-inherent-1.nll.stderr b/src/test/ui/nll/user-annotations/constant-in-expr-inherent-1.nll.stderr index c39301588acfa..0399d5f893d85 100644 --- a/src/test/ui/nll/user-annotations/constant-in-expr-inherent-1.nll.stderr +++ b/src/test/ui/nll/user-annotations/constant-in-expr-inherent-1.nll.stderr @@ -1,5 +1,5 @@ error: lifetime may not live long enough - --> $DIR/constant-in-expr-inherent-1.rs:8:5 + --> $DIR/constant-in-expr-inherent-1.rs:12:5 | LL | fn foo<'a>(_: &'a u32) -> &'static u32 { | -- lifetime `'a` defined here diff --git a/src/test/ui/nll/user-annotations/constant-in-expr-inherent-1.rs b/src/test/ui/nll/user-annotations/constant-in-expr-inherent-1.rs index e3a8a5f58dfda..0bd316aa84cfe 100644 --- a/src/test/ui/nll/user-annotations/constant-in-expr-inherent-1.rs +++ b/src/test/ui/nll/user-annotations/constant-in-expr-inherent-1.rs @@ -1,3 +1,7 @@ +// revisions: base nll +// ignore-compare-mode-nll +//[nll] compile-flags: -Z borrowck=mir + struct Foo<'a> { x: &'a u32 } impl<'a> Foo<'a> { diff --git a/src/test/ui/nll/user-annotations/constant-in-expr-normalize.stderr b/src/test/ui/nll/user-annotations/constant-in-expr-normalize.base.stderr similarity index 83% rename from src/test/ui/nll/user-annotations/constant-in-expr-normalize.stderr rename to src/test/ui/nll/user-annotations/constant-in-expr-normalize.base.stderr index d33c458421406..61efa879fc04b 100644 --- a/src/test/ui/nll/user-annotations/constant-in-expr-normalize.stderr +++ b/src/test/ui/nll/user-annotations/constant-in-expr-normalize.base.stderr @@ -1,12 +1,12 @@ error[E0312]: lifetime of reference outlives lifetime of borrowed content... - --> $DIR/constant-in-expr-normalize.rs:18:5 + --> $DIR/constant-in-expr-normalize.rs:22:5 | LL | <() as Foo<'a>>::C | ^^^^^^^^^^^^^^^^^^ | = 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/constant-in-expr-normalize.rs:17:8 + --> $DIR/constant-in-expr-normalize.rs:21:8 | LL | fn foo<'a>(_: &'a u32) -> &'static u32 { | ^^ diff --git a/src/test/ui/nll/user-annotations/constant-in-expr-normalize.nll.stderr b/src/test/ui/nll/user-annotations/constant-in-expr-normalize.nll.stderr index 541a2cfaf299a..4c1e6bee2aa0d 100644 --- a/src/test/ui/nll/user-annotations/constant-in-expr-normalize.nll.stderr +++ b/src/test/ui/nll/user-annotations/constant-in-expr-normalize.nll.stderr @@ -1,5 +1,5 @@ error: lifetime may not live long enough - --> $DIR/constant-in-expr-normalize.rs:18:5 + --> $DIR/constant-in-expr-normalize.rs:22:5 | LL | fn foo<'a>(_: &'a u32) -> &'static u32 { | -- lifetime `'a` defined here diff --git a/src/test/ui/nll/user-annotations/constant-in-expr-normalize.rs b/src/test/ui/nll/user-annotations/constant-in-expr-normalize.rs index b7095430d8bd2..262f0ae318f8e 100644 --- a/src/test/ui/nll/user-annotations/constant-in-expr-normalize.rs +++ b/src/test/ui/nll/user-annotations/constant-in-expr-normalize.rs @@ -1,3 +1,7 @@ +// revisions: base nll +// ignore-compare-mode-nll +//[nll] compile-flags: -Z borrowck=mir + trait Mirror { type Me; } diff --git a/src/test/ui/nll/user-annotations/constant-in-expr-trait-item-1.stderr b/src/test/ui/nll/user-annotations/constant-in-expr-trait-item-1.base.stderr similarity index 82% rename from src/test/ui/nll/user-annotations/constant-in-expr-trait-item-1.stderr rename to src/test/ui/nll/user-annotations/constant-in-expr-trait-item-1.base.stderr index 3ec3a2af8cab3..93f7156e55757 100644 --- a/src/test/ui/nll/user-annotations/constant-in-expr-trait-item-1.stderr +++ b/src/test/ui/nll/user-annotations/constant-in-expr-trait-item-1.base.stderr @@ -1,12 +1,12 @@ error[E0312]: lifetime of reference outlives lifetime of borrowed content... - --> $DIR/constant-in-expr-trait-item-1.rs:10:5 + --> $DIR/constant-in-expr-trait-item-1.rs:14:5 | LL | <() as Foo<'a>>::C | ^^^^^^^^^^^^^^^^^^ | = 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/constant-in-expr-trait-item-1.rs:9:8 + --> $DIR/constant-in-expr-trait-item-1.rs:13:8 | LL | fn foo<'a>(_: &'a u32) -> &'static u32 { | ^^ diff --git a/src/test/ui/nll/user-annotations/constant-in-expr-trait-item-1.nll.stderr b/src/test/ui/nll/user-annotations/constant-in-expr-trait-item-1.nll.stderr index ea0fcb6d634cd..990d0ae385fc1 100644 --- a/src/test/ui/nll/user-annotations/constant-in-expr-trait-item-1.nll.stderr +++ b/src/test/ui/nll/user-annotations/constant-in-expr-trait-item-1.nll.stderr @@ -1,5 +1,5 @@ error: lifetime may not live long enough - --> $DIR/constant-in-expr-trait-item-1.rs:10:5 + --> $DIR/constant-in-expr-trait-item-1.rs:14:5 | LL | fn foo<'a>(_: &'a u32) -> &'static u32 { | -- lifetime `'a` defined here diff --git a/src/test/ui/nll/user-annotations/constant-in-expr-trait-item-1.rs b/src/test/ui/nll/user-annotations/constant-in-expr-trait-item-1.rs index e0400b2cc0267..512edb501c4ea 100644 --- a/src/test/ui/nll/user-annotations/constant-in-expr-trait-item-1.rs +++ b/src/test/ui/nll/user-annotations/constant-in-expr-trait-item-1.rs @@ -1,3 +1,7 @@ +// revisions: base nll +// ignore-compare-mode-nll +//[nll] compile-flags: -Z borrowck=mir + trait Foo<'a> { const C: &'a u32; } diff --git a/src/test/ui/nll/user-annotations/constant-in-expr-trait-item-2.stderr b/src/test/ui/nll/user-annotations/constant-in-expr-trait-item-2.base.stderr similarity index 82% rename from src/test/ui/nll/user-annotations/constant-in-expr-trait-item-2.stderr rename to src/test/ui/nll/user-annotations/constant-in-expr-trait-item-2.base.stderr index b36bc3bdd9cdb..f43ade38937d3 100644 --- a/src/test/ui/nll/user-annotations/constant-in-expr-trait-item-2.stderr +++ b/src/test/ui/nll/user-annotations/constant-in-expr-trait-item-2.base.stderr @@ -1,12 +1,12 @@ error[E0312]: lifetime of reference outlives lifetime of borrowed content... - --> $DIR/constant-in-expr-trait-item-2.rs:10:5 + --> $DIR/constant-in-expr-trait-item-2.rs:14:5 | LL | >::C | ^^^^^^^^^^^^^^^^^ | = 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/constant-in-expr-trait-item-2.rs:9:8 + --> $DIR/constant-in-expr-trait-item-2.rs:13:8 | LL | fn foo<'a, T: Foo<'a>>() -> &'static u32 { | ^^ diff --git a/src/test/ui/nll/user-annotations/constant-in-expr-trait-item-2.nll.stderr b/src/test/ui/nll/user-annotations/constant-in-expr-trait-item-2.nll.stderr index ff549f1d88bd4..8c0430f1e092c 100644 --- a/src/test/ui/nll/user-annotations/constant-in-expr-trait-item-2.nll.stderr +++ b/src/test/ui/nll/user-annotations/constant-in-expr-trait-item-2.nll.stderr @@ -1,5 +1,5 @@ error: lifetime may not live long enough - --> $DIR/constant-in-expr-trait-item-2.rs:10:5 + --> $DIR/constant-in-expr-trait-item-2.rs:14:5 | LL | fn foo<'a, T: Foo<'a>>() -> &'static u32 { | -- lifetime `'a` defined here diff --git a/src/test/ui/nll/user-annotations/constant-in-expr-trait-item-2.rs b/src/test/ui/nll/user-annotations/constant-in-expr-trait-item-2.rs index 73c4e577b05c0..b3dfbd984ebbf 100644 --- a/src/test/ui/nll/user-annotations/constant-in-expr-trait-item-2.rs +++ b/src/test/ui/nll/user-annotations/constant-in-expr-trait-item-2.rs @@ -1,3 +1,7 @@ +// revisions: base nll +// ignore-compare-mode-nll +//[nll] compile-flags: -Z borrowck=mir + trait Foo<'a> { const C: &'a u32; } diff --git a/src/test/ui/nll/user-annotations/constant-in-expr-trait-item-3.stderr b/src/test/ui/nll/user-annotations/constant-in-expr-trait-item-3.base.stderr similarity index 78% rename from src/test/ui/nll/user-annotations/constant-in-expr-trait-item-3.stderr rename to src/test/ui/nll/user-annotations/constant-in-expr-trait-item-3.base.stderr index 806492b71f449..e9393aa05ab39 100644 --- a/src/test/ui/nll/user-annotations/constant-in-expr-trait-item-3.stderr +++ b/src/test/ui/nll/user-annotations/constant-in-expr-trait-item-3.base.stderr @@ -1,16 +1,16 @@ error[E0495]: cannot infer an appropriate lifetime for lifetime parameter `'a` due to conflicting requirements - --> $DIR/constant-in-expr-trait-item-3.rs:10:5 + --> $DIR/constant-in-expr-trait-item-3.rs:14:5 | LL | T::C | ^^^^ | note: first, the lifetime cannot outlive the lifetime `'a` as defined here... - --> $DIR/constant-in-expr-trait-item-3.rs:9:8 + --> $DIR/constant-in-expr-trait-item-3.rs:13:8 | LL | fn foo<'a, T: Foo<'a>>() -> &'static u32 { | ^^ note: ...so that the types are compatible - --> $DIR/constant-in-expr-trait-item-3.rs:10:5 + --> $DIR/constant-in-expr-trait-item-3.rs:14:5 | LL | T::C | ^^^^ @@ -18,7 +18,7 @@ LL | T::C found `Foo<'a>` = note: but, the lifetime must be valid for the static lifetime... note: ...so that reference does not outlive borrowed content - --> $DIR/constant-in-expr-trait-item-3.rs:10:5 + --> $DIR/constant-in-expr-trait-item-3.rs:14:5 | LL | T::C | ^^^^ diff --git a/src/test/ui/nll/user-annotations/constant-in-expr-trait-item-3.nll.stderr b/src/test/ui/nll/user-annotations/constant-in-expr-trait-item-3.nll.stderr index 7f160d8e398b9..cbcaf042f0539 100644 --- a/src/test/ui/nll/user-annotations/constant-in-expr-trait-item-3.nll.stderr +++ b/src/test/ui/nll/user-annotations/constant-in-expr-trait-item-3.nll.stderr @@ -1,5 +1,5 @@ error: lifetime may not live long enough - --> $DIR/constant-in-expr-trait-item-3.rs:10:5 + --> $DIR/constant-in-expr-trait-item-3.rs:14:5 | LL | fn foo<'a, T: Foo<'a>>() -> &'static u32 { | -- lifetime `'a` defined here diff --git a/src/test/ui/nll/user-annotations/constant-in-expr-trait-item-3.rs b/src/test/ui/nll/user-annotations/constant-in-expr-trait-item-3.rs index 567e31ef93632..6e78d94c2f63a 100644 --- a/src/test/ui/nll/user-annotations/constant-in-expr-trait-item-3.rs +++ b/src/test/ui/nll/user-annotations/constant-in-expr-trait-item-3.rs @@ -1,3 +1,7 @@ +// revisions: base nll +// ignore-compare-mode-nll +//[nll] compile-flags: -Z borrowck=mir + trait Foo<'a> { const C: &'a u32; } diff --git a/src/test/ui/rfc1623.stderr b/src/test/ui/rfc1623.base.stderr similarity index 93% rename from src/test/ui/rfc1623.stderr rename to src/test/ui/rfc1623.base.stderr index 16829b5caa0b6..6d389a1317a9f 100644 --- a/src/test/ui/rfc1623.stderr +++ b/src/test/ui/rfc1623.base.stderr @@ -1,5 +1,5 @@ error: implementation of `FnOnce` is not general enough - --> $DIR/rfc1623.rs:28:8 + --> $DIR/rfc1623.rs:36:8 | LL | f: &id, | ^^^ implementation of `FnOnce` is not general enough diff --git a/src/test/ui/rfc1623.nll.stderr b/src/test/ui/rfc1623.nll.stderr index 86513b6064d2d..f85b6ff8ff75b 100644 --- a/src/test/ui/rfc1623.nll.stderr +++ b/src/test/ui/rfc1623.nll.stderr @@ -1,11 +1,12 @@ error[E0308]: mismatched types - --> $DIR/rfc1623.rs:25:35 + --> $DIR/rfc1623.rs:29:35 | LL | static SOME_STRUCT: &SomeStruct = &SomeStruct { | ___________________________________^ -LL | | foo: &Foo { bools: &[false, true] }, -LL | | bar: &Bar { bools: &[true, true] }, -LL | | f: &id, +LL | | +LL | | +LL | | +... | LL | | LL | | }; | |_^ one type is more general than the other @@ -14,13 +15,14 @@ LL | | }; found type `Fn<(&Foo<'_>,)>` error[E0308]: mismatched types - --> $DIR/rfc1623.rs:25:35 + --> $DIR/rfc1623.rs:29:35 | LL | static SOME_STRUCT: &SomeStruct = &SomeStruct { | ___________________________________^ -LL | | foo: &Foo { bools: &[false, true] }, -LL | | bar: &Bar { bools: &[true, true] }, -LL | | f: &id, +LL | | +LL | | +LL | | +... | LL | | LL | | }; | |_^ one type is more general than the other @@ -29,13 +31,14 @@ LL | | }; found type `Fn<(&Foo<'_>,)>` error: implementation of `FnOnce` is not general enough - --> $DIR/rfc1623.rs:25:35 + --> $DIR/rfc1623.rs:29:35 | LL | static SOME_STRUCT: &SomeStruct = &SomeStruct { | ___________________________________^ -LL | | foo: &Foo { bools: &[false, true] }, -LL | | bar: &Bar { bools: &[true, true] }, -LL | | f: &id, +LL | | +LL | | +LL | | +... | LL | | LL | | }; | |_^ implementation of `FnOnce` is not general enough @@ -44,13 +47,14 @@ LL | | }; = note: ...but it actually implements `FnOnce<(&'2 Foo<'_>,)>`, for some specific lifetime `'2` error: implementation of `FnOnce` is not general enough - --> $DIR/rfc1623.rs:25:35 + --> $DIR/rfc1623.rs:29:35 | LL | static SOME_STRUCT: &SomeStruct = &SomeStruct { | ___________________________________^ -LL | | foo: &Foo { bools: &[false, true] }, -LL | | bar: &Bar { bools: &[true, true] }, -LL | | f: &id, +LL | | +LL | | +LL | | +... | LL | | LL | | }; | |_^ implementation of `FnOnce` is not general enough diff --git a/src/test/ui/rfc1623.rs b/src/test/ui/rfc1623.rs index 32e00f9cb76c3..0e9d214032425 100644 --- a/src/test/ui/rfc1623.rs +++ b/src/test/ui/rfc1623.rs @@ -1,3 +1,7 @@ +// revisions: base nll +// ignore-compare-mode-nll +//[nll] compile-flags: -Z borrowck=mir + #![allow(dead_code)] fn non_elidable<'a, 'b>(a: &'a u8, b: &'b u8) -> &'a u8 { @@ -23,10 +27,14 @@ fn id(t: T) -> T { } static SOME_STRUCT: &SomeStruct = &SomeStruct { + //[nll]~^ ERROR mismatched types + //[nll]~| ERROR mismatched types + //[nll]~| ERROR implementation of `FnOnce` is not general enough + //[nll]~| ERROR implementation of `FnOnce` is not general enough foo: &Foo { bools: &[false, true] }, bar: &Bar { bools: &[true, true] }, f: &id, - //~^ ERROR implementation of `FnOnce` is not general enough + //[base]~^ ERROR implementation of `FnOnce` is not general enough }; // very simple test for a 'static static with default lifetime diff --git a/src/test/ui/type-alias-impl-trait/generic_type_does_not_live_long_enough.stderr b/src/test/ui/type-alias-impl-trait/generic_type_does_not_live_long_enough.base.stderr similarity index 77% rename from src/test/ui/type-alias-impl-trait/generic_type_does_not_live_long_enough.stderr rename to src/test/ui/type-alias-impl-trait/generic_type_does_not_live_long_enough.base.stderr index 15ec2eed3da4b..a3b410c2cfb8c 100644 --- a/src/test/ui/type-alias-impl-trait/generic_type_does_not_live_long_enough.stderr +++ b/src/test/ui/type-alias-impl-trait/generic_type_does_not_live_long_enough.base.stderr @@ -1,23 +1,23 @@ error: at least one trait must be specified - --> $DIR/generic_type_does_not_live_long_enough.rs:10:24 + --> $DIR/generic_type_does_not_live_long_enough.rs:14:24 | LL | type WrongGeneric = impl 'static; | ^^^^^^^^^^^^ error: non-defining opaque type use in defining scope - --> $DIR/generic_type_does_not_live_long_enough.rs:6:18 + --> $DIR/generic_type_does_not_live_long_enough.rs:10:18 | LL | let z: i32 = x; | ^ | note: used non-generic type `&'static i32` for generic parameter - --> $DIR/generic_type_does_not_live_long_enough.rs:10:19 + --> $DIR/generic_type_does_not_live_long_enough.rs:14:19 | LL | type WrongGeneric = impl 'static; | ^ error[E0310]: the parameter type `T` may not live long enough - --> $DIR/generic_type_does_not_live_long_enough.rs:14:5 + --> $DIR/generic_type_does_not_live_long_enough.rs:18:5 | LL | fn wrong_generic(t: T) -> WrongGeneric { | - help: consider adding an explicit lifetime bound...: `T: 'static` diff --git a/src/test/ui/type-alias-impl-trait/generic_type_does_not_live_long_enough.nll.stderr b/src/test/ui/type-alias-impl-trait/generic_type_does_not_live_long_enough.nll.stderr index dc85db66d32ba..db771d211322c 100644 --- a/src/test/ui/type-alias-impl-trait/generic_type_does_not_live_long_enough.nll.stderr +++ b/src/test/ui/type-alias-impl-trait/generic_type_does_not_live_long_enough.nll.stderr @@ -1,23 +1,23 @@ error: at least one trait must be specified - --> $DIR/generic_type_does_not_live_long_enough.rs:10:24 + --> $DIR/generic_type_does_not_live_long_enough.rs:14:24 | LL | type WrongGeneric = impl 'static; | ^^^^^^^^^^^^ error: non-defining opaque type use in defining scope - --> $DIR/generic_type_does_not_live_long_enough.rs:6:18 + --> $DIR/generic_type_does_not_live_long_enough.rs:10:18 | LL | let z: i32 = x; | ^ | note: used non-generic type `&'static i32` for generic parameter - --> $DIR/generic_type_does_not_live_long_enough.rs:10:19 + --> $DIR/generic_type_does_not_live_long_enough.rs:14:19 | LL | type WrongGeneric = impl 'static; | ^ error[E0310]: the parameter type `T` may not live long enough - --> $DIR/generic_type_does_not_live_long_enough.rs:14:5 + --> $DIR/generic_type_does_not_live_long_enough.rs:18:5 | LL | t | ^ diff --git a/src/test/ui/type-alias-impl-trait/generic_type_does_not_live_long_enough.rs b/src/test/ui/type-alias-impl-trait/generic_type_does_not_live_long_enough.rs index cb90776472b5d..2ad7e615e19cc 100644 --- a/src/test/ui/type-alias-impl-trait/generic_type_does_not_live_long_enough.rs +++ b/src/test/ui/type-alias-impl-trait/generic_type_does_not_live_long_enough.rs @@ -1,5 +1,9 @@ #![feature(type_alias_impl_trait)] +// revisions: base nll +// ignore-compare-mode-nll +//[nll] compile-flags: -Z borrowck=mir + fn main() { let y = 42; let x = wrong_generic(&y); diff --git a/src/test/ui/type-alias-impl-trait/issue-57611-trait-alias.stderr b/src/test/ui/type-alias-impl-trait/issue-57611-trait-alias.base.stderr similarity index 90% rename from src/test/ui/type-alias-impl-trait/issue-57611-trait-alias.stderr rename to src/test/ui/type-alias-impl-trait/issue-57611-trait-alias.base.stderr index 45329ea292dcf..be77b60ca8ff3 100644 --- a/src/test/ui/type-alias-impl-trait/issue-57611-trait-alias.stderr +++ b/src/test/ui/type-alias-impl-trait/issue-57611-trait-alias.base.stderr @@ -1,5 +1,5 @@ error: implementation of `FnOnce` is not general enough - --> $DIR/issue-57611-trait-alias.rs:20:9 + --> $DIR/issue-57611-trait-alias.rs:25:9 | LL | |x| x | ^^^^^ implementation of `FnOnce` is not general enough diff --git a/src/test/ui/type-alias-impl-trait/issue-57611-trait-alias.nll.stderr b/src/test/ui/type-alias-impl-trait/issue-57611-trait-alias.nll.stderr index 91daa65d6563a..f5b91567ff531 100644 --- a/src/test/ui/type-alias-impl-trait/issue-57611-trait-alias.nll.stderr +++ b/src/test/ui/type-alias-impl-trait/issue-57611-trait-alias.nll.stderr @@ -1,5 +1,5 @@ error[E0308]: mismatched types - --> $DIR/issue-57611-trait-alias.rs:20:9 + --> $DIR/issue-57611-trait-alias.rs:25:9 | LL | |x| x | ^^^^^ one type is more general than the other @@ -7,13 +7,13 @@ LL | |x| x = note: expected type `for<'r> Fn<(&'r X,)>` found type `Fn<(&X,)>` note: this closure does not fulfill the lifetime requirements - --> $DIR/issue-57611-trait-alias.rs:20:9 + --> $DIR/issue-57611-trait-alias.rs:25:9 | LL | |x| x | ^^^^^ error: implementation of `FnOnce` is not general enough - --> $DIR/issue-57611-trait-alias.rs:20:9 + --> $DIR/issue-57611-trait-alias.rs:25:9 | LL | |x| x | ^^^^^ implementation of `FnOnce` is not general enough diff --git a/src/test/ui/type-alias-impl-trait/issue-57611-trait-alias.rs b/src/test/ui/type-alias-impl-trait/issue-57611-trait-alias.rs index 7c6e764248479..e95ddab75bee4 100644 --- a/src/test/ui/type-alias-impl-trait/issue-57611-trait-alias.rs +++ b/src/test/ui/type-alias-impl-trait/issue-57611-trait-alias.rs @@ -1,6 +1,11 @@ // Regression test for issue #57611 // Ensures that we don't ICE // FIXME: This should compile, but it currently doesn't +// known-bug + +// revisions: base nll +// ignore-compare-mode-nll +//[nll] compile-flags: -Z borrowck=mir #![feature(trait_alias)] #![feature(type_alias_impl_trait)] @@ -18,7 +23,6 @@ impl Foo for X { fn bar(&self) -> Self::Bar { |x| x - //~^ ERROR implementation of `FnOnce` is not general enough } } diff --git a/src/test/ui/unboxed-closures/issue-30906.stderr b/src/test/ui/unboxed-closures/issue-30906.base.stderr similarity index 92% rename from src/test/ui/unboxed-closures/issue-30906.stderr rename to src/test/ui/unboxed-closures/issue-30906.base.stderr index 35b1e454c02b4..5d555a9c5e450 100644 --- a/src/test/ui/unboxed-closures/issue-30906.stderr +++ b/src/test/ui/unboxed-closures/issue-30906.base.stderr @@ -1,5 +1,5 @@ error: implementation of `FnOnce` is not general enough - --> $DIR/issue-30906.rs:18:5 + --> $DIR/issue-30906.rs:22:5 | LL | test(Compose(f, |_| {})); | ^^^^ implementation of `FnOnce` is not general enough diff --git a/src/test/ui/unboxed-closures/issue-30906.nll.stderr b/src/test/ui/unboxed-closures/issue-30906.nll.stderr index 147a20974732d..333e8e178217f 100644 --- a/src/test/ui/unboxed-closures/issue-30906.nll.stderr +++ b/src/test/ui/unboxed-closures/issue-30906.nll.stderr @@ -1,5 +1,5 @@ error: implementation of `FnOnce` is not general enough - --> $DIR/issue-30906.rs:18:5 + --> $DIR/issue-30906.rs:22:5 | LL | test(Compose(f, |_| {})); | ^^^^^^^^^^^^^^^^^^^^^^^^ implementation of `FnOnce` is not general enough diff --git a/src/test/ui/unboxed-closures/issue-30906.rs b/src/test/ui/unboxed-closures/issue-30906.rs index e2d219e470384..1fd3a7f97dea3 100644 --- a/src/test/ui/unboxed-closures/issue-30906.rs +++ b/src/test/ui/unboxed-closures/issue-30906.rs @@ -1,5 +1,9 @@ #![feature(fn_traits, unboxed_closures)] +// revisions: base nll +// ignore-compare-mode-nll +//[nll] compile-flags: -Z borrowck=mir + fn test FnOnce<(&'x str,)>>(_: F) {} struct Compose(F, G); diff --git a/src/test/ui/unboxed-closures/unboxed-closures-infer-argument-types-two-region-pointers.stderr b/src/test/ui/unboxed-closures/unboxed-closures-infer-argument-types-two-region-pointers.base.stderr similarity index 92% rename from src/test/ui/unboxed-closures/unboxed-closures-infer-argument-types-two-region-pointers.stderr rename to src/test/ui/unboxed-closures/unboxed-closures-infer-argument-types-two-region-pointers.base.stderr index d7813338f68cb..ebd14c6429820 100644 --- a/src/test/ui/unboxed-closures/unboxed-closures-infer-argument-types-two-region-pointers.stderr +++ b/src/test/ui/unboxed-closures/unboxed-closures-infer-argument-types-two-region-pointers.base.stderr @@ -1,23 +1,27 @@ error[E0312]: lifetime of reference outlives lifetime of borrowed content... - --> $DIR/unboxed-closures-infer-argument-types-two-region-pointers.rs:17:15 + --> $DIR/unboxed-closures-infer-argument-types-two-region-pointers.rs:21:15 | LL | x.set(y); | ^ | note: ...the reference is valid for the anonymous lifetime #2 defined here... - --> $DIR/unboxed-closures-infer-argument-types-two-region-pointers.rs:16:14 + --> $DIR/unboxed-closures-infer-argument-types-two-region-pointers.rs:20:14 | LL | doit(0, &|x, y| { | ______________^ LL | | x.set(y); +LL | | +LL | | LL | | }); | |_____^ note: ...but the borrowed content is only valid for the anonymous lifetime #3 defined here - --> $DIR/unboxed-closures-infer-argument-types-two-region-pointers.rs:16:14 + --> $DIR/unboxed-closures-infer-argument-types-two-region-pointers.rs:20:14 | LL | doit(0, &|x, y| { | ______________^ LL | | x.set(y); +LL | | +LL | | LL | | }); | |_____^ diff --git a/src/test/ui/unboxed-closures/unboxed-closures-infer-argument-types-two-region-pointers.nll.stderr b/src/test/ui/unboxed-closures/unboxed-closures-infer-argument-types-two-region-pointers.nll.stderr index e97157b83980c..aeeee6e5003e8 100644 --- a/src/test/ui/unboxed-closures/unboxed-closures-infer-argument-types-two-region-pointers.nll.stderr +++ b/src/test/ui/unboxed-closures/unboxed-closures-infer-argument-types-two-region-pointers.nll.stderr @@ -1,5 +1,5 @@ error: lifetime may not live long enough - --> $DIR/unboxed-closures-infer-argument-types-two-region-pointers.rs:17:9 + --> $DIR/unboxed-closures-infer-argument-types-two-region-pointers.rs:21:9 | LL | doit(0, &|x, y| { | - - has type `&'1 i32` diff --git a/src/test/ui/unboxed-closures/unboxed-closures-infer-argument-types-two-region-pointers.rs b/src/test/ui/unboxed-closures/unboxed-closures-infer-argument-types-two-region-pointers.rs index a1364b93fa4cd..288349e44561e 100644 --- a/src/test/ui/unboxed-closures/unboxed-closures-infer-argument-types-two-region-pointers.rs +++ b/src/test/ui/unboxed-closures/unboxed-closures-infer-argument-types-two-region-pointers.rs @@ -3,6 +3,10 @@ // That a closure whose expected argument types include two distinct // bound regions. +// revisions: base nll +// ignore-compare-mode-nll +//[nll] compile-flags: -Z borrowck=mir + use std::cell::Cell; fn doit(val: T, f: &F) @@ -14,6 +18,8 @@ fn doit(val: T, f: &F) pub fn main() { doit(0, &|x, y| { - x.set(y); //~ ERROR E0312 + x.set(y); + //[base]~^ ERROR E0312 + //[nll]~^^ lifetime may not live long enough }); } diff --git a/src/test/ui/underscore-lifetime/dyn-trait-underscore.stderr b/src/test/ui/underscore-lifetime/dyn-trait-underscore.base.stderr similarity index 93% rename from src/test/ui/underscore-lifetime/dyn-trait-underscore.stderr rename to src/test/ui/underscore-lifetime/dyn-trait-underscore.base.stderr index f4285a0f98e7c..07357795010b5 100644 --- a/src/test/ui/underscore-lifetime/dyn-trait-underscore.stderr +++ b/src/test/ui/underscore-lifetime/dyn-trait-underscore.base.stderr @@ -1,5 +1,5 @@ error[E0759]: `items` has an anonymous lifetime `'_` but it needs to satisfy a `'static` lifetime requirement - --> $DIR/dyn-trait-underscore.rs:8:20 + --> $DIR/dyn-trait-underscore.rs:12:20 | LL | fn a(items: &[T]) -> Box> { | ---- this data with an anonymous lifetime `'_`... @@ -10,7 +10,7 @@ LL | Box::new(items.iter()) | ...is used and required to live as long as `'static` here | note: `'static` lifetime requirement introduced by the return type - --> $DIR/dyn-trait-underscore.rs:6:29 + --> $DIR/dyn-trait-underscore.rs:10:29 | LL | fn a(items: &[T]) -> Box> { | ^^^^^^^^^^^^^^^^^^^^^ `'static` requirement introduced here diff --git a/src/test/ui/underscore-lifetime/dyn-trait-underscore.nll.stderr b/src/test/ui/underscore-lifetime/dyn-trait-underscore.nll.stderr index 8ed48bda26e85..53d45f6a8f22b 100644 --- a/src/test/ui/underscore-lifetime/dyn-trait-underscore.nll.stderr +++ b/src/test/ui/underscore-lifetime/dyn-trait-underscore.nll.stderr @@ -1,5 +1,5 @@ error: lifetime may not live long enough - --> $DIR/dyn-trait-underscore.rs:8:5 + --> $DIR/dyn-trait-underscore.rs:12:5 | LL | fn a(items: &[T]) -> Box> { | - let's call the lifetime of this reference `'1` diff --git a/src/test/ui/underscore-lifetime/dyn-trait-underscore.rs b/src/test/ui/underscore-lifetime/dyn-trait-underscore.rs index e951adf030f5c..7110d43221082 100644 --- a/src/test/ui/underscore-lifetime/dyn-trait-underscore.rs +++ b/src/test/ui/underscore-lifetime/dyn-trait-underscore.rs @@ -3,9 +3,15 @@ // // cc #48468 +// revisions: base nll +// ignore-compare-mode-nll +//[nll] compile-flags: -Z borrowck=mir + fn a(items: &[T]) -> Box> { // ^^^^^^^^^^^^^^^^^^^^^ bound *here* defaults to `'static` - Box::new(items.iter()) //~ ERROR E0759 + Box::new(items.iter()) + //[base]~^ ERROR E0759 + //[nll]~^^ ERROR lifetime may not live long enough } fn b(items: &[T]) -> Box + '_> { diff --git a/src/test/ui/underscore-lifetime/underscore-lifetime-elison-mismatch.stderr b/src/test/ui/underscore-lifetime/underscore-lifetime-elison-mismatch.base.stderr similarity index 92% rename from src/test/ui/underscore-lifetime/underscore-lifetime-elison-mismatch.stderr rename to src/test/ui/underscore-lifetime/underscore-lifetime-elison-mismatch.base.stderr index 8976da01e739b..2581911f5ce23 100644 --- a/src/test/ui/underscore-lifetime/underscore-lifetime-elison-mismatch.stderr +++ b/src/test/ui/underscore-lifetime/underscore-lifetime-elison-mismatch.base.stderr @@ -1,5 +1,5 @@ error[E0623]: lifetime mismatch - --> $DIR/underscore-lifetime-elison-mismatch.rs:1:49 + --> $DIR/underscore-lifetime-elison-mismatch.rs:5:49 | LL | fn foo(x: &mut Vec<&'_ u8>, y: &'_ u8) { x.push(y); } | ------ ------ ^ ...but data from `y` flows into `x` here diff --git a/src/test/ui/underscore-lifetime/underscore-lifetime-elison-mismatch.nll.stderr b/src/test/ui/underscore-lifetime/underscore-lifetime-elison-mismatch.nll.stderr index e1d57b8ba1eda..8e10242cb1331 100644 --- a/src/test/ui/underscore-lifetime/underscore-lifetime-elison-mismatch.nll.stderr +++ b/src/test/ui/underscore-lifetime/underscore-lifetime-elison-mismatch.nll.stderr @@ -1,5 +1,5 @@ error: lifetime may not live long enough - --> $DIR/underscore-lifetime-elison-mismatch.rs:1:42 + --> $DIR/underscore-lifetime-elison-mismatch.rs:5:42 | LL | fn foo(x: &mut Vec<&'_ u8>, y: &'_ u8) { x.push(y); } | - - ^^^^^^^^^ argument requires that `'1` must outlive `'2` diff --git a/src/test/ui/underscore-lifetime/underscore-lifetime-elison-mismatch.rs b/src/test/ui/underscore-lifetime/underscore-lifetime-elison-mismatch.rs index f465a804283a7..6d495138da9e3 100644 --- a/src/test/ui/underscore-lifetime/underscore-lifetime-elison-mismatch.rs +++ b/src/test/ui/underscore-lifetime/underscore-lifetime-elison-mismatch.rs @@ -1,3 +1,9 @@ -fn foo(x: &mut Vec<&'_ u8>, y: &'_ u8) { x.push(y); } //~ ERROR lifetime mismatch +// revisions: base nll +// ignore-compare-mode-nll +//[nll] compile-flags: -Z borrowck=mir + +fn foo(x: &mut Vec<&'_ u8>, y: &'_ u8) { x.push(y); } +//[base]~^ ERROR lifetime mismatch +//[nll]~^^ ERROR lifetime may not live long enough fn main() {} diff --git a/src/test/ui/variance/variance-associated-types2.stderr b/src/test/ui/variance/variance-associated-types2.base.stderr similarity index 85% rename from src/test/ui/variance/variance-associated-types2.stderr rename to src/test/ui/variance/variance-associated-types2.base.stderr index af4f2a7c2a066..c8ace0848719b 100644 --- a/src/test/ui/variance/variance-associated-types2.stderr +++ b/src/test/ui/variance/variance-associated-types2.base.stderr @@ -1,5 +1,5 @@ error[E0308]: mismatched types - --> $DIR/variance-associated-types2.rs:13:42 + --> $DIR/variance-associated-types2.rs:17:42 | LL | let _: Box> = make(); | ^^^^^^ lifetime mismatch @@ -7,7 +7,7 @@ LL | let _: Box> = make(); = note: expected trait object `dyn Foo` found trait object `dyn Foo` note: the lifetime `'a` as defined here... - --> $DIR/variance-associated-types2.rs:12:9 + --> $DIR/variance-associated-types2.rs:16:9 | LL | fn take<'a>(_: &'a u32) { | ^^ diff --git a/src/test/ui/variance/variance-associated-types2.nll.stderr b/src/test/ui/variance/variance-associated-types2.nll.stderr index 35871c1236fae..b74c400969237 100644 --- a/src/test/ui/variance/variance-associated-types2.nll.stderr +++ b/src/test/ui/variance/variance-associated-types2.nll.stderr @@ -1,5 +1,5 @@ error: lifetime may not live long enough - --> $DIR/variance-associated-types2.rs:13:12 + --> $DIR/variance-associated-types2.rs:17:12 | LL | fn take<'a>(_: &'a u32) { | -- lifetime `'a` defined here diff --git a/src/test/ui/variance/variance-associated-types2.rs b/src/test/ui/variance/variance-associated-types2.rs index 6a095fce7abfa..e3c8e6d7ca242 100644 --- a/src/test/ui/variance/variance-associated-types2.rs +++ b/src/test/ui/variance/variance-associated-types2.rs @@ -1,6 +1,10 @@ // Test that dyn Foo is invariant with respect to T. // Failure to enforce invariance here can be weaponized, see #71550 for details. +// revisions: base nll +// ignore-compare-mode-nll +//[nll] compile-flags: -Z borrowck=mir + trait Foo { type Bar; } @@ -11,7 +15,8 @@ fn make() -> Box> { fn take<'a>(_: &'a u32) { let _: Box> = make(); - //~^ ERROR mismatched types [E0308] + //[base]~^ ERROR mismatched types [E0308] + //[nll]~^^ ERROR lifetime may not live long enough } fn main() {} diff --git a/src/test/ui/variance/variance-btree-invariant-types.stderr b/src/test/ui/variance/variance-btree-invariant-types.base.stderr similarity index 84% rename from src/test/ui/variance/variance-btree-invariant-types.stderr rename to src/test/ui/variance/variance-btree-invariant-types.base.stderr index df519e25641c3..5b78f4252b3dd 100644 --- a/src/test/ui/variance/variance-btree-invariant-types.stderr +++ b/src/test/ui/variance/variance-btree-invariant-types.base.stderr @@ -1,5 +1,5 @@ error[E0308]: mismatched types - --> $DIR/variance-btree-invariant-types.rs:4:5 + --> $DIR/variance-btree-invariant-types.rs:8:5 | LL | v | ^ lifetime mismatch @@ -7,14 +7,14 @@ LL | v = note: expected struct `std::collections::btree_map::IterMut<'_, &'new (), _>` found struct `std::collections::btree_map::IterMut<'_, &'static (), _>` note: the lifetime `'new` as defined here... - --> $DIR/variance-btree-invariant-types.rs:3:21 + --> $DIR/variance-btree-invariant-types.rs:7:21 | LL | fn iter_cov_key<'a, 'new>(v: IterMut<'a, &'static (), ()>) -> IterMut<'a, &'new (), ()> { | ^^^^ = note: ...does not necessarily outlive the static lifetime error[E0308]: mismatched types - --> $DIR/variance-btree-invariant-types.rs:7:5 + --> $DIR/variance-btree-invariant-types.rs:13:5 | LL | v | ^ lifetime mismatch @@ -22,14 +22,14 @@ LL | v = note: expected struct `std::collections::btree_map::IterMut<'_, _, &'new ()>` found struct `std::collections::btree_map::IterMut<'_, _, &'static ()>` note: the lifetime `'new` as defined here... - --> $DIR/variance-btree-invariant-types.rs:6:21 + --> $DIR/variance-btree-invariant-types.rs:12:21 | LL | fn iter_cov_val<'a, 'new>(v: IterMut<'a, (), &'static ()>) -> IterMut<'a, (), &'new ()> { | ^^^^ = note: ...does not necessarily outlive the static lifetime error[E0308]: mismatched types - --> $DIR/variance-btree-invariant-types.rs:10:5 + --> $DIR/variance-btree-invariant-types.rs:18:5 | LL | v | ^ lifetime mismatch @@ -37,14 +37,14 @@ LL | v = note: expected struct `std::collections::btree_map::IterMut<'_, &'static (), _>` found struct `std::collections::btree_map::IterMut<'_, &'new (), _>` note: the lifetime `'new` as defined here... - --> $DIR/variance-btree-invariant-types.rs:9:24 + --> $DIR/variance-btree-invariant-types.rs:17:24 | LL | fn iter_contra_key<'a, 'new>(v: IterMut<'a, &'new (), ()>) -> IterMut<'a, &'static (), ()> { | ^^^^ = note: ...does not necessarily outlive the static lifetime error[E0308]: mismatched types - --> $DIR/variance-btree-invariant-types.rs:13:5 + --> $DIR/variance-btree-invariant-types.rs:23:5 | LL | v | ^ lifetime mismatch @@ -52,14 +52,14 @@ LL | v = note: expected struct `std::collections::btree_map::IterMut<'_, _, &'static ()>` found struct `std::collections::btree_map::IterMut<'_, _, &'new ()>` note: the lifetime `'new` as defined here... - --> $DIR/variance-btree-invariant-types.rs:12:24 + --> $DIR/variance-btree-invariant-types.rs:22:24 | LL | fn iter_contra_val<'a, 'new>(v: IterMut<'a, (), &'new ()>) -> IterMut<'a, (), &'static ()> { | ^^^^ = note: ...does not necessarily outlive the static lifetime error[E0308]: mismatched types - --> $DIR/variance-btree-invariant-types.rs:17:5 + --> $DIR/variance-btree-invariant-types.rs:29:5 | LL | v | ^ lifetime mismatch @@ -67,14 +67,14 @@ LL | v = note: expected struct `RangeMut<'_, &'new (), _>` found struct `RangeMut<'_, &'static (), _>` note: the lifetime `'new` as defined here... - --> $DIR/variance-btree-invariant-types.rs:16:22 + --> $DIR/variance-btree-invariant-types.rs:28:22 | LL | fn range_cov_key<'a, 'new>(v: RangeMut<'a, &'static (), ()>) -> RangeMut<'a, &'new (), ()> { | ^^^^ = note: ...does not necessarily outlive the static lifetime error[E0308]: mismatched types - --> $DIR/variance-btree-invariant-types.rs:20:5 + --> $DIR/variance-btree-invariant-types.rs:34:5 | LL | v | ^ lifetime mismatch @@ -82,14 +82,14 @@ LL | v = note: expected struct `RangeMut<'_, _, &'new ()>` found struct `RangeMut<'_, _, &'static ()>` note: the lifetime `'new` as defined here... - --> $DIR/variance-btree-invariant-types.rs:19:22 + --> $DIR/variance-btree-invariant-types.rs:33:22 | LL | fn range_cov_val<'a, 'new>(v: RangeMut<'a, (), &'static ()>) -> RangeMut<'a, (), &'new ()> { | ^^^^ = note: ...does not necessarily outlive the static lifetime error[E0308]: mismatched types - --> $DIR/variance-btree-invariant-types.rs:23:5 + --> $DIR/variance-btree-invariant-types.rs:39:5 | LL | v | ^ lifetime mismatch @@ -97,14 +97,14 @@ LL | v = note: expected struct `RangeMut<'_, &'static (), _>` found struct `RangeMut<'_, &'new (), _>` note: the lifetime `'new` as defined here... - --> $DIR/variance-btree-invariant-types.rs:22:25 + --> $DIR/variance-btree-invariant-types.rs:38:25 | LL | fn range_contra_key<'a, 'new>(v: RangeMut<'a, &'new (), ()>) -> RangeMut<'a, &'static (), ()> { | ^^^^ = note: ...does not necessarily outlive the static lifetime error[E0308]: mismatched types - --> $DIR/variance-btree-invariant-types.rs:26:5 + --> $DIR/variance-btree-invariant-types.rs:44:5 | LL | v | ^ lifetime mismatch @@ -112,14 +112,14 @@ LL | v = note: expected struct `RangeMut<'_, _, &'static ()>` found struct `RangeMut<'_, _, &'new ()>` note: the lifetime `'new` as defined here... - --> $DIR/variance-btree-invariant-types.rs:25:25 + --> $DIR/variance-btree-invariant-types.rs:43:25 | LL | fn range_contra_val<'a, 'new>(v: RangeMut<'a, (), &'new ()>) -> RangeMut<'a, (), &'static ()> { | ^^^^ = note: ...does not necessarily outlive the static lifetime error[E0308]: mismatched types - --> $DIR/variance-btree-invariant-types.rs:31:5 + --> $DIR/variance-btree-invariant-types.rs:51:5 | LL | v | ^ lifetime mismatch @@ -127,14 +127,14 @@ LL | v = note: expected struct `std::collections::btree_map::OccupiedEntry<'_, &'new (), _>` found struct `std::collections::btree_map::OccupiedEntry<'_, &'static (), _>` note: the lifetime `'new` as defined here... - --> $DIR/variance-btree-invariant-types.rs:29:20 + --> $DIR/variance-btree-invariant-types.rs:49:20 | LL | fn occ_cov_key<'a, 'new>(v: OccupiedEntry<'a, &'static (), ()>) | ^^^^ = note: ...does not necessarily outlive the static lifetime error[E0308]: mismatched types - --> $DIR/variance-btree-invariant-types.rs:35:5 + --> $DIR/variance-btree-invariant-types.rs:57:5 | LL | v | ^ lifetime mismatch @@ -142,14 +142,14 @@ LL | v = note: expected struct `std::collections::btree_map::OccupiedEntry<'_, _, &'new ()>` found struct `std::collections::btree_map::OccupiedEntry<'_, _, &'static ()>` note: the lifetime `'new` as defined here... - --> $DIR/variance-btree-invariant-types.rs:33:20 + --> $DIR/variance-btree-invariant-types.rs:55:20 | LL | fn occ_cov_val<'a, 'new>(v: OccupiedEntry<'a, (), &'static ()>) | ^^^^ = note: ...does not necessarily outlive the static lifetime error[E0308]: mismatched types - --> $DIR/variance-btree-invariant-types.rs:39:5 + --> $DIR/variance-btree-invariant-types.rs:63:5 | LL | v | ^ lifetime mismatch @@ -157,14 +157,14 @@ LL | v = note: expected struct `std::collections::btree_map::OccupiedEntry<'_, &'static (), _>` found struct `std::collections::btree_map::OccupiedEntry<'_, &'new (), _>` note: the lifetime `'new` as defined here... - --> $DIR/variance-btree-invariant-types.rs:37:23 + --> $DIR/variance-btree-invariant-types.rs:61:23 | LL | fn occ_contra_key<'a, 'new>(v: OccupiedEntry<'a, &'new (), ()>) | ^^^^ = note: ...does not necessarily outlive the static lifetime error[E0308]: mismatched types - --> $DIR/variance-btree-invariant-types.rs:43:5 + --> $DIR/variance-btree-invariant-types.rs:69:5 | LL | v | ^ lifetime mismatch @@ -172,14 +172,14 @@ LL | v = note: expected struct `std::collections::btree_map::OccupiedEntry<'_, _, &'static ()>` found struct `std::collections::btree_map::OccupiedEntry<'_, _, &'new ()>` note: the lifetime `'new` as defined here... - --> $DIR/variance-btree-invariant-types.rs:41:23 + --> $DIR/variance-btree-invariant-types.rs:67:23 | LL | fn occ_contra_val<'a, 'new>(v: OccupiedEntry<'a, (), &'new ()>) | ^^^^ = note: ...does not necessarily outlive the static lifetime error[E0308]: mismatched types - --> $DIR/variance-btree-invariant-types.rs:48:5 + --> $DIR/variance-btree-invariant-types.rs:76:5 | LL | v | ^ lifetime mismatch @@ -187,14 +187,14 @@ LL | v = note: expected struct `std::collections::btree_map::VacantEntry<'_, &'new (), _>` found struct `std::collections::btree_map::VacantEntry<'_, &'static (), _>` note: the lifetime `'new` as defined here... - --> $DIR/variance-btree-invariant-types.rs:46:20 + --> $DIR/variance-btree-invariant-types.rs:74:20 | LL | fn vac_cov_key<'a, 'new>(v: VacantEntry<'a, &'static (), ()>) | ^^^^ = note: ...does not necessarily outlive the static lifetime error[E0308]: mismatched types - --> $DIR/variance-btree-invariant-types.rs:52:5 + --> $DIR/variance-btree-invariant-types.rs:82:5 | LL | v | ^ lifetime mismatch @@ -202,14 +202,14 @@ LL | v = note: expected struct `std::collections::btree_map::VacantEntry<'_, _, &'new ()>` found struct `std::collections::btree_map::VacantEntry<'_, _, &'static ()>` note: the lifetime `'new` as defined here... - --> $DIR/variance-btree-invariant-types.rs:50:20 + --> $DIR/variance-btree-invariant-types.rs:80:20 | LL | fn vac_cov_val<'a, 'new>(v: VacantEntry<'a, (), &'static ()>) | ^^^^ = note: ...does not necessarily outlive the static lifetime error[E0308]: mismatched types - --> $DIR/variance-btree-invariant-types.rs:56:5 + --> $DIR/variance-btree-invariant-types.rs:88:5 | LL | v | ^ lifetime mismatch @@ -217,14 +217,14 @@ LL | v = note: expected struct `std::collections::btree_map::VacantEntry<'_, &'static (), _>` found struct `std::collections::btree_map::VacantEntry<'_, &'new (), _>` note: the lifetime `'new` as defined here... - --> $DIR/variance-btree-invariant-types.rs:54:23 + --> $DIR/variance-btree-invariant-types.rs:86:23 | LL | fn vac_contra_key<'a, 'new>(v: VacantEntry<'a, &'new (), ()>) | ^^^^ = note: ...does not necessarily outlive the static lifetime error[E0308]: mismatched types - --> $DIR/variance-btree-invariant-types.rs:60:5 + --> $DIR/variance-btree-invariant-types.rs:94:5 | LL | v | ^ lifetime mismatch @@ -232,7 +232,7 @@ LL | v = note: expected struct `std::collections::btree_map::VacantEntry<'_, _, &'static ()>` found struct `std::collections::btree_map::VacantEntry<'_, _, &'new ()>` note: the lifetime `'new` as defined here... - --> $DIR/variance-btree-invariant-types.rs:58:23 + --> $DIR/variance-btree-invariant-types.rs:92:23 | LL | fn vac_contra_val<'a, 'new>(v: VacantEntry<'a, (), &'new ()>) | ^^^^ diff --git a/src/test/ui/variance/variance-btree-invariant-types.nll.stderr b/src/test/ui/variance/variance-btree-invariant-types.nll.stderr index 0d9815cf788a1..991a7b0cdf078 100644 --- a/src/test/ui/variance/variance-btree-invariant-types.nll.stderr +++ b/src/test/ui/variance/variance-btree-invariant-types.nll.stderr @@ -1,5 +1,5 @@ error: lifetime may not live long enough - --> $DIR/variance-btree-invariant-types.rs:4:5 + --> $DIR/variance-btree-invariant-types.rs:8:5 | LL | fn iter_cov_key<'a, 'new>(v: IterMut<'a, &'static (), ()>) -> IterMut<'a, &'new (), ()> { | ---- lifetime `'new` defined here @@ -11,7 +11,7 @@ LL | v = help: see for more information about variance error: lifetime may not live long enough - --> $DIR/variance-btree-invariant-types.rs:7:5 + --> $DIR/variance-btree-invariant-types.rs:13:5 | LL | fn iter_cov_val<'a, 'new>(v: IterMut<'a, (), &'static ()>) -> IterMut<'a, (), &'new ()> { | ---- lifetime `'new` defined here @@ -23,7 +23,7 @@ LL | v = help: see for more information about variance error: lifetime may not live long enough - --> $DIR/variance-btree-invariant-types.rs:10:5 + --> $DIR/variance-btree-invariant-types.rs:18:5 | LL | fn iter_contra_key<'a, 'new>(v: IterMut<'a, &'new (), ()>) -> IterMut<'a, &'static (), ()> { | ---- lifetime `'new` defined here @@ -35,7 +35,7 @@ LL | v = help: see for more information about variance error: lifetime may not live long enough - --> $DIR/variance-btree-invariant-types.rs:13:5 + --> $DIR/variance-btree-invariant-types.rs:23:5 | LL | fn iter_contra_val<'a, 'new>(v: IterMut<'a, (), &'new ()>) -> IterMut<'a, (), &'static ()> { | ---- lifetime `'new` defined here @@ -47,7 +47,7 @@ LL | v = help: see for more information about variance error: lifetime may not live long enough - --> $DIR/variance-btree-invariant-types.rs:17:5 + --> $DIR/variance-btree-invariant-types.rs:29:5 | LL | fn range_cov_key<'a, 'new>(v: RangeMut<'a, &'static (), ()>) -> RangeMut<'a, &'new (), ()> { | ---- lifetime `'new` defined here @@ -59,7 +59,7 @@ LL | v = help: see for more information about variance error: lifetime may not live long enough - --> $DIR/variance-btree-invariant-types.rs:20:5 + --> $DIR/variance-btree-invariant-types.rs:34:5 | LL | fn range_cov_val<'a, 'new>(v: RangeMut<'a, (), &'static ()>) -> RangeMut<'a, (), &'new ()> { | ---- lifetime `'new` defined here @@ -71,7 +71,7 @@ LL | v = help: see for more information about variance error: lifetime may not live long enough - --> $DIR/variance-btree-invariant-types.rs:23:5 + --> $DIR/variance-btree-invariant-types.rs:39:5 | LL | fn range_contra_key<'a, 'new>(v: RangeMut<'a, &'new (), ()>) -> RangeMut<'a, &'static (), ()> { | ---- lifetime `'new` defined here @@ -83,7 +83,7 @@ LL | v = help: see for more information about variance error: lifetime may not live long enough - --> $DIR/variance-btree-invariant-types.rs:26:5 + --> $DIR/variance-btree-invariant-types.rs:44:5 | LL | fn range_contra_val<'a, 'new>(v: RangeMut<'a, (), &'new ()>) -> RangeMut<'a, (), &'static ()> { | ---- lifetime `'new` defined here @@ -95,7 +95,7 @@ LL | v = help: see for more information about variance error: lifetime may not live long enough - --> $DIR/variance-btree-invariant-types.rs:31:5 + --> $DIR/variance-btree-invariant-types.rs:51:5 | LL | fn occ_cov_key<'a, 'new>(v: OccupiedEntry<'a, &'static (), ()>) | ---- lifetime `'new` defined here @@ -108,7 +108,7 @@ LL | v = help: see for more information about variance error: lifetime may not live long enough - --> $DIR/variance-btree-invariant-types.rs:35:5 + --> $DIR/variance-btree-invariant-types.rs:57:5 | LL | fn occ_cov_val<'a, 'new>(v: OccupiedEntry<'a, (), &'static ()>) | ---- lifetime `'new` defined here @@ -121,7 +121,7 @@ LL | v = help: see for more information about variance error: lifetime may not live long enough - --> $DIR/variance-btree-invariant-types.rs:39:5 + --> $DIR/variance-btree-invariant-types.rs:63:5 | LL | fn occ_contra_key<'a, 'new>(v: OccupiedEntry<'a, &'new (), ()>) | ---- lifetime `'new` defined here @@ -134,7 +134,7 @@ LL | v = help: see for more information about variance error: lifetime may not live long enough - --> $DIR/variance-btree-invariant-types.rs:43:5 + --> $DIR/variance-btree-invariant-types.rs:69:5 | LL | fn occ_contra_val<'a, 'new>(v: OccupiedEntry<'a, (), &'new ()>) | ---- lifetime `'new` defined here @@ -147,7 +147,7 @@ LL | v = help: see for more information about variance error: lifetime may not live long enough - --> $DIR/variance-btree-invariant-types.rs:48:5 + --> $DIR/variance-btree-invariant-types.rs:76:5 | LL | fn vac_cov_key<'a, 'new>(v: VacantEntry<'a, &'static (), ()>) | ---- lifetime `'new` defined here @@ -160,7 +160,7 @@ LL | v = help: see for more information about variance error: lifetime may not live long enough - --> $DIR/variance-btree-invariant-types.rs:52:5 + --> $DIR/variance-btree-invariant-types.rs:82:5 | LL | fn vac_cov_val<'a, 'new>(v: VacantEntry<'a, (), &'static ()>) | ---- lifetime `'new` defined here @@ -173,7 +173,7 @@ LL | v = help: see for more information about variance error: lifetime may not live long enough - --> $DIR/variance-btree-invariant-types.rs:56:5 + --> $DIR/variance-btree-invariant-types.rs:88:5 | LL | fn vac_contra_key<'a, 'new>(v: VacantEntry<'a, &'new (), ()>) | ---- lifetime `'new` defined here @@ -186,7 +186,7 @@ LL | v = help: see for more information about variance error: lifetime may not live long enough - --> $DIR/variance-btree-invariant-types.rs:60:5 + --> $DIR/variance-btree-invariant-types.rs:94:5 | LL | fn vac_contra_val<'a, 'new>(v: VacantEntry<'a, (), &'new ()>) | ---- lifetime `'new` defined here diff --git a/src/test/ui/variance/variance-btree-invariant-types.rs b/src/test/ui/variance/variance-btree-invariant-types.rs index 4549622f24ac3..7ddf6b294a5a1 100644 --- a/src/test/ui/variance/variance-btree-invariant-types.rs +++ b/src/test/ui/variance/variance-btree-invariant-types.rs @@ -1,63 +1,99 @@ use std::collections::btree_map::{IterMut, OccupiedEntry, RangeMut, VacantEntry}; +// revisions: base nll +// ignore-compare-mode-nll +//[nll] compile-flags: -Z borrowck=mir + fn iter_cov_key<'a, 'new>(v: IterMut<'a, &'static (), ()>) -> IterMut<'a, &'new (), ()> { - v //~ ERROR mismatched types + v + //[base]~^ ERROR mismatched types + //[nll]~^^ lifetime may not live long enough } fn iter_cov_val<'a, 'new>(v: IterMut<'a, (), &'static ()>) -> IterMut<'a, (), &'new ()> { - v //~ ERROR mismatched types + v + //[base]~^ ERROR mismatched types + //[nll]~^^ lifetime may not live long enough } fn iter_contra_key<'a, 'new>(v: IterMut<'a, &'new (), ()>) -> IterMut<'a, &'static (), ()> { - v //~ ERROR mismatched types + v + //[base]~^ ERROR mismatched types + //[nll]~^^ lifetime may not live long enough } fn iter_contra_val<'a, 'new>(v: IterMut<'a, (), &'new ()>) -> IterMut<'a, (), &'static ()> { - v //~ ERROR mismatched types + v + //[base]~^ ERROR mismatched types + //[nll]~^^ lifetime may not live long enough } fn range_cov_key<'a, 'new>(v: RangeMut<'a, &'static (), ()>) -> RangeMut<'a, &'new (), ()> { - v //~ ERROR mismatched types + v + //[base]~^ ERROR mismatched types + //[nll]~^^ lifetime may not live long enough } fn range_cov_val<'a, 'new>(v: RangeMut<'a, (), &'static ()>) -> RangeMut<'a, (), &'new ()> { - v //~ ERROR mismatched types + v + //[base]~^ ERROR mismatched types + //[nll]~^^ lifetime may not live long enough } fn range_contra_key<'a, 'new>(v: RangeMut<'a, &'new (), ()>) -> RangeMut<'a, &'static (), ()> { - v //~ ERROR mismatched types + v + //[base]~^ ERROR mismatched types + //[nll]~^^ lifetime may not live long enough } fn range_contra_val<'a, 'new>(v: RangeMut<'a, (), &'new ()>) -> RangeMut<'a, (), &'static ()> { - v //~ ERROR mismatched types + v + //[base]~^ ERROR mismatched types + //[nll]~^^ lifetime may not live long enough } fn occ_cov_key<'a, 'new>(v: OccupiedEntry<'a, &'static (), ()>) -> OccupiedEntry<'a, &'new (), ()> { - v //~ ERROR mismatched types + v + //[base]~^ ERROR mismatched types + //[nll]~^^ lifetime may not live long enough } fn occ_cov_val<'a, 'new>(v: OccupiedEntry<'a, (), &'static ()>) -> OccupiedEntry<'a, (), &'new ()> { - v //~ ERROR mismatched types + v + //[base]~^ ERROR mismatched types + //[nll]~^^ lifetime may not live long enough } fn occ_contra_key<'a, 'new>(v: OccupiedEntry<'a, &'new (), ()>) -> OccupiedEntry<'a, &'static (), ()> { - v //~ ERROR mismatched types + v + //[base]~^ ERROR mismatched types + //[nll]~^^ lifetime may not live long enough } fn occ_contra_val<'a, 'new>(v: OccupiedEntry<'a, (), &'new ()>) -> OccupiedEntry<'a, (), &'static ()> { - v //~ ERROR mismatched types + v + //[base]~^ ERROR mismatched types + //[nll]~^^ lifetime may not live long enough } fn vac_cov_key<'a, 'new>(v: VacantEntry<'a, &'static (), ()>) -> VacantEntry<'a, &'new (), ()> { - v //~ ERROR mismatched types + v + //[base]~^ ERROR mismatched types + //[nll]~^^ lifetime may not live long enough } fn vac_cov_val<'a, 'new>(v: VacantEntry<'a, (), &'static ()>) -> VacantEntry<'a, (), &'new ()> { - v //~ ERROR mismatched types + v + //[base]~^ ERROR mismatched types + //[nll]~^^ lifetime may not live long enough } fn vac_contra_key<'a, 'new>(v: VacantEntry<'a, &'new (), ()>) -> VacantEntry<'a, &'static (), ()> { - v //~ ERROR mismatched types + v + //[base]~^ ERROR mismatched types + //[nll]~^^ lifetime may not live long enough } fn vac_contra_val<'a, 'new>(v: VacantEntry<'a, (), &'new ()>) -> VacantEntry<'a, (), &'static ()> { - v //~ ERROR mismatched types + v + //[base]~^ ERROR mismatched types + //[nll]~^^ lifetime may not live long enough } diff --git a/src/test/ui/variance/variance-cell-is-invariant.stderr b/src/test/ui/variance/variance-cell-is-invariant.base.stderr similarity index 92% rename from src/test/ui/variance/variance-cell-is-invariant.stderr rename to src/test/ui/variance/variance-cell-is-invariant.base.stderr index 6fcd6460fe30a..e3180b6d98476 100644 --- a/src/test/ui/variance/variance-cell-is-invariant.stderr +++ b/src/test/ui/variance/variance-cell-is-invariant.base.stderr @@ -1,5 +1,5 @@ error[E0623]: lifetime mismatch - --> $DIR/variance-cell-is-invariant.rs:14:25 + --> $DIR/variance-cell-is-invariant.rs:18:25 | LL | fn use_<'short,'long>(c: Foo<'short>, | ----------- these two types are declared with different lifetimes... diff --git a/src/test/ui/variance/variance-cell-is-invariant.nll.stderr b/src/test/ui/variance/variance-cell-is-invariant.nll.stderr index ab5435d1656d2..c2e93d99c43f0 100644 --- a/src/test/ui/variance/variance-cell-is-invariant.nll.stderr +++ b/src/test/ui/variance/variance-cell-is-invariant.nll.stderr @@ -1,5 +1,5 @@ error: lifetime may not live long enough - --> $DIR/variance-cell-is-invariant.rs:14:12 + --> $DIR/variance-cell-is-invariant.rs:18:12 | LL | fn use_<'short,'long>(c: Foo<'short>, | ------ ----- lifetime `'long` defined here diff --git a/src/test/ui/variance/variance-cell-is-invariant.rs b/src/test/ui/variance/variance-cell-is-invariant.rs index ff9ad66fb0bc2..b8b73147d0eea 100644 --- a/src/test/ui/variance/variance-cell-is-invariant.rs +++ b/src/test/ui/variance/variance-cell-is-invariant.rs @@ -1,6 +1,10 @@ // Test that Cell is considered invariant with respect to its // type. +// revisions: base nll +// ignore-compare-mode-nll +//[nll] compile-flags: -Z borrowck=mir + use std::cell::Cell; struct Foo<'a> { @@ -11,7 +15,9 @@ fn use_<'short,'long>(c: Foo<'short>, s: &'short isize, l: &'long isize, _where:Option<&'short &'long ()>) { - let _: Foo<'long> = c; //~ ERROR E0623 + let _: Foo<'long> = c; + //[base]~^ ERROR E0623 + //[nll]~^^ ERROR lifetime may not live long enough } fn main() { diff --git a/src/test/ui/variance/variance-contravariant-arg-object.stderr b/src/test/ui/variance/variance-contravariant-arg-object.base.stderr similarity index 78% rename from src/test/ui/variance/variance-contravariant-arg-object.stderr rename to src/test/ui/variance/variance-contravariant-arg-object.base.stderr index 16583fa793109..19b8b9d5aa05c 100644 --- a/src/test/ui/variance/variance-contravariant-arg-object.stderr +++ b/src/test/ui/variance/variance-contravariant-arg-object.base.stderr @@ -1,5 +1,5 @@ error[E0308]: mismatched types - --> $DIR/variance-contravariant-arg-object.rs:14:5 + --> $DIR/variance-contravariant-arg-object.rs:18:5 | LL | v | ^ lifetime mismatch @@ -7,18 +7,18 @@ LL | v = note: expected trait object `dyn Get<&'min i32>` found trait object `dyn Get<&'max i32>` note: the lifetime `'min` as defined here... - --> $DIR/variance-contravariant-arg-object.rs:10:21 + --> $DIR/variance-contravariant-arg-object.rs:14:21 | LL | fn get_min_from_max<'min, 'max>(v: Box>) | ^^^^ note: ...does not necessarily outlive the lifetime `'max` as defined here - --> $DIR/variance-contravariant-arg-object.rs:10:27 + --> $DIR/variance-contravariant-arg-object.rs:14:27 | LL | fn get_min_from_max<'min, 'max>(v: Box>) | ^^^^ error[E0308]: mismatched types - --> $DIR/variance-contravariant-arg-object.rs:22:5 + --> $DIR/variance-contravariant-arg-object.rs:28:5 | LL | v | ^ lifetime mismatch @@ -26,12 +26,12 @@ LL | v = note: expected trait object `dyn Get<&'max i32>` found trait object `dyn Get<&'min i32>` note: the lifetime `'min` as defined here... - --> $DIR/variance-contravariant-arg-object.rs:17:21 + --> $DIR/variance-contravariant-arg-object.rs:23:21 | LL | fn get_max_from_min<'min, 'max, G>(v: Box>) | ^^^^ note: ...does not necessarily outlive the lifetime `'max` as defined here - --> $DIR/variance-contravariant-arg-object.rs:17:27 + --> $DIR/variance-contravariant-arg-object.rs:23:27 | LL | fn get_max_from_min<'min, 'max, G>(v: Box>) | ^^^^ diff --git a/src/test/ui/variance/variance-contravariant-arg-object.nll.stderr b/src/test/ui/variance/variance-contravariant-arg-object.nll.stderr index 3315eaaf1c006..4071a41703e28 100644 --- a/src/test/ui/variance/variance-contravariant-arg-object.nll.stderr +++ b/src/test/ui/variance/variance-contravariant-arg-object.nll.stderr @@ -1,5 +1,5 @@ error: lifetime may not live long enough - --> $DIR/variance-contravariant-arg-object.rs:14:5 + --> $DIR/variance-contravariant-arg-object.rs:18:5 | LL | fn get_min_from_max<'min, 'max>(v: Box>) | ---- ---- lifetime `'max` defined here @@ -12,7 +12,7 @@ LL | v = help: consider adding the following bound: `'min: 'max` error: lifetime may not live long enough - --> $DIR/variance-contravariant-arg-object.rs:22:5 + --> $DIR/variance-contravariant-arg-object.rs:28:5 | LL | fn get_max_from_min<'min, 'max, G>(v: Box>) | ---- ---- lifetime `'max` defined here diff --git a/src/test/ui/variance/variance-contravariant-arg-object.rs b/src/test/ui/variance/variance-contravariant-arg-object.rs index 947f4cd8b8f4d..dab42c35218bf 100644 --- a/src/test/ui/variance/variance-contravariant-arg-object.rs +++ b/src/test/ui/variance/variance-contravariant-arg-object.rs @@ -3,6 +3,10 @@ // Test that even when `T` is only used in contravariant position, it // is treated as invariant. +// revisions: base nll +// ignore-compare-mode-nll +//[nll] compile-flags: -Z borrowck=mir + trait Get : 'static { fn get(&self, t: T); } @@ -11,7 +15,9 @@ fn get_min_from_max<'min, 'max>(v: Box>) -> Box> where 'max : 'min { - v //~ ERROR mismatched types + v + //[base]~^ ERROR mismatched types + //[nll]~^^ ERROR lifetime may not live long enough } fn get_max_from_min<'min, 'max, G>(v: Box>) @@ -19,7 +25,9 @@ fn get_max_from_min<'min, 'max, G>(v: Box>) where 'max : 'min { // Previously OK: - v //~ ERROR mismatched types + v + //[base]~^ ERROR mismatched types + //[nll]~^^ ERROR lifetime may not live long enough } fn main() { } diff --git a/src/test/ui/variance/variance-contravariant-arg-trait-match.stderr b/src/test/ui/variance/variance-contravariant-arg-trait-match.base.stderr similarity index 75% rename from src/test/ui/variance/variance-contravariant-arg-trait-match.stderr rename to src/test/ui/variance/variance-contravariant-arg-trait-match.base.stderr index 370e57f73df10..56cf84590107c 100644 --- a/src/test/ui/variance/variance-contravariant-arg-trait-match.stderr +++ b/src/test/ui/variance/variance-contravariant-arg-trait-match.base.stderr @@ -1,5 +1,5 @@ error[E0308]: mismatched types - --> $DIR/variance-contravariant-arg-trait-match.rs:13:5 + --> $DIR/variance-contravariant-arg-trait-match.rs:17:5 | LL | impls_get::() | ^^^^^^^^^^^^^^^^^^^^^^^^ lifetime mismatch @@ -7,18 +7,18 @@ LL | impls_get::() = note: expected type `Get<&'min i32>` found type `Get<&'max i32>` note: the lifetime `'min` as defined here... - --> $DIR/variance-contravariant-arg-trait-match.rs:10:21 + --> $DIR/variance-contravariant-arg-trait-match.rs:14:21 | LL | fn get_min_from_max<'min, 'max, G>() | ^^^^ note: ...does not necessarily outlive the lifetime `'max` as defined here - --> $DIR/variance-contravariant-arg-trait-match.rs:10:27 + --> $DIR/variance-contravariant-arg-trait-match.rs:14:27 | LL | fn get_min_from_max<'min, 'max, G>() | ^^^^ error[E0308]: mismatched types - --> $DIR/variance-contravariant-arg-trait-match.rs:21:5 + --> $DIR/variance-contravariant-arg-trait-match.rs:27:5 | LL | impls_get::() | ^^^^^^^^^^^^^^^^^^^^^^^^ lifetime mismatch @@ -26,12 +26,12 @@ LL | impls_get::() = note: expected type `Get<&'max i32>` found type `Get<&'min i32>` note: the lifetime `'min` as defined here... - --> $DIR/variance-contravariant-arg-trait-match.rs:16:21 + --> $DIR/variance-contravariant-arg-trait-match.rs:22:21 | LL | fn get_max_from_min<'min, 'max, G>() | ^^^^ note: ...does not necessarily outlive the lifetime `'max` as defined here - --> $DIR/variance-contravariant-arg-trait-match.rs:16:27 + --> $DIR/variance-contravariant-arg-trait-match.rs:22:27 | LL | fn get_max_from_min<'min, 'max, G>() | ^^^^ diff --git a/src/test/ui/variance/variance-contravariant-arg-trait-match.nll.stderr b/src/test/ui/variance/variance-contravariant-arg-trait-match.nll.stderr index 6f136750ee13d..6ca8f5ed4cce6 100644 --- a/src/test/ui/variance/variance-contravariant-arg-trait-match.nll.stderr +++ b/src/test/ui/variance/variance-contravariant-arg-trait-match.nll.stderr @@ -1,5 +1,5 @@ error: lifetime may not live long enough - --> $DIR/variance-contravariant-arg-trait-match.rs:13:5 + --> $DIR/variance-contravariant-arg-trait-match.rs:17:5 | LL | fn get_min_from_max<'min, 'max, G>() | ---- ---- lifetime `'max` defined here @@ -12,7 +12,7 @@ LL | impls_get::() = help: consider adding the following bound: `'min: 'max` error: lifetime may not live long enough - --> $DIR/variance-contravariant-arg-trait-match.rs:21:5 + --> $DIR/variance-contravariant-arg-trait-match.rs:27:5 | LL | fn get_max_from_min<'min, 'max, G>() | ---- ---- lifetime `'max` defined here diff --git a/src/test/ui/variance/variance-contravariant-arg-trait-match.rs b/src/test/ui/variance/variance-contravariant-arg-trait-match.rs index 904d93124c988..11513d5411cfb 100644 --- a/src/test/ui/variance/variance-contravariant-arg-trait-match.rs +++ b/src/test/ui/variance/variance-contravariant-arg-trait-match.rs @@ -3,6 +3,10 @@ // Test that even when `T` is only used in contravariant position, it // is treated as invariant. +// revisions: base nll +// ignore-compare-mode-nll +//[nll] compile-flags: -Z borrowck=mir + trait Get { fn get(&self, t: T); } @@ -10,7 +14,9 @@ trait Get { fn get_min_from_max<'min, 'max, G>() where 'max : 'min, G : Get<&'max i32> { - impls_get::() //~ ERROR mismatched types + impls_get::() + //[base]~^ ERROR mismatched types + //[nll]~^^ ERROR lifetime may not live long enough } fn get_max_from_min<'min, 'max, G>() @@ -18,7 +24,9 @@ fn get_max_from_min<'min, 'max, G>() { // Previously OK, but now an error because traits are invariant: - impls_get::() //~ ERROR mismatched types + impls_get::() + //[base]~^ ERROR mismatched types + //[nll]~^^ ERROR lifetime may not live long enough } fn impls_get() where G : Get { } diff --git a/src/test/ui/variance/variance-contravariant-self-trait-match.stderr b/src/test/ui/variance/variance-contravariant-self-trait-match.base.stderr similarity index 75% rename from src/test/ui/variance/variance-contravariant-self-trait-match.stderr rename to src/test/ui/variance/variance-contravariant-self-trait-match.base.stderr index ab14faaa50728..2ccab2ee5f089 100644 --- a/src/test/ui/variance/variance-contravariant-self-trait-match.stderr +++ b/src/test/ui/variance/variance-contravariant-self-trait-match.base.stderr @@ -1,5 +1,5 @@ error[E0308]: mismatched types - --> $DIR/variance-contravariant-self-trait-match.rs:13:5 + --> $DIR/variance-contravariant-self-trait-match.rs:17:5 | LL | impls_get::<&'min G>(); | ^^^^^^^^^^^^^^^^^^^^ lifetime mismatch @@ -7,18 +7,18 @@ LL | impls_get::<&'min G>(); = note: expected type `<&'min G as Get>` found type `<&'max G as Get>` note: the lifetime `'min` as defined here... - --> $DIR/variance-contravariant-self-trait-match.rs:10:21 + --> $DIR/variance-contravariant-self-trait-match.rs:14:21 | LL | fn get_min_from_max<'min, 'max, G>() | ^^^^ note: ...does not necessarily outlive the lifetime `'max` as defined here - --> $DIR/variance-contravariant-self-trait-match.rs:10:27 + --> $DIR/variance-contravariant-self-trait-match.rs:14:27 | LL | fn get_min_from_max<'min, 'max, G>() | ^^^^ error[E0308]: mismatched types - --> $DIR/variance-contravariant-self-trait-match.rs:22:5 + --> $DIR/variance-contravariant-self-trait-match.rs:28:5 | LL | impls_get::<&'max G>(); | ^^^^^^^^^^^^^^^^^^^^ lifetime mismatch @@ -26,12 +26,12 @@ LL | impls_get::<&'max G>(); = note: expected type `<&'max G as Get>` found type `<&'min G as Get>` note: the lifetime `'min` as defined here... - --> $DIR/variance-contravariant-self-trait-match.rs:16:21 + --> $DIR/variance-contravariant-self-trait-match.rs:22:21 | LL | fn get_max_from_min<'min, 'max, G>() | ^^^^ note: ...does not necessarily outlive the lifetime `'max` as defined here - --> $DIR/variance-contravariant-self-trait-match.rs:16:27 + --> $DIR/variance-contravariant-self-trait-match.rs:22:27 | LL | fn get_max_from_min<'min, 'max, G>() | ^^^^ diff --git a/src/test/ui/variance/variance-contravariant-self-trait-match.nll.stderr b/src/test/ui/variance/variance-contravariant-self-trait-match.nll.stderr index fe08ce0b84d21..d2c549b1f715d 100644 --- a/src/test/ui/variance/variance-contravariant-self-trait-match.nll.stderr +++ b/src/test/ui/variance/variance-contravariant-self-trait-match.nll.stderr @@ -1,5 +1,5 @@ error: lifetime may not live long enough - --> $DIR/variance-contravariant-self-trait-match.rs:13:5 + --> $DIR/variance-contravariant-self-trait-match.rs:17:5 | LL | fn get_min_from_max<'min, 'max, G>() | ---- ---- lifetime `'max` defined here @@ -12,7 +12,7 @@ LL | impls_get::<&'min G>(); = help: consider adding the following bound: `'min: 'max` error: lifetime may not live long enough - --> $DIR/variance-contravariant-self-trait-match.rs:22:5 + --> $DIR/variance-contravariant-self-trait-match.rs:28:5 | LL | fn get_max_from_min<'min, 'max, G>() | ---- ---- lifetime `'max` defined here diff --git a/src/test/ui/variance/variance-contravariant-self-trait-match.rs b/src/test/ui/variance/variance-contravariant-self-trait-match.rs index e17375841b81c..f8d7c68fafe73 100644 --- a/src/test/ui/variance/variance-contravariant-self-trait-match.rs +++ b/src/test/ui/variance/variance-contravariant-self-trait-match.rs @@ -3,6 +3,10 @@ // Test that even when `Self` is only used in contravariant position, it // is treated as invariant. +// revisions: base nll +// ignore-compare-mode-nll +//[nll] compile-flags: -Z borrowck=mir + trait Get { fn get(&self); } @@ -10,7 +14,9 @@ trait Get { fn get_min_from_max<'min, 'max, G>() where 'max : 'min, G : 'max, &'max G : Get { - impls_get::<&'min G>(); //~ ERROR mismatched types + impls_get::<&'min G>(); + //[base]~^ ERROR mismatched types + //[nll]~^^ ERROR lifetime may not live long enough } fn get_max_from_min<'min, 'max, G>() @@ -19,7 +25,9 @@ fn get_max_from_min<'min, 'max, G>() // Previously OK, but now error because traits are invariant with // respect to all inputs. - impls_get::<&'max G>(); //~ ERROR mismatched types + impls_get::<&'max G>(); + //[base]~^ ERROR mismatched types + //[nll]~^^ ERROR lifetime may not live long enough } fn impls_get() where G : Get { } diff --git a/src/test/ui/variance/variance-invariant-arg-object.stderr b/src/test/ui/variance/variance-covariant-arg-object.base.stderr similarity index 79% rename from src/test/ui/variance/variance-invariant-arg-object.stderr rename to src/test/ui/variance/variance-covariant-arg-object.base.stderr index 6c1b07e6677e3..3a97875fe0ec0 100644 --- a/src/test/ui/variance/variance-invariant-arg-object.stderr +++ b/src/test/ui/variance/variance-covariant-arg-object.base.stderr @@ -1,5 +1,5 @@ error[E0308]: mismatched types - --> $DIR/variance-invariant-arg-object.rs:11:5 + --> $DIR/variance-covariant-arg-object.rs:19:5 | LL | v | ^ lifetime mismatch @@ -7,18 +7,18 @@ LL | v = note: expected trait object `dyn Get<&'min i32>` found trait object `dyn Get<&'max i32>` note: the lifetime `'min` as defined here... - --> $DIR/variance-invariant-arg-object.rs:7:21 + --> $DIR/variance-covariant-arg-object.rs:14:21 | LL | fn get_min_from_max<'min, 'max>(v: Box>) | ^^^^ note: ...does not necessarily outlive the lifetime `'max` as defined here - --> $DIR/variance-invariant-arg-object.rs:7:27 + --> $DIR/variance-covariant-arg-object.rs:14:27 | LL | fn get_min_from_max<'min, 'max>(v: Box>) | ^^^^ error[E0308]: mismatched types - --> $DIR/variance-invariant-arg-object.rs:18:5 + --> $DIR/variance-covariant-arg-object.rs:28:5 | LL | v | ^ lifetime mismatch @@ -26,12 +26,12 @@ LL | v = note: expected trait object `dyn Get<&'max i32>` found trait object `dyn Get<&'min i32>` note: the lifetime `'min` as defined here... - --> $DIR/variance-invariant-arg-object.rs:14:21 + --> $DIR/variance-covariant-arg-object.rs:24:21 | LL | fn get_max_from_min<'min, 'max, G>(v: Box>) | ^^^^ note: ...does not necessarily outlive the lifetime `'max` as defined here - --> $DIR/variance-invariant-arg-object.rs:14:27 + --> $DIR/variance-covariant-arg-object.rs:24:27 | LL | fn get_max_from_min<'min, 'max, G>(v: Box>) | ^^^^ diff --git a/src/test/ui/variance/variance-covariant-arg-object.nll.stderr b/src/test/ui/variance/variance-covariant-arg-object.nll.stderr index b116b8e263fd2..1b2ec61825f8f 100644 --- a/src/test/ui/variance/variance-covariant-arg-object.nll.stderr +++ b/src/test/ui/variance/variance-covariant-arg-object.nll.stderr @@ -1,5 +1,5 @@ error: lifetime may not live long enough - --> $DIR/variance-covariant-arg-object.rs:15:5 + --> $DIR/variance-covariant-arg-object.rs:19:5 | LL | fn get_min_from_max<'min, 'max>(v: Box>) | ---- ---- lifetime `'max` defined here @@ -12,7 +12,7 @@ LL | v = help: consider adding the following bound: `'min: 'max` error: lifetime may not live long enough - --> $DIR/variance-covariant-arg-object.rs:22:5 + --> $DIR/variance-covariant-arg-object.rs:28:5 | LL | fn get_max_from_min<'min, 'max, G>(v: Box>) | ---- ---- lifetime `'max` defined here diff --git a/src/test/ui/variance/variance-covariant-arg-object.rs b/src/test/ui/variance/variance-covariant-arg-object.rs index 7cbf65ae3d924..20f74a3987e12 100644 --- a/src/test/ui/variance/variance-covariant-arg-object.rs +++ b/src/test/ui/variance/variance-covariant-arg-object.rs @@ -3,6 +3,10 @@ // Test that even when `T` is only used in covariant position, it // is treated as invariant. +// revisions: base nll +// ignore-compare-mode-nll +//[nll] compile-flags: -Z borrowck=mir + trait Get : 'static { fn get(&self) -> T; } @@ -12,14 +16,18 @@ fn get_min_from_max<'min, 'max>(v: Box>) where 'max : 'min { // Previously OK, now an error as traits are invariant. - v //~ ERROR mismatched types + v + //[base]~^ ERROR mismatched types + //[nll]~^^ ERROR lifetime may not live long enough } fn get_max_from_min<'min, 'max, G>(v: Box>) -> Box> where 'max : 'min { - v //~ ERROR mismatched types + v + //[base]~^ ERROR mismatched types + //[nll]~^^ ERROR lifetime may not live long enough } fn main() { } diff --git a/src/test/ui/variance/variance-invariant-arg-trait-match.stderr b/src/test/ui/variance/variance-covariant-arg-trait-match.base.stderr similarity index 76% rename from src/test/ui/variance/variance-invariant-arg-trait-match.stderr rename to src/test/ui/variance/variance-covariant-arg-trait-match.base.stderr index 0328496546eb7..1749a871230cf 100644 --- a/src/test/ui/variance/variance-invariant-arg-trait-match.stderr +++ b/src/test/ui/variance/variance-covariant-arg-trait-match.base.stderr @@ -1,5 +1,5 @@ error[E0308]: mismatched types - --> $DIR/variance-invariant-arg-trait-match.rs:10:5 + --> $DIR/variance-covariant-arg-trait-match.rs:18:5 | LL | impls_get::() | ^^^^^^^^^^^^^^^^^^^^^^^^ lifetime mismatch @@ -7,18 +7,18 @@ LL | impls_get::() = note: expected type `Get<&'min i32>` found type `Get<&'max i32>` note: the lifetime `'min` as defined here... - --> $DIR/variance-invariant-arg-trait-match.rs:7:21 + --> $DIR/variance-covariant-arg-trait-match.rs:14:21 | LL | fn get_min_from_max<'min, 'max, G>() | ^^^^ note: ...does not necessarily outlive the lifetime `'max` as defined here - --> $DIR/variance-invariant-arg-trait-match.rs:7:27 + --> $DIR/variance-covariant-arg-trait-match.rs:14:27 | LL | fn get_min_from_max<'min, 'max, G>() | ^^^^ error[E0308]: mismatched types - --> $DIR/variance-invariant-arg-trait-match.rs:16:5 + --> $DIR/variance-covariant-arg-trait-match.rs:26:5 | LL | impls_get::() | ^^^^^^^^^^^^^^^^^^^^^^^^ lifetime mismatch @@ -26,12 +26,12 @@ LL | impls_get::() = note: expected type `Get<&'max i32>` found type `Get<&'min i32>` note: the lifetime `'min` as defined here... - --> $DIR/variance-invariant-arg-trait-match.rs:13:21 + --> $DIR/variance-covariant-arg-trait-match.rs:23:21 | LL | fn get_max_from_min<'min, 'max, G>() | ^^^^ note: ...does not necessarily outlive the lifetime `'max` as defined here - --> $DIR/variance-invariant-arg-trait-match.rs:13:27 + --> $DIR/variance-covariant-arg-trait-match.rs:23:27 | LL | fn get_max_from_min<'min, 'max, G>() | ^^^^ diff --git a/src/test/ui/variance/variance-covariant-arg-trait-match.nll.stderr b/src/test/ui/variance/variance-covariant-arg-trait-match.nll.stderr index a982a29d499c4..870af48b3e92a 100644 --- a/src/test/ui/variance/variance-covariant-arg-trait-match.nll.stderr +++ b/src/test/ui/variance/variance-covariant-arg-trait-match.nll.stderr @@ -1,5 +1,5 @@ error: lifetime may not live long enough - --> $DIR/variance-covariant-arg-trait-match.rs:14:5 + --> $DIR/variance-covariant-arg-trait-match.rs:18:5 | LL | fn get_min_from_max<'min, 'max, G>() | ---- ---- lifetime `'max` defined here @@ -12,7 +12,7 @@ LL | impls_get::() = help: consider adding the following bound: `'min: 'max` error: lifetime may not live long enough - --> $DIR/variance-covariant-arg-trait-match.rs:20:5 + --> $DIR/variance-covariant-arg-trait-match.rs:26:5 | LL | fn get_max_from_min<'min, 'max, G>() | ---- ---- lifetime `'max` defined here diff --git a/src/test/ui/variance/variance-covariant-arg-trait-match.rs b/src/test/ui/variance/variance-covariant-arg-trait-match.rs index 2d4f0ea158273..d3d66d3fc4ba1 100644 --- a/src/test/ui/variance/variance-covariant-arg-trait-match.rs +++ b/src/test/ui/variance/variance-covariant-arg-trait-match.rs @@ -3,6 +3,10 @@ // Test that even when `T` is only used in covariant position, it // is treated as invariant. +// revisions: base nll +// ignore-compare-mode-nll +//[nll] compile-flags: -Z borrowck=mir + trait Get { fn get(&self) -> T; } @@ -11,13 +15,17 @@ fn get_min_from_max<'min, 'max, G>() where 'max : 'min, G : Get<&'max i32> { // Previously OK, now an error as traits are invariant. - impls_get::() //~ ERROR mismatched types + impls_get::() + //[base]~^ ERROR mismatched types + //[nll]~^^ ERROR lifetime may not live long enough } fn get_max_from_min<'min, 'max, G>() where 'max : 'min, G : Get<&'min i32> { - impls_get::() //~ ERROR mismatched types + impls_get::() + //[base]~^ ERROR mismatched types + //[nll]~^^ ERROR lifetime may not live long enough } fn impls_get() where G : Get { } diff --git a/src/test/ui/variance/variance-covariant-self-trait-match.stderr b/src/test/ui/variance/variance-covariant-self-trait-match.base.stderr similarity index 76% rename from src/test/ui/variance/variance-covariant-self-trait-match.stderr rename to src/test/ui/variance/variance-covariant-self-trait-match.base.stderr index b0bcb2e8422e4..94afc010e2134 100644 --- a/src/test/ui/variance/variance-covariant-self-trait-match.stderr +++ b/src/test/ui/variance/variance-covariant-self-trait-match.base.stderr @@ -1,5 +1,5 @@ error[E0308]: mismatched types - --> $DIR/variance-covariant-self-trait-match.rs:14:5 + --> $DIR/variance-covariant-self-trait-match.rs:18:5 | LL | impls_get::<&'min G>(); | ^^^^^^^^^^^^^^^^^^^^ lifetime mismatch @@ -7,18 +7,18 @@ LL | impls_get::<&'min G>(); = note: expected type `<&'min G as Get>` found type `<&'max G as Get>` note: the lifetime `'min` as defined here... - --> $DIR/variance-covariant-self-trait-match.rs:10:21 + --> $DIR/variance-covariant-self-trait-match.rs:14:21 | LL | fn get_min_from_max<'min, 'max, G>() | ^^^^ note: ...does not necessarily outlive the lifetime `'max` as defined here - --> $DIR/variance-covariant-self-trait-match.rs:10:27 + --> $DIR/variance-covariant-self-trait-match.rs:14:27 | LL | fn get_min_from_max<'min, 'max, G>() | ^^^^ error[E0308]: mismatched types - --> $DIR/variance-covariant-self-trait-match.rs:20:5 + --> $DIR/variance-covariant-self-trait-match.rs:26:5 | LL | impls_get::<&'max G>(); | ^^^^^^^^^^^^^^^^^^^^ lifetime mismatch @@ -26,12 +26,12 @@ LL | impls_get::<&'max G>(); = note: expected type `<&'max G as Get>` found type `<&'min G as Get>` note: the lifetime `'min` as defined here... - --> $DIR/variance-covariant-self-trait-match.rs:17:21 + --> $DIR/variance-covariant-self-trait-match.rs:23:21 | LL | fn get_max_from_min<'min, 'max, G>() | ^^^^ note: ...does not necessarily outlive the lifetime `'max` as defined here - --> $DIR/variance-covariant-self-trait-match.rs:17:27 + --> $DIR/variance-covariant-self-trait-match.rs:23:27 | LL | fn get_max_from_min<'min, 'max, G>() | ^^^^ diff --git a/src/test/ui/variance/variance-covariant-self-trait-match.nll.stderr b/src/test/ui/variance/variance-covariant-self-trait-match.nll.stderr index 81b25e38ec6d8..14da2d2a552db 100644 --- a/src/test/ui/variance/variance-covariant-self-trait-match.nll.stderr +++ b/src/test/ui/variance/variance-covariant-self-trait-match.nll.stderr @@ -1,5 +1,5 @@ error: lifetime may not live long enough - --> $DIR/variance-covariant-self-trait-match.rs:14:5 + --> $DIR/variance-covariant-self-trait-match.rs:18:5 | LL | fn get_min_from_max<'min, 'max, G>() | ---- ---- lifetime `'max` defined here @@ -12,7 +12,7 @@ LL | impls_get::<&'min G>(); = help: consider adding the following bound: `'min: 'max` error: lifetime may not live long enough - --> $DIR/variance-covariant-self-trait-match.rs:20:5 + --> $DIR/variance-covariant-self-trait-match.rs:26:5 | LL | fn get_max_from_min<'min, 'max, G>() | ---- ---- lifetime `'max` defined here diff --git a/src/test/ui/variance/variance-covariant-self-trait-match.rs b/src/test/ui/variance/variance-covariant-self-trait-match.rs index e86a5fc630bd5..ece450173ca8d 100644 --- a/src/test/ui/variance/variance-covariant-self-trait-match.rs +++ b/src/test/ui/variance/variance-covariant-self-trait-match.rs @@ -3,6 +3,10 @@ // Test that even when `Self` is only used in covariant position, it // is treated as invariant. +// revisions: base nll +// ignore-compare-mode-nll +//[nll] compile-flags: -Z borrowck=mir + trait Get { fn get() -> Self; } @@ -11,13 +15,17 @@ fn get_min_from_max<'min, 'max, G>() where 'max : 'min, G : 'max, &'max G : Get { // Previously OK, now an error as traits are invariant. - impls_get::<&'min G>(); //~ ERROR mismatched types + impls_get::<&'min G>(); + //[base]~^ ERROR mismatched types + //[nll]~^^ ERROR lifetime may not live long enough } fn get_max_from_min<'min, 'max, G>() where 'max : 'min, G : 'max, &'min G : Get { - impls_get::<&'max G>(); //~ ERROR mismatched types + impls_get::<&'max G>(); + //[base]~^ ERROR mismatched types + //[nll]~^^ ERROR lifetime may not live long enough } fn impls_get() where G : Get { } diff --git a/src/test/ui/variance/variance-covariant-arg-object.stderr b/src/test/ui/variance/variance-invariant-arg-object.base.stderr similarity index 79% rename from src/test/ui/variance/variance-covariant-arg-object.stderr rename to src/test/ui/variance/variance-invariant-arg-object.base.stderr index d590a4dc2d9d5..ec9271e902fed 100644 --- a/src/test/ui/variance/variance-covariant-arg-object.stderr +++ b/src/test/ui/variance/variance-invariant-arg-object.base.stderr @@ -1,5 +1,5 @@ error[E0308]: mismatched types - --> $DIR/variance-covariant-arg-object.rs:15:5 + --> $DIR/variance-invariant-arg-object.rs:15:5 | LL | v | ^ lifetime mismatch @@ -7,18 +7,18 @@ LL | v = note: expected trait object `dyn Get<&'min i32>` found trait object `dyn Get<&'max i32>` note: the lifetime `'min` as defined here... - --> $DIR/variance-covariant-arg-object.rs:10:21 + --> $DIR/variance-invariant-arg-object.rs:11:21 | LL | fn get_min_from_max<'min, 'max>(v: Box>) | ^^^^ note: ...does not necessarily outlive the lifetime `'max` as defined here - --> $DIR/variance-covariant-arg-object.rs:10:27 + --> $DIR/variance-invariant-arg-object.rs:11:27 | LL | fn get_min_from_max<'min, 'max>(v: Box>) | ^^^^ error[E0308]: mismatched types - --> $DIR/variance-covariant-arg-object.rs:22:5 + --> $DIR/variance-invariant-arg-object.rs:24:5 | LL | v | ^ lifetime mismatch @@ -26,12 +26,12 @@ LL | v = note: expected trait object `dyn Get<&'max i32>` found trait object `dyn Get<&'min i32>` note: the lifetime `'min` as defined here... - --> $DIR/variance-covariant-arg-object.rs:18:21 + --> $DIR/variance-invariant-arg-object.rs:20:21 | LL | fn get_max_from_min<'min, 'max, G>(v: Box>) | ^^^^ note: ...does not necessarily outlive the lifetime `'max` as defined here - --> $DIR/variance-covariant-arg-object.rs:18:27 + --> $DIR/variance-invariant-arg-object.rs:20:27 | LL | fn get_max_from_min<'min, 'max, G>(v: Box>) | ^^^^ diff --git a/src/test/ui/variance/variance-invariant-arg-object.nll.stderr b/src/test/ui/variance/variance-invariant-arg-object.nll.stderr index 303c7f3388a74..47364f4265663 100644 --- a/src/test/ui/variance/variance-invariant-arg-object.nll.stderr +++ b/src/test/ui/variance/variance-invariant-arg-object.nll.stderr @@ -1,5 +1,5 @@ error: lifetime may not live long enough - --> $DIR/variance-invariant-arg-object.rs:11:5 + --> $DIR/variance-invariant-arg-object.rs:15:5 | LL | fn get_min_from_max<'min, 'max>(v: Box>) | ---- ---- lifetime `'max` defined here @@ -12,7 +12,7 @@ LL | v = help: consider adding the following bound: `'min: 'max` error: lifetime may not live long enough - --> $DIR/variance-invariant-arg-object.rs:18:5 + --> $DIR/variance-invariant-arg-object.rs:24:5 | LL | fn get_max_from_min<'min, 'max, G>(v: Box>) | ---- ---- lifetime `'max` defined here diff --git a/src/test/ui/variance/variance-invariant-arg-object.rs b/src/test/ui/variance/variance-invariant-arg-object.rs index 886d263c45768..cc8820fbac69e 100644 --- a/src/test/ui/variance/variance-invariant-arg-object.rs +++ b/src/test/ui/variance/variance-invariant-arg-object.rs @@ -1,5 +1,9 @@ #![allow(dead_code)] +// revisions: base nll +// ignore-compare-mode-nll +//[nll] compile-flags: -Z borrowck=mir + trait Get : 'static { fn get(&self, t: T) -> T; } @@ -8,14 +12,18 @@ fn get_min_from_max<'min, 'max>(v: Box>) -> Box> where 'max : 'min { - v //~ ERROR mismatched types + v + //[base]~^ ERROR mismatched types + //[nll]~^^ ERROR lifetime may not live long enough } fn get_max_from_min<'min, 'max, G>(v: Box>) -> Box> where 'max : 'min { - v //~ ERROR mismatched types + v + //[base]~^ ERROR mismatched types + //[nll]~^^ ERROR lifetime may not live long enough } fn main() { } diff --git a/src/test/ui/variance/variance-covariant-arg-trait-match.stderr b/src/test/ui/variance/variance-invariant-arg-trait-match.base.stderr similarity index 76% rename from src/test/ui/variance/variance-covariant-arg-trait-match.stderr rename to src/test/ui/variance/variance-invariant-arg-trait-match.base.stderr index eb1766b096c07..fe28468215399 100644 --- a/src/test/ui/variance/variance-covariant-arg-trait-match.stderr +++ b/src/test/ui/variance/variance-invariant-arg-trait-match.base.stderr @@ -1,5 +1,5 @@ error[E0308]: mismatched types - --> $DIR/variance-covariant-arg-trait-match.rs:14:5 + --> $DIR/variance-invariant-arg-trait-match.rs:14:5 | LL | impls_get::() | ^^^^^^^^^^^^^^^^^^^^^^^^ lifetime mismatch @@ -7,18 +7,18 @@ LL | impls_get::() = note: expected type `Get<&'min i32>` found type `Get<&'max i32>` note: the lifetime `'min` as defined here... - --> $DIR/variance-covariant-arg-trait-match.rs:10:21 + --> $DIR/variance-invariant-arg-trait-match.rs:11:21 | LL | fn get_min_from_max<'min, 'max, G>() | ^^^^ note: ...does not necessarily outlive the lifetime `'max` as defined here - --> $DIR/variance-covariant-arg-trait-match.rs:10:27 + --> $DIR/variance-invariant-arg-trait-match.rs:11:27 | LL | fn get_min_from_max<'min, 'max, G>() | ^^^^ error[E0308]: mismatched types - --> $DIR/variance-covariant-arg-trait-match.rs:20:5 + --> $DIR/variance-invariant-arg-trait-match.rs:22:5 | LL | impls_get::() | ^^^^^^^^^^^^^^^^^^^^^^^^ lifetime mismatch @@ -26,12 +26,12 @@ LL | impls_get::() = note: expected type `Get<&'max i32>` found type `Get<&'min i32>` note: the lifetime `'min` as defined here... - --> $DIR/variance-covariant-arg-trait-match.rs:17:21 + --> $DIR/variance-invariant-arg-trait-match.rs:19:21 | LL | fn get_max_from_min<'min, 'max, G>() | ^^^^ note: ...does not necessarily outlive the lifetime `'max` as defined here - --> $DIR/variance-covariant-arg-trait-match.rs:17:27 + --> $DIR/variance-invariant-arg-trait-match.rs:19:27 | LL | fn get_max_from_min<'min, 'max, G>() | ^^^^ diff --git a/src/test/ui/variance/variance-invariant-arg-trait-match.nll.stderr b/src/test/ui/variance/variance-invariant-arg-trait-match.nll.stderr index 2909e81fcbf76..74d2745cbbea8 100644 --- a/src/test/ui/variance/variance-invariant-arg-trait-match.nll.stderr +++ b/src/test/ui/variance/variance-invariant-arg-trait-match.nll.stderr @@ -1,5 +1,5 @@ error: lifetime may not live long enough - --> $DIR/variance-invariant-arg-trait-match.rs:10:5 + --> $DIR/variance-invariant-arg-trait-match.rs:14:5 | LL | fn get_min_from_max<'min, 'max, G>() | ---- ---- lifetime `'max` defined here @@ -12,7 +12,7 @@ LL | impls_get::() = help: consider adding the following bound: `'min: 'max` error: lifetime may not live long enough - --> $DIR/variance-invariant-arg-trait-match.rs:16:5 + --> $DIR/variance-invariant-arg-trait-match.rs:22:5 | LL | fn get_max_from_min<'min, 'max, G>() | ---- ---- lifetime `'max` defined here diff --git a/src/test/ui/variance/variance-invariant-arg-trait-match.rs b/src/test/ui/variance/variance-invariant-arg-trait-match.rs index 97d0fdd98e460..498dd574bb381 100644 --- a/src/test/ui/variance/variance-invariant-arg-trait-match.rs +++ b/src/test/ui/variance/variance-invariant-arg-trait-match.rs @@ -1,5 +1,9 @@ #![allow(dead_code)] +// revisions: base nll +// ignore-compare-mode-nll +//[nll] compile-flags: -Z borrowck=mir + trait Get { fn get(&self, t: T) -> T; } @@ -7,13 +11,17 @@ trait Get { fn get_min_from_max<'min, 'max, G>() where 'max : 'min, G : Get<&'max i32> { - impls_get::() //~ ERROR mismatched types + impls_get::() + //[base]~^ ERROR mismatched types + //[nll]~^^ ERROR lifetime may not live long enough } fn get_max_from_min<'min, 'max, G>() where 'max : 'min, G : Get<&'min i32> { - impls_get::() //~ ERROR mismatched types + impls_get::() + //[base]~^ ERROR mismatched types + //[nll]~^^ ERROR lifetime may not live long enough } fn impls_get() where G : Get { } diff --git a/src/test/ui/variance/variance-invariant-self-trait-match.stderr b/src/test/ui/variance/variance-invariant-self-trait-match.base.stderr similarity index 76% rename from src/test/ui/variance/variance-invariant-self-trait-match.stderr rename to src/test/ui/variance/variance-invariant-self-trait-match.base.stderr index c553581b564a0..a2589f0ceee9b 100644 --- a/src/test/ui/variance/variance-invariant-self-trait-match.stderr +++ b/src/test/ui/variance/variance-invariant-self-trait-match.base.stderr @@ -1,5 +1,5 @@ error[E0308]: mismatched types - --> $DIR/variance-invariant-self-trait-match.rs:10:5 + --> $DIR/variance-invariant-self-trait-match.rs:14:5 | LL | impls_get::<&'min G>(); | ^^^^^^^^^^^^^^^^^^^^ lifetime mismatch @@ -7,18 +7,18 @@ LL | impls_get::<&'min G>(); = note: expected type `<&'min G as Get>` found type `<&'max G as Get>` note: the lifetime `'min` as defined here... - --> $DIR/variance-invariant-self-trait-match.rs:7:21 + --> $DIR/variance-invariant-self-trait-match.rs:11:21 | LL | fn get_min_from_max<'min, 'max, G>() | ^^^^ note: ...does not necessarily outlive the lifetime `'max` as defined here - --> $DIR/variance-invariant-self-trait-match.rs:7:27 + --> $DIR/variance-invariant-self-trait-match.rs:11:27 | LL | fn get_min_from_max<'min, 'max, G>() | ^^^^ error[E0308]: mismatched types - --> $DIR/variance-invariant-self-trait-match.rs:16:5 + --> $DIR/variance-invariant-self-trait-match.rs:22:5 | LL | impls_get::<&'max G>(); | ^^^^^^^^^^^^^^^^^^^^ lifetime mismatch @@ -26,12 +26,12 @@ LL | impls_get::<&'max G>(); = note: expected type `<&'max G as Get>` found type `<&'min G as Get>` note: the lifetime `'min` as defined here... - --> $DIR/variance-invariant-self-trait-match.rs:13:21 + --> $DIR/variance-invariant-self-trait-match.rs:19:21 | LL | fn get_max_from_min<'min, 'max, G>() | ^^^^ note: ...does not necessarily outlive the lifetime `'max` as defined here - --> $DIR/variance-invariant-self-trait-match.rs:13:27 + --> $DIR/variance-invariant-self-trait-match.rs:19:27 | LL | fn get_max_from_min<'min, 'max, G>() | ^^^^ diff --git a/src/test/ui/variance/variance-invariant-self-trait-match.nll.stderr b/src/test/ui/variance/variance-invariant-self-trait-match.nll.stderr index 01b2c8803ae72..9d16e89450d78 100644 --- a/src/test/ui/variance/variance-invariant-self-trait-match.nll.stderr +++ b/src/test/ui/variance/variance-invariant-self-trait-match.nll.stderr @@ -1,5 +1,5 @@ error: lifetime may not live long enough - --> $DIR/variance-invariant-self-trait-match.rs:10:5 + --> $DIR/variance-invariant-self-trait-match.rs:14:5 | LL | fn get_min_from_max<'min, 'max, G>() | ---- ---- lifetime `'max` defined here @@ -12,7 +12,7 @@ LL | impls_get::<&'min G>(); = help: consider adding the following bound: `'min: 'max` error: lifetime may not live long enough - --> $DIR/variance-invariant-self-trait-match.rs:16:5 + --> $DIR/variance-invariant-self-trait-match.rs:22:5 | LL | fn get_max_from_min<'min, 'max, G>() | ---- ---- lifetime `'max` defined here diff --git a/src/test/ui/variance/variance-invariant-self-trait-match.rs b/src/test/ui/variance/variance-invariant-self-trait-match.rs index 678eefa634bbd..0f3176b14b44d 100644 --- a/src/test/ui/variance/variance-invariant-self-trait-match.rs +++ b/src/test/ui/variance/variance-invariant-self-trait-match.rs @@ -1,5 +1,9 @@ #![allow(dead_code)] +// revisions: base nll +// ignore-compare-mode-nll +//[nll] compile-flags: -Z borrowck=mir + trait Get { fn get(&self) -> Self; } @@ -7,13 +11,17 @@ trait Get { fn get_min_from_max<'min, 'max, G>() where 'max : 'min, &'max G : Get, G : 'max { - impls_get::<&'min G>(); //~ ERROR mismatched types + impls_get::<&'min G>(); + //[base]~^ ERROR mismatched types + //[nll]~^^ ERROR lifetime may not live long enough } fn get_max_from_min<'min, 'max, G>() where 'max : 'min, &'min G : Get, G : 'min { - impls_get::<&'max G>(); //~ ERROR mismatched types + impls_get::<&'max G>(); + //[base]~^ ERROR mismatched types + //[nll]~^^ ERROR lifetime may not live long enough } fn impls_get() where G : Get { } diff --git a/src/test/ui/variance/variance-trait-matching.stderr b/src/test/ui/variance/variance-trait-matching.base.stderr similarity index 89% rename from src/test/ui/variance/variance-trait-matching.stderr rename to src/test/ui/variance/variance-trait-matching.base.stderr index 514153103bea3..8872620e38aef 100644 --- a/src/test/ui/variance/variance-trait-matching.stderr +++ b/src/test/ui/variance/variance-trait-matching.base.stderr @@ -1,5 +1,5 @@ error[E0621]: explicit lifetime required in the type of `get` - --> $DIR/variance-trait-matching.rs:24:5 + --> $DIR/variance-trait-matching.rs:28:5 | LL | fn get<'a, G>(get: &G) -> i32 | -- help: add explicit lifetime `'a` to the type of `get`: `&'a G` diff --git a/src/test/ui/variance/variance-trait-matching.nll.stderr b/src/test/ui/variance/variance-trait-matching.nll.stderr index 3308cc6d25016..52c5eed3167cd 100644 --- a/src/test/ui/variance/variance-trait-matching.nll.stderr +++ b/src/test/ui/variance/variance-trait-matching.nll.stderr @@ -1,5 +1,5 @@ error[E0621]: explicit lifetime required in the type of `get` - --> $DIR/variance-trait-matching.rs:24:5 + --> $DIR/variance-trait-matching.rs:28:5 | LL | fn get<'a, G>(get: &G) -> i32 | -- help: add explicit lifetime `'a` to the type of `get`: `&'a G` diff --git a/src/test/ui/variance/variance-trait-matching.rs b/src/test/ui/variance/variance-trait-matching.rs index b4efee7d6040f..993db93533e27 100644 --- a/src/test/ui/variance/variance-trait-matching.rs +++ b/src/test/ui/variance/variance-trait-matching.rs @@ -1,5 +1,9 @@ #![allow(dead_code)] +// revisions: base nll +// ignore-compare-mode-nll +//[nll] compile-flags: -Z borrowck=mir + // Get is covariant in T trait Get { fn get(&self) -> T; diff --git a/src/test/ui/variance/variance-use-contravariant-struct-1.stderr b/src/test/ui/variance/variance-use-contravariant-struct-1.base.stderr similarity index 76% rename from src/test/ui/variance/variance-use-contravariant-struct-1.stderr rename to src/test/ui/variance/variance-use-contravariant-struct-1.base.stderr index ec0cb22cdb6ba..a354aa52b5c7e 100644 --- a/src/test/ui/variance/variance-use-contravariant-struct-1.stderr +++ b/src/test/ui/variance/variance-use-contravariant-struct-1.base.stderr @@ -1,5 +1,5 @@ error[E0308]: mismatched types - --> $DIR/variance-use-contravariant-struct-1.rs:12:5 + --> $DIR/variance-use-contravariant-struct-1.rs:14:5 | LL | v | ^ lifetime mismatch @@ -7,12 +7,12 @@ LL | v = note: expected struct `SomeStruct<&'min ()>` found struct `SomeStruct<&'max ()>` note: the lifetime `'min` as defined here... - --> $DIR/variance-use-contravariant-struct-1.rs:8:8 + --> $DIR/variance-use-contravariant-struct-1.rs:10:8 | LL | fn foo<'min,'max>(v: SomeStruct<&'max ()>) | ^^^^ note: ...does not necessarily outlive the lifetime `'max` as defined here - --> $DIR/variance-use-contravariant-struct-1.rs:8:13 + --> $DIR/variance-use-contravariant-struct-1.rs:10:13 | LL | fn foo<'min,'max>(v: SomeStruct<&'max ()>) | ^^^^ diff --git a/src/test/ui/variance/variance-use-contravariant-struct-1.nll.stderr b/src/test/ui/variance/variance-use-contravariant-struct-1.nll.stderr index 837c70ca31367..9549a8c08af61 100644 --- a/src/test/ui/variance/variance-use-contravariant-struct-1.nll.stderr +++ b/src/test/ui/variance/variance-use-contravariant-struct-1.nll.stderr @@ -1,5 +1,5 @@ error: lifetime may not live long enough - --> $DIR/variance-use-contravariant-struct-1.rs:12:5 + --> $DIR/variance-use-contravariant-struct-1.rs:14:5 | LL | fn foo<'min,'max>(v: SomeStruct<&'max ()>) | ---- ---- lifetime `'max` defined here diff --git a/src/test/ui/variance/variance-use-contravariant-struct-1.rs b/src/test/ui/variance/variance-use-contravariant-struct-1.rs index 8a02ef4ec85fd..b55f5e76775ef 100644 --- a/src/test/ui/variance/variance-use-contravariant-struct-1.rs +++ b/src/test/ui/variance/variance-use-contravariant-struct-1.rs @@ -1,7 +1,9 @@ // Test various uses of structs with distint variances to make sure // they permit lifetimes to be approximated as expected. - +// revisions: base nll +// ignore-compare-mode-nll +//[nll] compile-flags: -Z borrowck=mir struct SomeStruct(fn(T)); @@ -9,7 +11,9 @@ fn foo<'min,'max>(v: SomeStruct<&'max ()>) -> SomeStruct<&'min ()> where 'max : 'min { - v //~ ERROR mismatched types + v + //[base]~^ ERROR mismatched types + //[nll]~^^ ERROR lifetime may not live long enough } diff --git a/src/test/ui/variance/variance-use-covariant-struct-1.stderr b/src/test/ui/variance/variance-use-covariant-struct-1.base.stderr similarity index 78% rename from src/test/ui/variance/variance-use-covariant-struct-1.stderr rename to src/test/ui/variance/variance-use-covariant-struct-1.base.stderr index 0c0071cf9e16f..542d44c27093d 100644 --- a/src/test/ui/variance/variance-use-covariant-struct-1.stderr +++ b/src/test/ui/variance/variance-use-covariant-struct-1.base.stderr @@ -1,5 +1,5 @@ error[E0308]: mismatched types - --> $DIR/variance-use-covariant-struct-1.rs:10:5 + --> $DIR/variance-use-covariant-struct-1.rs:14:5 | LL | v | ^ lifetime mismatch @@ -7,12 +7,12 @@ LL | v = note: expected struct `SomeStruct<&'max ()>` found struct `SomeStruct<&'min ()>` note: the lifetime `'min` as defined here... - --> $DIR/variance-use-covariant-struct-1.rs:6:8 + --> $DIR/variance-use-covariant-struct-1.rs:10:8 | LL | fn foo<'min,'max>(v: SomeStruct<&'min ()>) | ^^^^ note: ...does not necessarily outlive the lifetime `'max` as defined here - --> $DIR/variance-use-covariant-struct-1.rs:6:13 + --> $DIR/variance-use-covariant-struct-1.rs:10:13 | LL | fn foo<'min,'max>(v: SomeStruct<&'min ()>) | ^^^^ diff --git a/src/test/ui/variance/variance-use-covariant-struct-1.nll.stderr b/src/test/ui/variance/variance-use-covariant-struct-1.nll.stderr index bab858c5acb37..2fac827a0fb1f 100644 --- a/src/test/ui/variance/variance-use-covariant-struct-1.nll.stderr +++ b/src/test/ui/variance/variance-use-covariant-struct-1.nll.stderr @@ -1,5 +1,5 @@ error: lifetime may not live long enough - --> $DIR/variance-use-covariant-struct-1.rs:10:5 + --> $DIR/variance-use-covariant-struct-1.rs:14:5 | LL | fn foo<'min,'max>(v: SomeStruct<&'min ()>) | ---- ---- lifetime `'max` defined here diff --git a/src/test/ui/variance/variance-use-covariant-struct-1.rs b/src/test/ui/variance/variance-use-covariant-struct-1.rs index e19a35bdfacfe..3e3e76d9792c2 100644 --- a/src/test/ui/variance/variance-use-covariant-struct-1.rs +++ b/src/test/ui/variance/variance-use-covariant-struct-1.rs @@ -1,13 +1,19 @@ // Test that a covariant struct does not permit the lifetime of a // reference to be enlarged. +// revisions: base nll +// ignore-compare-mode-nll +//[nll] compile-flags: -Z borrowck=mir + struct SomeStruct(T); fn foo<'min,'max>(v: SomeStruct<&'min ()>) -> SomeStruct<&'max ()> where 'max : 'min { - v //~ ERROR mismatched types + v + //[base]~^ ERROR mismatched types + //[nll]~^^ ERROR lifetime may not live long enough } fn main() { } diff --git a/src/test/ui/variance/variance-use-invariant-struct-1.stderr b/src/test/ui/variance/variance-use-invariant-struct-1.base.stderr similarity index 76% rename from src/test/ui/variance/variance-use-invariant-struct-1.stderr rename to src/test/ui/variance/variance-use-invariant-struct-1.base.stderr index 76e4bd76b998f..02b4e91f781e5 100644 --- a/src/test/ui/variance/variance-use-invariant-struct-1.stderr +++ b/src/test/ui/variance/variance-use-invariant-struct-1.base.stderr @@ -1,5 +1,5 @@ error[E0308]: mismatched types - --> $DIR/variance-use-invariant-struct-1.rs:12:5 + --> $DIR/variance-use-invariant-struct-1.rs:14:5 | LL | v | ^ lifetime mismatch @@ -7,18 +7,18 @@ LL | v = note: expected struct `SomeStruct<&'min ()>` found struct `SomeStruct<&'max ()>` note: the lifetime `'min` as defined here... - --> $DIR/variance-use-invariant-struct-1.rs:8:8 + --> $DIR/variance-use-invariant-struct-1.rs:10:8 | LL | fn foo<'min,'max>(v: SomeStruct<&'max ()>) | ^^^^ note: ...does not necessarily outlive the lifetime `'max` as defined here - --> $DIR/variance-use-invariant-struct-1.rs:8:13 + --> $DIR/variance-use-invariant-struct-1.rs:10:13 | LL | fn foo<'min,'max>(v: SomeStruct<&'max ()>) | ^^^^ error[E0308]: mismatched types - --> $DIR/variance-use-invariant-struct-1.rs:19:5 + --> $DIR/variance-use-invariant-struct-1.rs:23:5 | LL | v | ^ lifetime mismatch @@ -26,12 +26,12 @@ LL | v = note: expected struct `SomeStruct<&'max ()>` found struct `SomeStruct<&'min ()>` note: the lifetime `'min` as defined here... - --> $DIR/variance-use-invariant-struct-1.rs:15:8 + --> $DIR/variance-use-invariant-struct-1.rs:19:8 | LL | fn bar<'min,'max>(v: SomeStruct<&'min ()>) | ^^^^ note: ...does not necessarily outlive the lifetime `'max` as defined here - --> $DIR/variance-use-invariant-struct-1.rs:15:13 + --> $DIR/variance-use-invariant-struct-1.rs:19:13 | LL | fn bar<'min,'max>(v: SomeStruct<&'min ()>) | ^^^^ diff --git a/src/test/ui/variance/variance-use-invariant-struct-1.nll.stderr b/src/test/ui/variance/variance-use-invariant-struct-1.nll.stderr index 600b245c1f7fd..e8460a388fcab 100644 --- a/src/test/ui/variance/variance-use-invariant-struct-1.nll.stderr +++ b/src/test/ui/variance/variance-use-invariant-struct-1.nll.stderr @@ -1,5 +1,5 @@ error: lifetime may not live long enough - --> $DIR/variance-use-invariant-struct-1.rs:12:5 + --> $DIR/variance-use-invariant-struct-1.rs:14:5 | LL | fn foo<'min,'max>(v: SomeStruct<&'max ()>) | ---- ---- lifetime `'max` defined here @@ -15,7 +15,7 @@ LL | v = help: see for more information about variance error: lifetime may not live long enough - --> $DIR/variance-use-invariant-struct-1.rs:19:5 + --> $DIR/variance-use-invariant-struct-1.rs:23:5 | LL | fn bar<'min,'max>(v: SomeStruct<&'min ()>) | ---- ---- lifetime `'max` defined here diff --git a/src/test/ui/variance/variance-use-invariant-struct-1.rs b/src/test/ui/variance/variance-use-invariant-struct-1.rs index 4772a9fb87829..7be03514e01a9 100644 --- a/src/test/ui/variance/variance-use-invariant-struct-1.rs +++ b/src/test/ui/variance/variance-use-invariant-struct-1.rs @@ -1,7 +1,9 @@ // Test various uses of structs with distint variances to make sure // they permit lifetimes to be approximated as expected. - +// revisions: base nll +// ignore-compare-mode-nll +//[nll] compile-flags: -Z borrowck=mir struct SomeStruct(*mut T); @@ -9,14 +11,18 @@ fn foo<'min,'max>(v: SomeStruct<&'max ()>) -> SomeStruct<&'min ()> where 'max : 'min { - v //~ ERROR mismatched types + v + //[base]~^ ERROR mismatched types + //[nll]~^^ ERROR lifetime may not live long enough } fn bar<'min,'max>(v: SomeStruct<&'min ()>) -> SomeStruct<&'max ()> where 'max : 'min { - v //~ ERROR mismatched types + v + //[base]~^ ERROR mismatched types + //[nll]~^^ ERROR lifetime may not live long enough } diff --git a/src/test/ui/wf/wf-static-method.stderr b/src/test/ui/wf/wf-static-method.base.stderr similarity index 81% rename from src/test/ui/wf/wf-static-method.stderr rename to src/test/ui/wf/wf-static-method.base.stderr index c663931c5d605..186ab2790a398 100644 --- a/src/test/ui/wf/wf-static-method.stderr +++ b/src/test/ui/wf/wf-static-method.base.stderr @@ -1,131 +1,131 @@ error[E0312]: lifetime of reference outlives lifetime of borrowed content... - --> $DIR/wf-static-method.rs:17:9 + --> $DIR/wf-static-method.rs:21:9 | LL | u | ^ | note: ...the reference is valid for the lifetime `'a` as defined here... - --> $DIR/wf-static-method.rs:14:6 + --> $DIR/wf-static-method.rs:18:6 | LL | impl<'a, 'b> Foo<'a, 'b, Evil<'a, 'b>> for () { | ^^ note: ...but the borrowed content is only valid for the lifetime `'b` as defined here - --> $DIR/wf-static-method.rs:14:10 + --> $DIR/wf-static-method.rs:18:10 | LL | impl<'a, 'b> Foo<'a, 'b, Evil<'a, 'b>> for () { | ^^ error[E0478]: lifetime bound not satisfied - --> $DIR/wf-static-method.rs:26:18 + --> $DIR/wf-static-method.rs:32:18 | LL | let me = Self::make_me(); | ^^^^ | note: lifetime parameter instantiated with the lifetime `'b` as defined here - --> $DIR/wf-static-method.rs:23:10 + --> $DIR/wf-static-method.rs:29:10 | LL | impl<'a, 'b> Foo<'a, 'b, ()> for IndirectEvil<'a, 'b> { | ^^ note: but lifetime parameter must outlive the lifetime `'a` as defined here - --> $DIR/wf-static-method.rs:23:6 + --> $DIR/wf-static-method.rs:29:6 | LL | impl<'a, 'b> Foo<'a, 'b, ()> for IndirectEvil<'a, 'b> { | ^^ error[E0312]: lifetime of reference outlives lifetime of borrowed content... - --> $DIR/wf-static-method.rs:33:9 + --> $DIR/wf-static-method.rs:41:9 | LL | u | ^ | note: ...the reference is valid for the lifetime `'a` as defined here... - --> $DIR/wf-static-method.rs:31:6 + --> $DIR/wf-static-method.rs:39:6 | LL | impl<'a, 'b> Evil<'a, 'b> { | ^^ note: ...but the borrowed content is only valid for the lifetime `'b` as defined here - --> $DIR/wf-static-method.rs:31:10 + --> $DIR/wf-static-method.rs:39:10 | LL | impl<'a, 'b> Evil<'a, 'b> { | ^^ error[E0495]: cannot infer an appropriate lifetime for lifetime parameter `'b` due to conflicting requirements - --> $DIR/wf-static-method.rs:41:5 + --> $DIR/wf-static-method.rs:51:5 | LL | <()>::static_evil(b) | ^^^^^^^^^^^^^^^^^ | note: first, the lifetime cannot outlive the lifetime `'b` as defined here... - --> $DIR/wf-static-method.rs:40:13 + --> $DIR/wf-static-method.rs:50:13 | LL | fn evil<'a, 'b>(b: &'b u32) -> &'a u32 { | ^^ note: ...so that reference does not outlive borrowed content - --> $DIR/wf-static-method.rs:41:23 + --> $DIR/wf-static-method.rs:51:23 | LL | <()>::static_evil(b) | ^ note: but, the lifetime must be valid for the lifetime `'a` as defined here... - --> $DIR/wf-static-method.rs:40:9 + --> $DIR/wf-static-method.rs:50:9 | LL | fn evil<'a, 'b>(b: &'b u32) -> &'a u32 { | ^^ note: ...so that reference does not outlive borrowed content - --> $DIR/wf-static-method.rs:41:5 + --> $DIR/wf-static-method.rs:51:5 | LL | <()>::static_evil(b) | ^^^^^^^^^^^^^^^^^^^^ error[E0495]: cannot infer an appropriate lifetime for lifetime parameter `'b` due to conflicting requirements - --> $DIR/wf-static-method.rs:45:5 + --> $DIR/wf-static-method.rs:57:5 | LL | ::static_evil(b) | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ | note: first, the lifetime cannot outlive the lifetime `'b` as defined here... - --> $DIR/wf-static-method.rs:44:22 + --> $DIR/wf-static-method.rs:56:22 | LL | fn indirect_evil<'a, 'b>(b: &'b u32) -> &'a u32 { | ^^ note: ...so that reference does not outlive borrowed content - --> $DIR/wf-static-method.rs:45:33 + --> $DIR/wf-static-method.rs:57:33 | LL | ::static_evil(b) | ^ note: but, the lifetime must be valid for the lifetime `'a` as defined here... - --> $DIR/wf-static-method.rs:44:18 + --> $DIR/wf-static-method.rs:56:18 | LL | fn indirect_evil<'a, 'b>(b: &'b u32) -> &'a u32 { | ^^ note: ...so that reference does not outlive borrowed content - --> $DIR/wf-static-method.rs:45:5 + --> $DIR/wf-static-method.rs:57:5 | LL | ::static_evil(b) | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0495]: cannot infer an appropriate lifetime for lifetime parameter `'b` due to conflicting requirements - --> $DIR/wf-static-method.rs:50:5 + --> $DIR/wf-static-method.rs:63:5 | LL | ::inherent_evil(b) | ^^^^^^^^^^^^^^^^^^^^^ | note: first, the lifetime cannot outlive the lifetime `'b` as defined here... - --> $DIR/wf-static-method.rs:49:22 + --> $DIR/wf-static-method.rs:62:22 | LL | fn inherent_evil<'a, 'b>(b: &'b u32) -> &'a u32 { | ^^ note: ...so that reference does not outlive borrowed content - --> $DIR/wf-static-method.rs:50:27 + --> $DIR/wf-static-method.rs:63:27 | LL | ::inherent_evil(b) | ^ note: but, the lifetime must be valid for the lifetime `'a` as defined here... - --> $DIR/wf-static-method.rs:49:18 + --> $DIR/wf-static-method.rs:62:18 | LL | fn inherent_evil<'a, 'b>(b: &'b u32) -> &'a u32 { | ^^ note: ...so that reference does not outlive borrowed content - --> $DIR/wf-static-method.rs:50:5 + --> $DIR/wf-static-method.rs:63:5 | LL | ::inherent_evil(b) | ^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/src/test/ui/wf/wf-static-method.nll.stderr b/src/test/ui/wf/wf-static-method.nll.stderr index 265043111956a..7556d8e694d5a 100644 --- a/src/test/ui/wf/wf-static-method.nll.stderr +++ b/src/test/ui/wf/wf-static-method.nll.stderr @@ -1,5 +1,5 @@ error: lifetime may not live long enough - --> $DIR/wf-static-method.rs:17:9 + --> $DIR/wf-static-method.rs:21:9 | LL | impl<'a, 'b> Foo<'a, 'b, Evil<'a, 'b>> for () { | -- -- lifetime `'b` defined here @@ -12,7 +12,7 @@ LL | u = help: consider adding the following bound: `'b: 'a` error: lifetime may not live long enough - --> $DIR/wf-static-method.rs:26:18 + --> $DIR/wf-static-method.rs:32:18 | LL | impl<'a, 'b> Foo<'a, 'b, ()> for IndirectEvil<'a, 'b> { | -- -- lifetime `'b` defined here @@ -25,7 +25,7 @@ LL | let me = Self::make_me(); = help: consider adding the following bound: `'b: 'a` error: lifetime may not live long enough - --> $DIR/wf-static-method.rs:33:9 + --> $DIR/wf-static-method.rs:41:9 | LL | impl<'a, 'b> Evil<'a, 'b> { | -- -- lifetime `'b` defined here @@ -38,7 +38,7 @@ LL | u = help: consider adding the following bound: `'b: 'a` error: lifetime may not live long enough - --> $DIR/wf-static-method.rs:41:5 + --> $DIR/wf-static-method.rs:51:5 | LL | fn evil<'a, 'b>(b: &'b u32) -> &'a u32 { | -- -- lifetime `'b` defined here @@ -50,7 +50,7 @@ LL | <()>::static_evil(b) = help: consider adding the following bound: `'b: 'a` error: lifetime may not live long enough - --> $DIR/wf-static-method.rs:45:5 + --> $DIR/wf-static-method.rs:57:5 | LL | fn indirect_evil<'a, 'b>(b: &'b u32) -> &'a u32 { | -- -- lifetime `'b` defined here @@ -62,7 +62,7 @@ LL | ::static_evil(b) = help: consider adding the following bound: `'b: 'a` error: lifetime may not live long enough - --> $DIR/wf-static-method.rs:50:5 + --> $DIR/wf-static-method.rs:63:5 | LL | fn inherent_evil<'a, 'b>(b: &'b u32) -> &'a u32 { | -- -- lifetime `'b` defined here diff --git a/src/test/ui/wf/wf-static-method.rs b/src/test/ui/wf/wf-static-method.rs index 6e805d61265ac..83557ce667bf6 100644 --- a/src/test/ui/wf/wf-static-method.rs +++ b/src/test/ui/wf/wf-static-method.rs @@ -4,6 +4,10 @@ // static inherent methods isn't quite working - need to // fix that before removing the check. +// revisions: base nll +// ignore-compare-mode-nll +//[nll] compile-flags: -Z borrowck=mir + trait Foo<'a, 'b, T>: Sized { fn make_me() -> Self { loop {} } fn static_evil(u: &'b u32) -> &'a u32; @@ -14,7 +18,9 @@ struct Evil<'a, 'b: 'a>(Option<&'a &'b ()>); impl<'a, 'b> Foo<'a, 'b, Evil<'a, 'b>> for () { fn make_me() -> Self { } fn static_evil(u: &'b u32) -> &'a u32 { - u //~ ERROR E0312 + u + //[base]~^ ERROR E0312 + //[nll]~^^ ERROR lifetime may not live long enough } } @@ -23,14 +29,18 @@ struct IndirectEvil<'a, 'b: 'a>(Option<&'a &'b ()>); impl<'a, 'b> Foo<'a, 'b, ()> for IndirectEvil<'a, 'b> { fn make_me() -> Self { IndirectEvil(None) } fn static_evil(u: &'b u32) -> &'a u32 { - let me = Self::make_me(); //~ ERROR lifetime bound not satisfied + let me = Self::make_me(); + //[base]~^ ERROR lifetime bound not satisfied + //[nll]~^^ ERROR lifetime may not live long enough loop {} // (`me` could be used for the lifetime transmute). } } impl<'a, 'b> Evil<'a, 'b> { fn inherent_evil(u: &'b u32) -> &'a u32 { - u //~ ERROR E0312 + u + //[base]~^ ERROR E0312 + //[nll]~^^ ERROR lifetime may not live long enough } } @@ -38,17 +48,21 @@ impl<'a, 'b> Evil<'a, 'b> { // *check* that they hold. fn evil<'a, 'b>(b: &'b u32) -> &'a u32 { - <()>::static_evil(b) //~ ERROR cannot infer an appropriate lifetime + <()>::static_evil(b) + //[base]~^ ERROR cannot infer an appropriate lifetime + //[nll]~^^ ERROR lifetime may not live long enough } fn indirect_evil<'a, 'b>(b: &'b u32) -> &'a u32 { ::static_evil(b) - //~^ ERROR cannot infer an appropriate lifetime + //[base]~^ ERROR cannot infer an appropriate lifetime + //[nll]~^^ ERROR lifetime may not live long enough } fn inherent_evil<'a, 'b>(b: &'b u32) -> &'a u32 { ::inherent_evil(b) - //~^ ERROR cannot infer an appropriate lifetime + //[base]~^ ERROR cannot infer an appropriate lifetime + //[nll]~^^ ERROR lifetime may not live long enough } diff --git a/src/test/ui/where-clauses/where-for-self-2.stderr b/src/test/ui/where-clauses/where-for-self-2.base.stderr similarity index 90% rename from src/test/ui/where-clauses/where-for-self-2.stderr rename to src/test/ui/where-clauses/where-for-self-2.base.stderr index 6da46e20c09c0..c09610cd69682 100644 --- a/src/test/ui/where-clauses/where-for-self-2.stderr +++ b/src/test/ui/where-clauses/where-for-self-2.base.stderr @@ -1,5 +1,5 @@ error: implementation of `Bar` is not general enough - --> $DIR/where-for-self-2.rs:23:5 + --> $DIR/where-for-self-2.rs:27:5 | LL | foo(&X); | ^^^ implementation of `Bar` is not general enough diff --git a/src/test/ui/where-clauses/where-for-self-2.nll.stderr b/src/test/ui/where-clauses/where-for-self-2.nll.stderr index f65db78fc8993..92d1b2121a6b2 100644 --- a/src/test/ui/where-clauses/where-for-self-2.nll.stderr +++ b/src/test/ui/where-clauses/where-for-self-2.nll.stderr @@ -1,5 +1,5 @@ error: implementation of `Bar` is not general enough - --> $DIR/where-for-self-2.rs:23:5 + --> $DIR/where-for-self-2.rs:27:5 | LL | foo(&X); | ^^^^^^^ implementation of `Bar` is not general enough diff --git a/src/test/ui/where-clauses/where-for-self-2.rs b/src/test/ui/where-clauses/where-for-self-2.rs index 37c6954fd52ee..4e4e0ec912ea1 100644 --- a/src/test/ui/where-clauses/where-for-self-2.rs +++ b/src/test/ui/where-clauses/where-for-self-2.rs @@ -3,6 +3,10 @@ // specific lifetime is not enough to satisfy the `for<'a> ...` constraint, which // should require *all* lifetimes. +// revisions: base nll +// ignore-compare-mode-nll +//[nll] compile-flags: -Z borrowck=mir + static X: &'static u32 = &42; trait Bar {