From e10aa1586d49f5fce47cf46a3aaa00a95a50286d Mon Sep 17 00:00:00 2001 From: marmeladema Date: Tue, 19 Apr 2022 12:56:18 +0200 Subject: [PATCH] Use revisions instead of nll compare mode for `/regions/` ui tests --- ...e-28848.stderr => issue-28848.base.stderr} | 6 +- src/test/ui/regions/issue-28848.nll.stderr | 2 +- src/test/ui/regions/issue-28848.rs | 8 +- ...ariant-static-error-reporting.base.stderr} | 4 +- ...nvariant-static-error-reporting.nll.stderr | 2 +- ...region-invariant-static-error-reporting.rs | 12 ++- ...me-bounds-on-fns-where-clause.base.stderr} | 6 +- ...time-bounds-on-fns-where-clause.nll.stderr | 8 +- ...ion-lifetime-bounds-on-fns-where-clause.rs | 16 +++- ...me-bounds-on-fns-where-clause.base.stderr} | 8 +- ...time-bounds-on-fns-where-clause.nll.stderr | 10 +-- ...bounds-on-fns-where-clause.polonius.stderr | 82 ------------------- ...ple-lifetime-bounds-on-fns-where-clause.rs | 19 ++++- ...r => region-object-lifetime-2.base.stderr} | 10 +-- .../region-object-lifetime-2.nll.stderr | 2 +- .../ui/regions/region-object-lifetime-2.rs | 8 +- ...r => region-object-lifetime-4.base.stderr} | 10 +-- .../region-object-lifetime-4.nll.stderr | 2 +- .../ui/regions/region-object-lifetime-4.rs | 8 +- ...n-object-lifetime-in-coercion.base.stderr} | 20 ++--- ...ion-object-lifetime-in-coercion.nll.stderr | 8 +- .../region-object-lifetime-in-coercion.rs | 20 ++++- ...tderr => regions-addr-of-self.base.stderr} | 2 +- .../regions/regions-addr-of-self.nll.stderr | 2 +- src/test/ui/regions/regions-addr-of-self.rs | 8 +- ...=> regions-addr-of-upvar-self.base.stderr} | 8 +- .../regions-addr-of-upvar-self.nll.stderr | 6 +- .../ui/regions/regions-addr-of-upvar-self.rs | 10 ++- ...ded-by-trait-requiring-static.base.stderr} | 24 +++--- ...unded-by-trait-requiring-static.nll.stderr | 12 +-- ...gions-bounded-by-trait-requiring-static.rs | 28 +++++-- ...d-type-parameters-cross-crate.base.stderr} | 2 +- ...hod-type-parameters-cross-crate.nll.stderr | 2 +- ...nded-method-type-parameters-cross-crate.rs | 7 +- ...d-type-parameters-trait-bound.base.stderr} | 2 +- ...hod-type-parameters-trait-bound.nll.stderr | 2 +- ...nded-method-type-parameters-trait-bound.rs | 8 +- ...ounded-method-type-parameters.base.stderr} | 4 +- ...-bounded-method-type-parameters.nll.stderr | 2 +- .../regions-bounded-method-type-parameters.rs | 7 +- ...unds.stderr => regions-bounds.base.stderr} | 12 +-- src/test/ui/regions/regions-bounds.nll.stderr | 4 +- src/test/ui/regions/regions-bounds.rs | 12 ++- ...e-associated-type-into-object.base.stderr} | 8 +- ...ose-associated-type-into-object.nll.stderr | 8 +- ...gions-close-associated-type-into-object.rs | 4 + ...ns-close-object-into-object-2.base.stderr} | 4 +- ...ions-close-object-into-object-2.nll.stderr | 4 +- .../regions-close-object-into-object-2.rs | 9 +- ...ns-close-object-into-object-4.base.stderr} | 4 +- ...ions-close-object-into-object-4.nll.stderr | 12 +-- .../regions-close-object-into-object-4.rs | 14 +++- ...ns-close-object-into-object-5.base.stderr} | 20 ++--- ...ions-close-object-into-object-5.nll.stderr | 10 +-- .../regions-close-object-into-object-5.rs | 11 ++- ...s-close-over-type-parameter-1.base.stderr} | 4 +- ...ons-close-over-type-parameter-1.nll.stderr | 4 +- .../regions-close-over-type-parameter-1.rs | 3 + ...-over-type-parameter-multiple.base.stderr} | 10 +-- ...se-over-type-parameter-multiple.nll.stderr | 2 +- ...ions-close-over-type-parameter-multiple.rs | 7 +- ...gions-close-param-into-object.base.stderr} | 8 +- ...regions-close-param-into-object.nll.stderr | 8 +- .../regions-close-param-into-object.rs | 4 + ...rr => regions-creating-enums3.base.stderr} | 2 +- .../regions-creating-enums3.nll.stderr | 2 +- .../ui/regions/regions-creating-enums3.rs | 8 +- ...rr => regions-creating-enums4.base.stderr} | 10 +-- .../regions-creating-enums4.nll.stderr | 2 +- .../ui/regions/regions-creating-enums4.rs | 8 +- ...ions-early-bound-error-method.base.stderr} | 6 +- ...egions-early-bound-error-method.nll.stderr | 2 +- .../regions-early-bound-error-method.rs | 7 +- ... => regions-early-bound-error.base.stderr} | 6 +- .../regions-early-bound-error.nll.stderr | 2 +- .../ui/regions/regions-early-bound-error.rs | 7 +- ...-subtyping-return-static-fail.base.stderr} | 2 +- ...fn-subtyping-return-static-fail.nll.stderr | 2 +- ...regions-fn-subtyping-return-static-fail.rs | 4 + ...s-free-region-ordering-callee.base.stderr} | 4 +- ...ons-free-region-ordering-callee.nll.stderr | 4 +- .../regions-free-region-ordering-callee.rs | 11 ++- ...ree-region-ordering-incorrect.base.stderr} | 10 +-- ...-free-region-ordering-incorrect.nll.stderr | 2 +- .../regions-free-region-ordering-incorrect.rs | 8 +- ...plied-bounds-projection-gap-1.base.stderr} | 2 +- ...implied-bounds-projection-gap-1.nll.stderr | 2 +- ...regions-implied-bounds-projection-gap-1.rs | 4 + ...s-infer-bound-from-trait-self.base.stderr} | 4 +- ...ons-infer-bound-from-trait-self.nll.stderr | 2 +- .../regions-infer-bound-from-trait-self.rs | 4 + ...egions-infer-bound-from-trait.base.stderr} | 8 +- .../regions-infer-bound-from-trait.nll.stderr | 4 +- .../regions/regions-infer-bound-from-trait.rs | 4 + ...er-contravariance-due-to-decl.base.stderr} | 2 +- ...nfer-contravariance-due-to-decl.nll.stderr | 2 +- ...egions-infer-contravariance-due-to-decl.rs | 8 +- ...-infer-covariance-due-to-decl.base.stderr} | 2 +- ...ns-infer-covariance-due-to-decl.nll.stderr | 2 +- .../regions-infer-covariance-due-to-decl.rs | 8 +- ...-infer-invariance-due-to-decl.base.stderr} | 4 +- ...ns-infer-invariance-due-to-decl.nll.stderr | 2 +- .../regions-infer-invariance-due-to-decl.rs | 8 +- ...nvariance-due-to-mutability-3.base.stderr} | 4 +- ...-invariance-due-to-mutability-3.nll.stderr | 2 +- ...ns-infer-invariance-due-to-mutability-3.rs | 8 +- ...nvariance-due-to-mutability-4.base.stderr} | 4 +- ...-invariance-due-to-mutability-4.nll.stderr | 2 +- ...ns-infer-invariance-due-to-mutability-4.rs | 8 +- ...rr => regions-infer-not-param.base.stderr} | 18 ++-- .../regions-infer-not-param.nll.stderr | 6 +- .../ui/regions/regions-infer-not-param.rs | 23 ++++-- ...regions-infer-paramd-indirect.base.stderr} | 6 +- .../regions-infer-paramd-indirect.nll.stderr | 2 +- .../regions/regions-infer-paramd-indirect.rs | 13 ++- ...egions-lifetime-bounds-on-fns.base.stderr} | 6 +- .../regions-lifetime-bounds-on-fns.nll.stderr | 8 +- .../regions/regions-lifetime-bounds-on-fns.rs | 16 +++- ....stderr => regions-nested-fns.base.stderr} | 24 ++++-- .../ui/regions/regions-nested-fns.nll.stderr | 10 +-- src/test/ui/regions/regions-nested-fns.rs | 14 +++- ...outlives-projection-container.base.stderr} | 24 +++--- ...s-outlives-projection-container.nll.stderr | 8 +- .../regions-outlives-projection-container.rs | 17 +++- ...=> regions-proc-bound-capture.base.stderr} | 4 +- .../regions-proc-bound-capture.nll.stderr | 2 +- .../ui/regions/regions-proc-bound-capture.rs | 8 +- ...-from-shorter-mut-ref-mut-ref.base.stderr} | 2 +- ...ow-from-shorter-mut-ref-mut-ref.nll.stderr | 2 +- ...s-reborrow-from-shorter-mut-ref-mut-ref.rs | 8 +- ...reborrow-from-shorter-mut-ref.base.stderr} | 2 +- ...s-reborrow-from-shorter-mut-ref.nll.stderr | 2 +- .../regions-reborrow-from-shorter-mut-ref.rs | 8 +- ...err => regions-ret-borrowed-1.base.stderr} | 10 +-- .../regions/regions-ret-borrowed-1.nll.stderr | 2 +- src/test/ui/regions/regions-ret-borrowed-1.rs | 7 +- ...tderr => regions-ret-borrowed.base.stderr} | 10 +-- .../regions/regions-ret-borrowed.nll.stderr | 2 +- src/test/ui/regions/regions-ret-borrowed.rs | 7 +- ...tderr => regions-static-bound.base.stderr} | 14 ++-- .../regions/regions-static-bound.nll.stderr | 8 +- src/test/ui/regions/regions-static-bound.rs | 16 +++- ...egions-trait-object-subtyping.base.stderr} | 22 ++--- .../regions-trait-object-subtyping.nll.stderr | 4 +- .../regions/regions-trait-object-subtyping.rs | 14 +++- ...-covariant-in-second-position.base.stderr} | 2 +- ...se-covariant-in-second-position.nll.stderr | 2 +- ...ariant-use-covariant-in-second-position.rs | 8 +- ...e-contravariant-use-covariant.base.stderr} | 2 +- ...nce-contravariant-use-covariant.nll.stderr | 2 +- ...ns-variance-contravariant-use-covariant.rs | 8 +- ...e-covariant-use-contravariant.base.stderr} | 2 +- ...nce-covariant-use-contravariant.nll.stderr | 2 +- ...ns-variance-covariant-use-contravariant.rs | 8 +- ...e-invariant-use-contravariant.base.stderr} | 2 +- ...nce-invariant-use-contravariant.nll.stderr | 2 +- ...ns-variance-invariant-use-contravariant.rs | 8 +- ...iance-invariant-use-covariant.base.stderr} | 4 +- ...ariance-invariant-use-covariant.nll.stderr | 2 +- ...egions-variance-invariant-use-covariant.rs | 8 +- 160 files changed, 743 insertions(+), 470 deletions(-) rename src/test/ui/regions/{issue-28848.stderr => issue-28848.base.stderr} (84%) rename src/test/ui/regions/{region-invariant-static-error-reporting.stderr => region-invariant-static-error-reporting.base.stderr} (86%) rename src/test/ui/regions/{region-lifetime-bounds-on-fns-where-clause.stderr => region-lifetime-bounds-on-fns-where-clause.base.stderr} (85%) rename src/test/ui/regions/{region-multiple-lifetime-bounds-on-fns-where-clause.stderr => region-multiple-lifetime-bounds-on-fns-where-clause.base.stderr} (98%) delete mode 100644 src/test/ui/regions/region-multiple-lifetime-bounds-on-fns-where-clause.polonius.stderr rename src/test/ui/regions/{region-object-lifetime-2.stderr => region-object-lifetime-2.base.stderr} (80%) rename src/test/ui/regions/{region-object-lifetime-4.stderr => region-object-lifetime-4.base.stderr} (80%) rename src/test/ui/regions/{region-object-lifetime-in-coercion.stderr => region-object-lifetime-in-coercion.base.stderr} (87%) rename src/test/ui/regions/{regions-addr-of-self.stderr => regions-addr-of-self.base.stderr} (92%) rename src/test/ui/regions/{regions-addr-of-upvar-self.stderr => regions-addr-of-upvar-self.base.stderr} (82%) rename src/test/ui/regions/{regions-bounded-by-trait-requiring-static.stderr => regions-bounded-by-trait-requiring-static.base.stderr} (74%) rename src/test/ui/regions/{regions-bounded-method-type-parameters-cross-crate.stderr => regions-bounded-method-type-parameters-cross-crate.base.stderr} (98%) rename src/test/ui/regions/{regions-bounded-method-type-parameters-trait-bound.stderr => regions-bounded-method-type-parameters-trait-bound.base.stderr} (98%) rename src/test/ui/regions/{regions-bounded-method-type-parameters.stderr => regions-bounded-method-type-parameters.base.stderr} (77%) rename src/test/ui/regions/{regions-bounds.stderr => regions-bounds.base.stderr} (91%) rename src/test/ui/regions/{regions-close-associated-type-into-object.stderr => regions-close-associated-type-into-object.base.stderr} (85%) rename src/test/ui/regions/{regions-close-object-into-object-2.stderr => regions-close-object-into-object-2.base.stderr} (92%) rename src/test/ui/regions/{regions-close-object-into-object-4.stderr => regions-close-object-into-object-4.base.stderr} (91%) rename src/test/ui/regions/{regions-close-object-into-object-5.stderr => regions-close-object-into-object-5.base.stderr} (84%) rename src/test/ui/regions/{regions-close-over-type-parameter-1.stderr => regions-close-over-type-parameter-1.base.stderr} (89%) rename src/test/ui/regions/{regions-close-over-type-parameter-multiple.stderr => regions-close-over-type-parameter-multiple.base.stderr} (77%) rename src/test/ui/regions/{regions-close-param-into-object.stderr => regions-close-param-into-object.base.stderr} (87%) rename src/test/ui/regions/{regions-creating-enums3.stderr => regions-creating-enums3.base.stderr} (92%) rename src/test/ui/regions/{regions-creating-enums4.stderr => regions-creating-enums4.base.stderr} (81%) rename src/test/ui/regions/{regions-early-bound-error-method.stderr => regions-early-bound-error-method.base.stderr} (76%) rename src/test/ui/regions/{regions-early-bound-error.stderr => regions-early-bound-error.base.stderr} (81%) rename src/test/ui/regions/{regions-fn-subtyping-return-static-fail.stderr => regions-fn-subtyping-return-static-fail.base.stderr} (85%) rename src/test/ui/regions/{regions-free-region-ordering-callee.stderr => regions-free-region-ordering-callee.base.stderr} (90%) rename src/test/ui/regions/{regions-free-region-ordering-incorrect.stderr => regions-free-region-ordering-incorrect.base.stderr} (75%) rename src/test/ui/regions/{regions-implied-bounds-projection-gap-1.stderr => regions-implied-bounds-projection-gap-1.base.stderr} (87%) rename src/test/ui/regions/{regions-infer-bound-from-trait-self.stderr => regions-infer-bound-from-trait-self.base.stderr} (82%) rename src/test/ui/regions/{regions-infer-bound-from-trait.stderr => regions-infer-bound-from-trait.base.stderr} (87%) rename src/test/ui/regions/{regions-infer-contravariance-due-to-decl.stderr => regions-infer-contravariance-due-to-decl.base.stderr} (90%) rename src/test/ui/regions/{regions-infer-covariance-due-to-decl.stderr => regions-infer-covariance-due-to-decl.base.stderr} (89%) rename src/test/ui/regions/{regions-infer-invariance-due-to-decl.stderr => regions-infer-invariance-due-to-decl.base.stderr} (81%) rename src/test/ui/regions/{regions-infer-invariance-due-to-mutability-4.stderr => regions-infer-invariance-due-to-mutability-3.base.stderr} (79%) rename src/test/ui/regions/{regions-infer-invariance-due-to-mutability-3.stderr => regions-infer-invariance-due-to-mutability-4.base.stderr} (79%) rename src/test/ui/regions/{regions-infer-not-param.stderr => regions-infer-not-param.base.stderr} (84%) rename src/test/ui/regions/{regions-infer-paramd-indirect.stderr => regions-infer-paramd-indirect.base.stderr} (79%) rename src/test/ui/regions/{regions-lifetime-bounds-on-fns.stderr => regions-lifetime-bounds-on-fns.base.stderr} (88%) rename src/test/ui/regions/{regions-nested-fns.stderr => regions-nested-fns.base.stderr} (85%) rename src/test/ui/regions/{regions-outlives-projection-container.stderr => regions-outlives-projection-container.base.stderr} (75%) rename src/test/ui/regions/{regions-proc-bound-capture.stderr => regions-proc-bound-capture.base.stderr} (93%) rename src/test/ui/regions/{regions-reborrow-from-shorter-mut-ref-mut-ref.stderr => regions-reborrow-from-shorter-mut-ref-mut-ref.base.stderr} (89%) rename src/test/ui/regions/{regions-reborrow-from-shorter-mut-ref.stderr => regions-reborrow-from-shorter-mut-ref.base.stderr} (90%) rename src/test/ui/regions/{regions-ret-borrowed-1.stderr => regions-ret-borrowed-1.base.stderr} (78%) rename src/test/ui/regions/{regions-ret-borrowed.stderr => regions-ret-borrowed.base.stderr} (79%) rename src/test/ui/regions/{regions-static-bound.stderr => regions-static-bound.base.stderr} (86%) rename src/test/ui/regions/{regions-trait-object-subtyping.stderr => regions-trait-object-subtyping.base.stderr} (76%) rename src/test/ui/regions/{regions-variance-contravariant-use-covariant-in-second-position.stderr => regions-variance-contravariant-use-covariant-in-second-position.base.stderr} (96%) rename src/test/ui/regions/{regions-variance-contravariant-use-covariant.stderr => regions-variance-contravariant-use-covariant.base.stderr} (89%) rename src/test/ui/regions/{regions-variance-covariant-use-contravariant.stderr => regions-variance-covariant-use-contravariant.base.stderr} (88%) rename src/test/ui/regions/{regions-variance-invariant-use-contravariant.stderr => regions-variance-invariant-use-contravariant.base.stderr} (88%) rename src/test/ui/regions/{regions-variance-invariant-use-covariant.stderr => regions-variance-invariant-use-covariant.base.stderr} (80%) diff --git a/src/test/ui/regions/issue-28848.stderr b/src/test/ui/regions/issue-28848.base.stderr similarity index 84% rename from src/test/ui/regions/issue-28848.stderr rename to src/test/ui/regions/issue-28848.base.stderr index afa0c9c76b2..f10b19738c4 100644 --- a/src/test/ui/regions/issue-28848.stderr +++ b/src/test/ui/regions/issue-28848.base.stderr @@ -1,16 +1,16 @@ error[E0478]: lifetime bound not satisfied - --> $DIR/issue-28848.rs:10:5 + --> $DIR/issue-28848.rs:14:5 | LL | Foo::<'a, 'b>::xmute(u) | ^^^^^^^^^^^^^ | note: lifetime parameter instantiated with the lifetime `'b` as defined here - --> $DIR/issue-28848.rs:9:16 + --> $DIR/issue-28848.rs:13:16 | LL | pub fn foo<'a, 'b>(u: &'b ()) -> &'a () { | ^^ note: but lifetime parameter must outlive the lifetime `'a` as defined here - --> $DIR/issue-28848.rs:9:12 + --> $DIR/issue-28848.rs:13:12 | LL | pub fn foo<'a, 'b>(u: &'b ()) -> &'a () { | ^^ diff --git a/src/test/ui/regions/issue-28848.nll.stderr b/src/test/ui/regions/issue-28848.nll.stderr index a29dac4c9c8..f9de8948272 100644 --- a/src/test/ui/regions/issue-28848.nll.stderr +++ b/src/test/ui/regions/issue-28848.nll.stderr @@ -1,5 +1,5 @@ error: lifetime may not live long enough - --> $DIR/issue-28848.rs:10:5 + --> $DIR/issue-28848.rs:14:5 | LL | pub fn foo<'a, 'b>(u: &'b ()) -> &'a () { | -- -- lifetime `'b` defined here diff --git a/src/test/ui/regions/issue-28848.rs b/src/test/ui/regions/issue-28848.rs index a6250239030..d8ab42a08d4 100644 --- a/src/test/ui/regions/issue-28848.rs +++ b/src/test/ui/regions/issue-28848.rs @@ -1,3 +1,7 @@ +// revisions: base nll +// ignore-compare-mode-nll +//[nll] compile-flags: -Z borrowck=mir + struct Foo<'a, 'b: 'a>(&'a &'b ()); impl<'a, 'b> Foo<'a, 'b> { @@ -7,7 +11,9 @@ impl<'a, 'b> Foo<'a, 'b> { } pub fn foo<'a, 'b>(u: &'b ()) -> &'a () { - Foo::<'a, 'b>::xmute(u) //~ ERROR lifetime bound not satisfied + Foo::<'a, 'b>::xmute(u) + //[base]~^ ERROR lifetime bound not satisfied + //[nll]~^^ ERROR lifetime may not live long enough } fn main() {} diff --git a/src/test/ui/regions/region-invariant-static-error-reporting.stderr b/src/test/ui/regions/region-invariant-static-error-reporting.base.stderr similarity index 86% rename from src/test/ui/regions/region-invariant-static-error-reporting.stderr rename to src/test/ui/regions/region-invariant-static-error-reporting.base.stderr index 34287070eec..ce21751a95a 100644 --- a/src/test/ui/regions/region-invariant-static-error-reporting.stderr +++ b/src/test/ui/regions/region-invariant-static-error-reporting.base.stderr @@ -1,5 +1,5 @@ error[E0308]: `if` and `else` have incompatible types - --> $DIR/region-invariant-static-error-reporting.rs:17:9 + --> $DIR/region-invariant-static-error-reporting.rs:21:9 | LL | let bad = if x.is_some() { | _______________- @@ -14,7 +14,7 @@ LL | | }; = note: expected struct `Invariant<'a>` found struct `Invariant<'static>` note: the lifetime `'a` as defined here... - --> $DIR/region-invariant-static-error-reporting.rs:13:10 + --> $DIR/region-invariant-static-error-reporting.rs:17:10 | LL | fn unify<'a>(x: Option>, f: fn(Invariant<'a>)) { | ^^ diff --git a/src/test/ui/regions/region-invariant-static-error-reporting.nll.stderr b/src/test/ui/regions/region-invariant-static-error-reporting.nll.stderr index 6e7eb734a50..6905fd008c5 100644 --- a/src/test/ui/regions/region-invariant-static-error-reporting.nll.stderr +++ b/src/test/ui/regions/region-invariant-static-error-reporting.nll.stderr @@ -1,5 +1,5 @@ error[E0521]: borrowed data escapes outside of function - --> $DIR/region-invariant-static-error-reporting.rs:15:9 + --> $DIR/region-invariant-static-error-reporting.rs:19:9 | LL | fn unify<'a>(x: Option>, f: fn(Invariant<'a>)) { | -- - `x` is a reference that is only valid in the function body diff --git a/src/test/ui/regions/region-invariant-static-error-reporting.rs b/src/test/ui/regions/region-invariant-static-error-reporting.rs index 911904813d0..b81022ca4b4 100644 --- a/src/test/ui/regions/region-invariant-static-error-reporting.rs +++ b/src/test/ui/regions/region-invariant-static-error-reporting.rs @@ -3,8 +3,12 @@ // over time, but this test used to exhibit some pretty bogus messages // that were not remotely helpful. -// error-pattern:the lifetime `'a` -// error-pattern:the static lifetime +// revisions: base nll +// ignore-compare-mode-nll +//[base] error-pattern:the lifetime `'a` +//[base] error-pattern:the static lifetime +//[nll] compile-flags: -Z borrowck=mir +//[nll] error-pattern:argument requires that `'a` must outlive `'static` struct Invariant<'a>(Option<&'a mut &'a mut ()>); @@ -12,9 +16,9 @@ fn mk_static() -> Invariant<'static> { Invariant(None) } fn unify<'a>(x: Option>, f: fn(Invariant<'a>)) { let bad = if x.is_some() { - x.unwrap() + x.unwrap() //[nll]~ ERROR borrowed data escapes outside of function [E0521] } else { - mk_static() + mk_static() //[base]~ ERROR `if` and `else` have incompatible types [E0308] }; f(bad); } diff --git a/src/test/ui/regions/region-lifetime-bounds-on-fns-where-clause.stderr b/src/test/ui/regions/region-lifetime-bounds-on-fns-where-clause.base.stderr similarity index 85% rename from src/test/ui/regions/region-lifetime-bounds-on-fns-where-clause.stderr rename to src/test/ui/regions/region-lifetime-bounds-on-fns-where-clause.base.stderr index b83e07663fa..2ba4f4f5d9f 100644 --- a/src/test/ui/regions/region-lifetime-bounds-on-fns-where-clause.stderr +++ b/src/test/ui/regions/region-lifetime-bounds-on-fns-where-clause.base.stderr @@ -1,5 +1,5 @@ error[E0623]: lifetime mismatch - --> $DIR/region-lifetime-bounds-on-fns-where-clause.rs:8:10 + --> $DIR/region-lifetime-bounds-on-fns-where-clause.rs:12:10 | LL | fn b<'a, 'b>(x: &mut &'a isize, y: &mut &'b isize) { | --------- --------- these two types are declared with different lifetimes... @@ -8,7 +8,7 @@ LL | *x = *y; | ^^ ...but data from `y` flows into `x` here error[E0623]: lifetime mismatch - --> $DIR/region-lifetime-bounds-on-fns-where-clause.rs:14:7 + --> $DIR/region-lifetime-bounds-on-fns-where-clause.rs:20:7 | LL | fn c<'a,'b>(x: &mut &'a isize, y: &mut &'b isize) { | --------- --------- these two types are declared with different lifetimes... @@ -17,7 +17,7 @@ LL | a(x, y); | ^ ...but data from `y` flows into `x` here error[E0308]: mismatched types - --> $DIR/region-lifetime-bounds-on-fns-where-clause.rs:20:43 + --> $DIR/region-lifetime-bounds-on-fns-where-clause.rs:28:43 | LL | let _: fn(&mut &isize, &mut &isize) = a; | ^ one type is more general than the other diff --git a/src/test/ui/regions/region-lifetime-bounds-on-fns-where-clause.nll.stderr b/src/test/ui/regions/region-lifetime-bounds-on-fns-where-clause.nll.stderr index 233a040491c..c6430974334 100644 --- a/src/test/ui/regions/region-lifetime-bounds-on-fns-where-clause.nll.stderr +++ b/src/test/ui/regions/region-lifetime-bounds-on-fns-where-clause.nll.stderr @@ -1,5 +1,5 @@ error: lifetime may not live long enough - --> $DIR/region-lifetime-bounds-on-fns-where-clause.rs:8:5 + --> $DIR/region-lifetime-bounds-on-fns-where-clause.rs:12:5 | LL | fn b<'a, 'b>(x: &mut &'a isize, y: &mut &'b isize) { | -- -- lifetime `'b` defined here @@ -12,7 +12,7 @@ LL | *x = *y; = help: consider adding the following bound: `'b: 'a` error: lifetime may not live long enough - --> $DIR/region-lifetime-bounds-on-fns-where-clause.rs:14:5 + --> $DIR/region-lifetime-bounds-on-fns-where-clause.rs:20:5 | LL | fn c<'a,'b>(x: &mut &'a isize, y: &mut &'b isize) { | -- -- lifetime `'b` defined here @@ -28,7 +28,7 @@ LL | a(x, y); = help: see for more information about variance error[E0308]: mismatched types - --> $DIR/region-lifetime-bounds-on-fns-where-clause.rs:20:12 + --> $DIR/region-lifetime-bounds-on-fns-where-clause.rs:28:12 | LL | let _: fn(&mut &isize, &mut &isize) = a; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ one type is more general than the other @@ -37,7 +37,7 @@ LL | let _: fn(&mut &isize, &mut &isize) = a; found fn pointer `for<'r, 's> fn(&'r mut &isize, &'s mut &isize)` error[E0308]: mismatched types - --> $DIR/region-lifetime-bounds-on-fns-where-clause.rs:20:12 + --> $DIR/region-lifetime-bounds-on-fns-where-clause.rs:28:12 | LL | let _: fn(&mut &isize, &mut &isize) = a; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ one type is more general than the other diff --git a/src/test/ui/regions/region-lifetime-bounds-on-fns-where-clause.rs b/src/test/ui/regions/region-lifetime-bounds-on-fns-where-clause.rs index ab4c6d9cf91..ec91d179808 100644 --- a/src/test/ui/regions/region-lifetime-bounds-on-fns-where-clause.rs +++ b/src/test/ui/regions/region-lifetime-bounds-on-fns-where-clause.rs @@ -1,3 +1,7 @@ +// revisions: base nll +// ignore-compare-mode-nll +//[nll] compile-flags: -Z borrowck=mir + fn a<'a, 'b>(x: &mut &'a isize, y: &mut &'b isize) where 'b: 'a { // Note: this is legal because of the `'b:'a` declaration. *x = *y; @@ -5,19 +9,25 @@ fn a<'a, 'b>(x: &mut &'a isize, y: &mut &'b isize) where 'b: 'a { fn b<'a, 'b>(x: &mut &'a isize, y: &mut &'b isize) { // Illegal now because there is no `'b:'a` declaration. - *x = *y; //~ ERROR E0623 + *x = *y; + //[base]~^ ERROR E0623 + //[nll]~^^ ERROR lifetime may not live long enough } fn c<'a,'b>(x: &mut &'a isize, y: &mut &'b isize) { // Here we try to call `foo` but do not know that `'a` and `'b` are // related as required. - a(x, y); //~ ERROR lifetime mismatch [E0623] + a(x, y); + //[base]~^ ERROR lifetime mismatch [E0623] + //[nll]~^^ ERROR lifetime may not live long enough } fn d() { // 'a and 'b are early bound in the function `a` because they appear // inconstraints: - let _: fn(&mut &isize, &mut &isize) = a; //~ ERROR mismatched types + let _: fn(&mut &isize, &mut &isize) = a; + //~^ ERROR mismatched types [E0308] + //[nll]~^^ ERROR mismatched types [E0308] } fn e() { diff --git a/src/test/ui/regions/region-multiple-lifetime-bounds-on-fns-where-clause.stderr b/src/test/ui/regions/region-multiple-lifetime-bounds-on-fns-where-clause.base.stderr similarity index 98% rename from src/test/ui/regions/region-multiple-lifetime-bounds-on-fns-where-clause.stderr rename to src/test/ui/regions/region-multiple-lifetime-bounds-on-fns-where-clause.base.stderr index c93f2890f11..537a1fb98a5 100644 --- a/src/test/ui/regions/region-multiple-lifetime-bounds-on-fns-where-clause.stderr +++ b/src/test/ui/regions/region-multiple-lifetime-bounds-on-fns-where-clause.base.stderr @@ -1,5 +1,5 @@ error[E0623]: lifetime mismatch - --> $DIR/region-multiple-lifetime-bounds-on-fns-where-clause.rs:9:10 + --> $DIR/region-multiple-lifetime-bounds-on-fns-where-clause.rs:13:10 | LL | fn b<'a, 'b, 'c>(x: &mut &'a isize, y: &mut &'b isize, z: &mut &'c isize) { | --------- --------- these two types are declared with different lifetimes... @@ -8,7 +8,7 @@ LL | *x = *y; | ^^ ...but data from `y` flows into `x` here error[E0623]: lifetime mismatch - --> $DIR/region-multiple-lifetime-bounds-on-fns-where-clause.rs:10:10 + --> $DIR/region-multiple-lifetime-bounds-on-fns-where-clause.rs:16:10 | LL | fn b<'a, 'b, 'c>(x: &mut &'a isize, y: &mut &'b isize, z: &mut &'c isize) { | --------- --------- @@ -19,7 +19,7 @@ LL | *z = *y; | ^^ ...but data from `y` flows into `z` here error[E0623]: lifetime mismatch - --> $DIR/region-multiple-lifetime-bounds-on-fns-where-clause.rs:16:7 + --> $DIR/region-multiple-lifetime-bounds-on-fns-where-clause.rs:22:7 | LL | fn c<'a,'b, 'c>(x: &mut &'a isize, y: &mut &'b isize, z: &mut &'c isize) { | --------- --------- these two types are declared with different lifetimes... @@ -28,7 +28,7 @@ LL | a(x, y, z); | ^ ...but data from `y` flows into `x` here error[E0308]: mismatched types - --> $DIR/region-multiple-lifetime-bounds-on-fns-where-clause.rs:22:56 + --> $DIR/region-multiple-lifetime-bounds-on-fns-where-clause.rs:30:56 | LL | let _: fn(&mut &isize, &mut &isize, &mut &isize) = a; | ^ one type is more general than the other diff --git a/src/test/ui/regions/region-multiple-lifetime-bounds-on-fns-where-clause.nll.stderr b/src/test/ui/regions/region-multiple-lifetime-bounds-on-fns-where-clause.nll.stderr index 00119743acd..053078f58df 100644 --- a/src/test/ui/regions/region-multiple-lifetime-bounds-on-fns-where-clause.nll.stderr +++ b/src/test/ui/regions/region-multiple-lifetime-bounds-on-fns-where-clause.nll.stderr @@ -1,5 +1,5 @@ error: lifetime may not live long enough - --> $DIR/region-multiple-lifetime-bounds-on-fns-where-clause.rs:9:5 + --> $DIR/region-multiple-lifetime-bounds-on-fns-where-clause.rs:13:5 | LL | fn b<'a, 'b, 'c>(x: &mut &'a isize, y: &mut &'b isize, z: &mut &'c isize) { | -- -- lifetime `'b` defined here @@ -12,7 +12,7 @@ LL | *x = *y; = help: consider adding the following bound: `'b: 'a` error: lifetime may not live long enough - --> $DIR/region-multiple-lifetime-bounds-on-fns-where-clause.rs:16:5 + --> $DIR/region-multiple-lifetime-bounds-on-fns-where-clause.rs:22:5 | LL | fn c<'a,'b, 'c>(x: &mut &'a isize, y: &mut &'b isize, z: &mut &'c isize) { | -- -- lifetime `'b` defined here @@ -28,7 +28,7 @@ LL | a(x, y, z); = help: see for more information about variance error[E0308]: mismatched types - --> $DIR/region-multiple-lifetime-bounds-on-fns-where-clause.rs:22:12 + --> $DIR/region-multiple-lifetime-bounds-on-fns-where-clause.rs:30:12 | LL | let _: fn(&mut &isize, &mut &isize, &mut &isize) = a; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ one type is more general than the other @@ -37,7 +37,7 @@ LL | let _: fn(&mut &isize, &mut &isize, &mut &isize) = a; found fn pointer `for<'r, 's, 't0> fn(&'r mut &isize, &'s mut &isize, &'t0 mut &isize)` error[E0308]: mismatched types - --> $DIR/region-multiple-lifetime-bounds-on-fns-where-clause.rs:22:12 + --> $DIR/region-multiple-lifetime-bounds-on-fns-where-clause.rs:30:12 | LL | let _: fn(&mut &isize, &mut &isize, &mut &isize) = a; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ one type is more general than the other @@ -46,7 +46,7 @@ LL | let _: fn(&mut &isize, &mut &isize, &mut &isize) = a; found fn pointer `for<'r, 's, 't0> fn(&'r mut &isize, &'s mut &isize, &'t0 mut &isize)` error[E0308]: mismatched types - --> $DIR/region-multiple-lifetime-bounds-on-fns-where-clause.rs:22:12 + --> $DIR/region-multiple-lifetime-bounds-on-fns-where-clause.rs:30:12 | LL | let _: fn(&mut &isize, &mut &isize, &mut &isize) = a; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ one type is more general than the other diff --git a/src/test/ui/regions/region-multiple-lifetime-bounds-on-fns-where-clause.polonius.stderr b/src/test/ui/regions/region-multiple-lifetime-bounds-on-fns-where-clause.polonius.stderr deleted file mode 100644 index 13741664ef2..00000000000 --- a/src/test/ui/regions/region-multiple-lifetime-bounds-on-fns-where-clause.polonius.stderr +++ /dev/null @@ -1,82 +0,0 @@ -error: lifetime may not live long enough - --> $DIR/region-multiple-lifetime-bounds-on-fns-where-clause.rs:9:5 - | -LL | fn b<'a, 'b, 'c>(x: &mut &'a isize, y: &mut &'b isize, z: &mut &'c isize) { - | -- -- lifetime `'b` defined here - | | - | lifetime `'a` defined here -LL | // Illegal now because there is no `'b:'a` declaration. -LL | *x = *y; - | ^^^^^^^ assignment requires that `'b` must outlive `'a` - | - = help: consider adding the following bound: `'b: 'a` - -error: lifetime may not live long enough - --> $DIR/region-multiple-lifetime-bounds-on-fns-where-clause.rs:10:5 - | -LL | fn b<'a, 'b, 'c>(x: &mut &'a isize, y: &mut &'b isize, z: &mut &'c isize) { - | -- -- lifetime `'c` defined here - | | - | lifetime `'b` defined here -... -LL | *z = *y; - | ^^^^^^^ assignment requires that `'b` must outlive `'c` - | - = help: consider adding the following bound: `'b: 'c` - -help: add bound `'b: 'a + 'c` - -error: lifetime may not live long enough - --> $DIR/region-multiple-lifetime-bounds-on-fns-where-clause.rs:16:5 - | -LL | fn c<'a,'b, 'c>(x: &mut &'a isize, y: &mut &'b isize, z: &mut &'c isize) { - | -- -- lifetime `'b` defined here - | | - | lifetime `'a` defined here -... -LL | a(x, y, z); - | ^^^^^^^^^^ argument requires that `'b` must outlive `'a` - | - = help: consider adding the following bound: `'b: 'a` - = note: requirement occurs because of a mutable reference to &isize - = note: mutable references are invariant over their type parameter - = help: see for more information about variance - -error: lifetime may not live long enough - --> $DIR/region-multiple-lifetime-bounds-on-fns-where-clause.rs:16:5 - | -LL | fn c<'a,'b, 'c>(x: &mut &'a isize, y: &mut &'b isize, z: &mut &'c isize) { - | -- -- lifetime `'c` defined here - | | - | lifetime `'b` defined here -... -LL | a(x, y, z); - | ^^^^^^^^^^ argument requires that `'b` must outlive `'c` - | - = help: consider adding the following bound: `'b: 'c` - = note: requirement occurs because of a mutable reference to &isize - = note: mutable references are invariant over their type parameter - = help: see for more information about variance - -help: add bound `'b: 'a + 'c` - -error: higher-ranked subtype error - --> $DIR/region-multiple-lifetime-bounds-on-fns-where-clause.rs:22:12 - | -LL | let _: fn(&mut &isize, &mut &isize, &mut &isize) = a; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - -error: higher-ranked subtype error - --> $DIR/region-multiple-lifetime-bounds-on-fns-where-clause.rs:22:12 - | -LL | let _: fn(&mut &isize, &mut &isize, &mut &isize) = a; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - -error: higher-ranked subtype error - --> $DIR/region-multiple-lifetime-bounds-on-fns-where-clause.rs:22:12 - | -LL | let _: fn(&mut &isize, &mut &isize, &mut &isize) = a; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - -error: aborting due to 7 previous errors - diff --git a/src/test/ui/regions/region-multiple-lifetime-bounds-on-fns-where-clause.rs b/src/test/ui/regions/region-multiple-lifetime-bounds-on-fns-where-clause.rs index 066522548ad..8b5c1d47ec6 100644 --- a/src/test/ui/regions/region-multiple-lifetime-bounds-on-fns-where-clause.rs +++ b/src/test/ui/regions/region-multiple-lifetime-bounds-on-fns-where-clause.rs @@ -1,3 +1,7 @@ +// revisions: base nll +// ignore-compare-mode-nll +//[nll] compile-flags: -Z borrowck=mir + fn a<'a, 'b, 'c>(x: &mut &'a isize, y: &mut &'b isize, z: &mut &'c isize) where 'b: 'a + 'c { // Note: this is legal because of the `'b:'a` declaration. *x = *y; @@ -6,20 +10,27 @@ fn a<'a, 'b, 'c>(x: &mut &'a isize, y: &mut &'b isize, z: &mut &'c isize) where fn b<'a, 'b, 'c>(x: &mut &'a isize, y: &mut &'b isize, z: &mut &'c isize) { // Illegal now because there is no `'b:'a` declaration. - *x = *y; //~ ERROR E0623 - *z = *y; //~ ERROR E0623 + *x = *y; + //[base]~^ ERROR E0623 + //[nll]~^^ ERROR lifetime may not live long enough + *z = *y; //[base]~ ERROR E0623 } fn c<'a,'b, 'c>(x: &mut &'a isize, y: &mut &'b isize, z: &mut &'c isize) { // Here we try to call `foo` but do not know that `'a` and `'b` are // related as required. - a(x, y, z); //~ ERROR lifetime mismatch [E0623] + a(x, y, z); + //[base]~^ ERROR lifetime mismatch [E0623] + //[nll]~^^ ERROR lifetime may not live long enough } fn d() { // 'a and 'b are early bound in the function `a` because they appear // inconstraints: - let _: fn(&mut &isize, &mut &isize, &mut &isize) = a; //~ ERROR E0308 + let _: fn(&mut &isize, &mut &isize, &mut &isize) = a; + //~^ ERROR E0308 + //[nll]~^^ ERROR mismatched types [E0308] + //[nll]~| ERROR mismatched types [E0308] } fn e() { diff --git a/src/test/ui/regions/region-object-lifetime-2.stderr b/src/test/ui/regions/region-object-lifetime-2.base.stderr similarity index 80% rename from src/test/ui/regions/region-object-lifetime-2.stderr rename to src/test/ui/regions/region-object-lifetime-2.base.stderr index 380e27ab0e0..118fe476500 100644 --- a/src/test/ui/regions/region-object-lifetime-2.stderr +++ b/src/test/ui/regions/region-object-lifetime-2.base.stderr @@ -1,26 +1,26 @@ error[E0495]: cannot infer an appropriate lifetime for autoref due to conflicting requirements - --> $DIR/region-object-lifetime-2.rs:10:7 + --> $DIR/region-object-lifetime-2.rs:14:7 | LL | x.borrowed() | ^^^^^^^^ | note: first, the lifetime cannot outlive the lifetime `'a` as defined here... - --> $DIR/region-object-lifetime-2.rs:9:42 + --> $DIR/region-object-lifetime-2.rs:13:42 | LL | fn borrowed_receiver_different_lifetimes<'a,'b>(x: &'a dyn Foo) -> &'b () { | ^^ note: ...so that reference does not outlive borrowed content - --> $DIR/region-object-lifetime-2.rs:10:5 + --> $DIR/region-object-lifetime-2.rs:14:5 | LL | x.borrowed() | ^ note: but, the lifetime must be valid for the lifetime `'b` as defined here... - --> $DIR/region-object-lifetime-2.rs:9:45 + --> $DIR/region-object-lifetime-2.rs:13:45 | LL | fn borrowed_receiver_different_lifetimes<'a,'b>(x: &'a dyn Foo) -> &'b () { | ^^ note: ...so that reference does not outlive borrowed content - --> $DIR/region-object-lifetime-2.rs:10:5 + --> $DIR/region-object-lifetime-2.rs:14:5 | LL | x.borrowed() | ^^^^^^^^^^^^ diff --git a/src/test/ui/regions/region-object-lifetime-2.nll.stderr b/src/test/ui/regions/region-object-lifetime-2.nll.stderr index d95289f3f9d..c0b09ebb6f5 100644 --- a/src/test/ui/regions/region-object-lifetime-2.nll.stderr +++ b/src/test/ui/regions/region-object-lifetime-2.nll.stderr @@ -1,5 +1,5 @@ error: lifetime may not live long enough - --> $DIR/region-object-lifetime-2.rs:10:5 + --> $DIR/region-object-lifetime-2.rs:14:5 | LL | fn borrowed_receiver_different_lifetimes<'a,'b>(x: &'a dyn Foo) -> &'b () { | -- -- lifetime `'b` defined here diff --git a/src/test/ui/regions/region-object-lifetime-2.rs b/src/test/ui/regions/region-object-lifetime-2.rs index 42798487893..e12b9822f60 100644 --- a/src/test/ui/regions/region-object-lifetime-2.rs +++ b/src/test/ui/regions/region-object-lifetime-2.rs @@ -1,13 +1,19 @@ // Various tests related to testing how region inference works // with respect to the object receivers. +// revisions: base nll +// ignore-compare-mode-nll +//[nll] compile-flags: -Z borrowck=mir + trait Foo { fn borrowed<'a>(&'a self) -> &'a (); } // Borrowed receiver but two distinct lifetimes, we get an error. fn borrowed_receiver_different_lifetimes<'a,'b>(x: &'a dyn Foo) -> &'b () { - x.borrowed() //~ ERROR cannot infer + x.borrowed() + //[base]~^ ERROR cannot infer + //[nll]~^^ ERROR lifetime may not live long enough } fn main() {} diff --git a/src/test/ui/regions/region-object-lifetime-4.stderr b/src/test/ui/regions/region-object-lifetime-4.base.stderr similarity index 80% rename from src/test/ui/regions/region-object-lifetime-4.stderr rename to src/test/ui/regions/region-object-lifetime-4.base.stderr index b59163ef13b..3765076a9c5 100644 --- a/src/test/ui/regions/region-object-lifetime-4.stderr +++ b/src/test/ui/regions/region-object-lifetime-4.base.stderr @@ -1,26 +1,26 @@ error[E0495]: cannot infer an appropriate lifetime for autoref due to conflicting requirements - --> $DIR/region-object-lifetime-4.rs:12:7 + --> $DIR/region-object-lifetime-4.rs:16:7 | LL | x.borrowed() | ^^^^^^^^ | note: first, the lifetime cannot outlive the lifetime `'a` as defined here... - --> $DIR/region-object-lifetime-4.rs:11:41 + --> $DIR/region-object-lifetime-4.rs:15:41 | LL | fn borrowed_receiver_related_lifetimes2<'a,'b>(x: &'a (dyn Foo + 'b)) -> &'b () { | ^^ note: ...so that reference does not outlive borrowed content - --> $DIR/region-object-lifetime-4.rs:12:5 + --> $DIR/region-object-lifetime-4.rs:16:5 | LL | x.borrowed() | ^ note: but, the lifetime must be valid for the lifetime `'b` as defined here... - --> $DIR/region-object-lifetime-4.rs:11:44 + --> $DIR/region-object-lifetime-4.rs:15:44 | LL | fn borrowed_receiver_related_lifetimes2<'a,'b>(x: &'a (dyn Foo + 'b)) -> &'b () { | ^^ note: ...so that reference does not outlive borrowed content - --> $DIR/region-object-lifetime-4.rs:12:5 + --> $DIR/region-object-lifetime-4.rs:16:5 | LL | x.borrowed() | ^^^^^^^^^^^^ diff --git a/src/test/ui/regions/region-object-lifetime-4.nll.stderr b/src/test/ui/regions/region-object-lifetime-4.nll.stderr index fda66a2412c..a2a958f90b2 100644 --- a/src/test/ui/regions/region-object-lifetime-4.nll.stderr +++ b/src/test/ui/regions/region-object-lifetime-4.nll.stderr @@ -1,5 +1,5 @@ error: lifetime may not live long enough - --> $DIR/region-object-lifetime-4.rs:12:5 + --> $DIR/region-object-lifetime-4.rs:16:5 | LL | fn borrowed_receiver_related_lifetimes2<'a,'b>(x: &'a (dyn Foo + 'b)) -> &'b () { | -- -- lifetime `'b` defined here diff --git a/src/test/ui/regions/region-object-lifetime-4.rs b/src/test/ui/regions/region-object-lifetime-4.rs index 4fe12b2acfc..aad9c2c9521 100644 --- a/src/test/ui/regions/region-object-lifetime-4.rs +++ b/src/test/ui/regions/region-object-lifetime-4.rs @@ -1,6 +1,10 @@ // Various tests related to testing how region inference works // with respect to the object receivers. +// revisions: base nll +// ignore-compare-mode-nll +//[nll] compile-flags: -Z borrowck=mir + trait Foo { fn borrowed<'a>(&'a self) -> &'a (); } @@ -9,7 +13,9 @@ trait Foo { // with the longer lifetime when (from the signature) we only know // that it lives as long as the shorter lifetime. Therefore, error. fn borrowed_receiver_related_lifetimes2<'a,'b>(x: &'a (dyn Foo + 'b)) -> &'b () { - x.borrowed() //~ ERROR cannot infer + x.borrowed() + //[base]~^ ERROR cannot infer + //[nll]~^^ ERROR lifetime may not live long enough } fn main() {} diff --git a/src/test/ui/regions/region-object-lifetime-in-coercion.stderr b/src/test/ui/regions/region-object-lifetime-in-coercion.base.stderr similarity index 87% rename from src/test/ui/regions/region-object-lifetime-in-coercion.stderr rename to src/test/ui/regions/region-object-lifetime-in-coercion.base.stderr index d8932c067ac..85bfa16b3d3 100644 --- a/src/test/ui/regions/region-object-lifetime-in-coercion.stderr +++ b/src/test/ui/regions/region-object-lifetime-in-coercion.base.stderr @@ -1,5 +1,5 @@ error[E0759]: `v` has an anonymous lifetime `'_` but it needs to satisfy a `'static` lifetime requirement - --> $DIR/region-object-lifetime-in-coercion.rs:8:46 + --> $DIR/region-object-lifetime-in-coercion.rs:12:46 | LL | fn a(v: &[u8]) -> Box { | ----- this data with an anonymous lifetime `'_`... @@ -16,7 +16,7 @@ LL | fn a(v: &'static [u8]) -> Box { | ~~~~~~~~~~~~~ error[E0759]: `v` has an anonymous lifetime `'_` but it needs to satisfy a `'static` lifetime requirement - --> $DIR/region-object-lifetime-in-coercion.rs:13:14 + --> $DIR/region-object-lifetime-in-coercion.rs:19:14 | LL | fn b(v: &[u8]) -> Box { | ----- this data with an anonymous lifetime `'_`... @@ -24,7 +24,7 @@ LL | Box::new(v) | ^ ...is used and required to live as long as `'static` here | note: `'static` lifetime requirement introduced by the return type - --> $DIR/region-object-lifetime-in-coercion.rs:12:33 + --> $DIR/region-object-lifetime-in-coercion.rs:18:33 | LL | fn b(v: &[u8]) -> Box { | ^^^^^^^ `'static` requirement introduced here @@ -40,7 +40,7 @@ LL | fn b(v: &'static [u8]) -> Box { | ~~~~~~~~~~~~~ error[E0759]: `v` has an anonymous lifetime `'_` but it needs to satisfy a `'static` lifetime requirement - --> $DIR/region-object-lifetime-in-coercion.rs:19:14 + --> $DIR/region-object-lifetime-in-coercion.rs:27:14 | LL | fn c(v: &[u8]) -> Box { | ----- this data with an anonymous lifetime `'_`... @@ -49,7 +49,7 @@ LL | Box::new(v) | ^ ...is used and required to live as long as `'static` here | note: `'static` lifetime requirement introduced by the return type - --> $DIR/region-object-lifetime-in-coercion.rs:16:23 + --> $DIR/region-object-lifetime-in-coercion.rs:24:23 | LL | fn c(v: &[u8]) -> Box { | ^^^^^^^ `'static` requirement introduced here @@ -62,30 +62,30 @@ LL | fn c(v: &[u8]) -> Box { | ++++ error[E0495]: cannot infer an appropriate lifetime due to conflicting requirements - --> $DIR/region-object-lifetime-in-coercion.rs:23:14 + --> $DIR/region-object-lifetime-in-coercion.rs:33:14 | LL | Box::new(v) | ^ | note: first, the lifetime cannot outlive the lifetime `'a` as defined here... - --> $DIR/region-object-lifetime-in-coercion.rs:22:6 + --> $DIR/region-object-lifetime-in-coercion.rs:32:6 | LL | fn d<'a,'b>(v: &'a [u8]) -> Box { | ^^ note: ...so that the expression is assignable - --> $DIR/region-object-lifetime-in-coercion.rs:23:14 + --> $DIR/region-object-lifetime-in-coercion.rs:33:14 | LL | Box::new(v) | ^ = note: expected `&[u8]` found `&'a [u8]` note: but, the lifetime must be valid for the lifetime `'b` as defined here... - --> $DIR/region-object-lifetime-in-coercion.rs:22:9 + --> $DIR/region-object-lifetime-in-coercion.rs:32:9 | LL | fn d<'a,'b>(v: &'a [u8]) -> Box { | ^^ note: ...so that the types are compatible - --> $DIR/region-object-lifetime-in-coercion.rs:23:5 + --> $DIR/region-object-lifetime-in-coercion.rs:33:5 | LL | Box::new(v) | ^^^^^^^^^^^ diff --git a/src/test/ui/regions/region-object-lifetime-in-coercion.nll.stderr b/src/test/ui/regions/region-object-lifetime-in-coercion.nll.stderr index 92588819076..4d72724586e 100644 --- a/src/test/ui/regions/region-object-lifetime-in-coercion.nll.stderr +++ b/src/test/ui/regions/region-object-lifetime-in-coercion.nll.stderr @@ -1,5 +1,5 @@ error: lifetime may not live long enough - --> $DIR/region-object-lifetime-in-coercion.rs:8:12 + --> $DIR/region-object-lifetime-in-coercion.rs:12:12 | LL | fn a(v: &[u8]) -> Box { | - let's call the lifetime of this reference `'1` @@ -7,7 +7,7 @@ LL | let x: Box = Box::new(v); | ^^^^^^^^^^^^^^^^^^^^^^ type annotation requires that `'1` must outlive `'static` error: lifetime may not live long enough - --> $DIR/region-object-lifetime-in-coercion.rs:13:5 + --> $DIR/region-object-lifetime-in-coercion.rs:19:5 | LL | fn b(v: &[u8]) -> Box { | - let's call the lifetime of this reference `'1` @@ -15,7 +15,7 @@ LL | Box::new(v) | ^^^^^^^^^^^ returning this value requires that `'1` must outlive `'static` error: lifetime may not live long enough - --> $DIR/region-object-lifetime-in-coercion.rs:19:5 + --> $DIR/region-object-lifetime-in-coercion.rs:27:5 | LL | fn c(v: &[u8]) -> Box { | - let's call the lifetime of this reference `'1` @@ -24,7 +24,7 @@ LL | Box::new(v) | ^^^^^^^^^^^ returning this value requires that `'1` must outlive `'static` error: lifetime may not live long enough - --> $DIR/region-object-lifetime-in-coercion.rs:23:5 + --> $DIR/region-object-lifetime-in-coercion.rs:33:5 | LL | fn d<'a,'b>(v: &'a [u8]) -> Box { | -- -- lifetime `'b` defined here diff --git a/src/test/ui/regions/region-object-lifetime-in-coercion.rs b/src/test/ui/regions/region-object-lifetime-in-coercion.rs index 9d3f485e314..ed28d6c0ff1 100644 --- a/src/test/ui/regions/region-object-lifetime-in-coercion.rs +++ b/src/test/ui/regions/region-object-lifetime-in-coercion.rs @@ -1,26 +1,38 @@ // Test that attempts to implicitly coerce a value into an // object respect the lifetime bound on the object type. +// revisions: base nll +// ignore-compare-mode-nll +//[nll] compile-flags: -Z borrowck=mir + trait Foo {} impl<'a> Foo for &'a [u8] {} fn a(v: &[u8]) -> Box { - let x: Box = Box::new(v); //~ ERROR E0759 + let x: Box = Box::new(v); + //[base]~^ ERROR E0759 + //[nll]~^^ ERROR lifetime may not live long enough x } fn b(v: &[u8]) -> Box { - Box::new(v) //~ ERROR E0759 + Box::new(v) + //[base]~^ ERROR E0759 + //[nll]~^^ ERROR lifetime may not live long enough } fn c(v: &[u8]) -> Box { // same as previous case due to RFC 599 - Box::new(v) //~ ERROR E0759 + Box::new(v) + //[base]~^ ERROR E0759 + //[nll]~^^ ERROR lifetime may not live long enough } fn d<'a,'b>(v: &'a [u8]) -> Box { - Box::new(v) //~ ERROR cannot infer an appropriate lifetime due to conflicting + Box::new(v) + //[base]~^ ERROR cannot infer an appropriate lifetime due to conflicting + //[nll]~^^ ERROR lifetime may not live long enough } fn e<'a:'b,'b>(v: &'a [u8]) -> Box { diff --git a/src/test/ui/regions/regions-addr-of-self.stderr b/src/test/ui/regions/regions-addr-of-self.base.stderr similarity index 92% rename from src/test/ui/regions/regions-addr-of-self.stderr rename to src/test/ui/regions/regions-addr-of-self.base.stderr index 3453c6458f1..3167c2f2107 100644 --- a/src/test/ui/regions/regions-addr-of-self.stderr +++ b/src/test/ui/regions/regions-addr-of-self.base.stderr @@ -1,5 +1,5 @@ error[E0759]: `self` has an anonymous lifetime `'_` but it needs to satisfy a `'static` lifetime requirement - --> $DIR/regions-addr-of-self.rs:7:37 + --> $DIR/regions-addr-of-self.rs:11:37 | LL | pub fn chase_cat(&mut self) { | --------- this data with an anonymous lifetime `'_`... diff --git a/src/test/ui/regions/regions-addr-of-self.nll.stderr b/src/test/ui/regions/regions-addr-of-self.nll.stderr index 3d7aac74bd4..1f720520f6b 100644 --- a/src/test/ui/regions/regions-addr-of-self.nll.stderr +++ b/src/test/ui/regions/regions-addr-of-self.nll.stderr @@ -1,5 +1,5 @@ error: lifetime may not live long enough - --> $DIR/regions-addr-of-self.rs:7:16 + --> $DIR/regions-addr-of-self.rs:11:16 | LL | pub fn chase_cat(&mut self) { | - let's call the lifetime of this reference `'1` diff --git a/src/test/ui/regions/regions-addr-of-self.rs b/src/test/ui/regions/regions-addr-of-self.rs index 4eb1b275f16..698433c71b3 100644 --- a/src/test/ui/regions/regions-addr-of-self.rs +++ b/src/test/ui/regions/regions-addr-of-self.rs @@ -1,10 +1,16 @@ +// revisions: base nll +// ignore-compare-mode-nll +//[nll] compile-flags: -Z borrowck=mir + struct Dog { cats_chased: usize, } impl Dog { pub fn chase_cat(&mut self) { - let p: &'static mut usize = &mut self.cats_chased; //~ ERROR E0759 + let p: &'static mut usize = &mut self.cats_chased; + //[base]~^ ERROR E0759 + //[nll]~^^ ERROR lifetime may not live long enough *p += 1; } diff --git a/src/test/ui/regions/regions-addr-of-upvar-self.stderr b/src/test/ui/regions/regions-addr-of-upvar-self.base.stderr similarity index 82% rename from src/test/ui/regions/regions-addr-of-upvar-self.stderr rename to src/test/ui/regions/regions-addr-of-upvar-self.base.stderr index f638064ef83..42d0638e8b7 100644 --- a/src/test/ui/regions/regions-addr-of-upvar-self.stderr +++ b/src/test/ui/regions/regions-addr-of-upvar-self.base.stderr @@ -1,22 +1,22 @@ error[E0495]: cannot infer an appropriate lifetime for borrow expression due to conflicting requirements - --> $DIR/regions-addr-of-upvar-self.rs:8:41 + --> $DIR/regions-addr-of-upvar-self.rs:12:41 | LL | let p: &'static mut usize = &mut self.food; | ^^^^^^^^^^^^^^ | note: first, the lifetime cannot outlive the lifetime `'_` as defined here... - --> $DIR/regions-addr-of-upvar-self.rs:7:18 + --> $DIR/regions-addr-of-upvar-self.rs:11:18 | LL | let _f = || { | ^^ note: ...so that closure can access `self` - --> $DIR/regions-addr-of-upvar-self.rs:8:41 + --> $DIR/regions-addr-of-upvar-self.rs:12:41 | LL | let p: &'static mut usize = &mut self.food; | ^^^^^^^^^^^^^^ = note: but, the lifetime must be valid for the static lifetime... note: ...so that reference does not outlive borrowed content - --> $DIR/regions-addr-of-upvar-self.rs:8:41 + --> $DIR/regions-addr-of-upvar-self.rs:12:41 | LL | let p: &'static mut usize = &mut self.food; | ^^^^^^^^^^^^^^ diff --git a/src/test/ui/regions/regions-addr-of-upvar-self.nll.stderr b/src/test/ui/regions/regions-addr-of-upvar-self.nll.stderr index c16a6f8585b..b8e37e92316 100644 --- a/src/test/ui/regions/regions-addr-of-upvar-self.nll.stderr +++ b/src/test/ui/regions/regions-addr-of-upvar-self.nll.stderr @@ -1,5 +1,5 @@ error: lifetime may not live long enough - --> $DIR/regions-addr-of-upvar-self.rs:8:20 + --> $DIR/regions-addr-of-upvar-self.rs:12:20 | LL | let _f = || { | -- lifetime `'1` represents this closure's body @@ -9,7 +9,7 @@ LL | let p: &'static mut usize = &mut self.food; = note: closure implements `FnMut`, so references to captured variables can't escape the closure error: lifetime may not live long enough - --> $DIR/regions-addr-of-upvar-self.rs:8:20 + --> $DIR/regions-addr-of-upvar-self.rs:12:20 | LL | pub fn chase_cat(&mut self) { | - let's call the lifetime of this reference `'1` @@ -18,7 +18,7 @@ LL | let p: &'static mut usize = &mut self.food; | ^^^^^^^^^^^^^^^^^^ type annotation requires that `'1` must outlive `'static` error[E0597]: `self` does not live long enough - --> $DIR/regions-addr-of-upvar-self.rs:8:46 + --> $DIR/regions-addr-of-upvar-self.rs:12:46 | LL | let _f = || { | -- value captured here diff --git a/src/test/ui/regions/regions-addr-of-upvar-self.rs b/src/test/ui/regions/regions-addr-of-upvar-self.rs index 6159ab02d3d..36cc592d47c 100644 --- a/src/test/ui/regions/regions-addr-of-upvar-self.rs +++ b/src/test/ui/regions/regions-addr-of-upvar-self.rs @@ -1,3 +1,7 @@ +// revisions: base nll +// ignore-compare-mode-nll +//[nll] compile-flags: -Z borrowck=mir + struct Dog { food: usize, } @@ -5,7 +9,11 @@ struct Dog { impl Dog { pub fn chase_cat(&mut self) { let _f = || { - let p: &'static mut usize = &mut self.food; //~ ERROR cannot infer + let p: &'static mut usize = &mut self.food; + //[base]~^ ERROR cannot infer + //[nll]~^^ ERROR lifetime may not live long enough + //[nll]~^^^ ERROR lifetime may not live long enough + //[nll]~^^^^ ERROR E0597 *p = 3; }; } diff --git a/src/test/ui/regions/regions-bounded-by-trait-requiring-static.stderr b/src/test/ui/regions/regions-bounded-by-trait-requiring-static.base.stderr similarity index 74% rename from src/test/ui/regions/regions-bounded-by-trait-requiring-static.stderr rename to src/test/ui/regions/regions-bounded-by-trait-requiring-static.base.stderr index 68b90eee72d..9b45dcfd95a 100644 --- a/src/test/ui/regions/regions-bounded-by-trait-requiring-static.stderr +++ b/src/test/ui/regions/regions-bounded-by-trait-requiring-static.base.stderr @@ -1,71 +1,71 @@ error[E0477]: the type `&'a isize` does not fulfill the required lifetime - --> $DIR/regions-bounded-by-trait-requiring-static.rs:22:5 + --> $DIR/regions-bounded-by-trait-requiring-static.rs:26:5 | LL | assert_send::<&'a isize>(); | ^^^^^^^^^^^^^^^^^^^^^^^^ | note: type must satisfy the static lifetime as required by this binding - --> $DIR/regions-bounded-by-trait-requiring-static.rs:6:18 + --> $DIR/regions-bounded-by-trait-requiring-static.rs:10:18 | LL | fn assert_send() { } | ^^^^^^^ error[E0477]: the type `&'a str` does not fulfill the required lifetime - --> $DIR/regions-bounded-by-trait-requiring-static.rs:26:5 + --> $DIR/regions-bounded-by-trait-requiring-static.rs:32:5 | LL | assert_send::<&'a str>(); | ^^^^^^^^^^^^^^^^^^^^^^ | note: type must satisfy the static lifetime as required by this binding - --> $DIR/regions-bounded-by-trait-requiring-static.rs:6:18 + --> $DIR/regions-bounded-by-trait-requiring-static.rs:10:18 | LL | fn assert_send() { } | ^^^^^^^ error[E0477]: the type `&'a [isize]` does not fulfill the required lifetime - --> $DIR/regions-bounded-by-trait-requiring-static.rs:30:5 + --> $DIR/regions-bounded-by-trait-requiring-static.rs:38:5 | LL | assert_send::<&'a [isize]>(); | ^^^^^^^^^^^^^^^^^^^^^^^^^^ | note: type must satisfy the static lifetime as required by this binding - --> $DIR/regions-bounded-by-trait-requiring-static.rs:6:18 + --> $DIR/regions-bounded-by-trait-requiring-static.rs:10:18 | LL | fn assert_send() { } | ^^^^^^^ error[E0477]: the type `Box<&'a isize>` does not fulfill the required lifetime - --> $DIR/regions-bounded-by-trait-requiring-static.rs:44:5 + --> $DIR/regions-bounded-by-trait-requiring-static.rs:54:5 | LL | assert_send::>(); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | note: type must satisfy the static lifetime as required by this binding - --> $DIR/regions-bounded-by-trait-requiring-static.rs:6:18 + --> $DIR/regions-bounded-by-trait-requiring-static.rs:10:18 | LL | fn assert_send() { } | ^^^^^^^ error[E0477]: the type `*const &'a isize` does not fulfill the required lifetime - --> $DIR/regions-bounded-by-trait-requiring-static.rs:55:5 + --> $DIR/regions-bounded-by-trait-requiring-static.rs:67:5 | LL | assert_send::<*const &'a isize>(); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | note: type must satisfy the static lifetime as required by this binding - --> $DIR/regions-bounded-by-trait-requiring-static.rs:6:18 + --> $DIR/regions-bounded-by-trait-requiring-static.rs:10:18 | LL | fn assert_send() { } | ^^^^^^^ error[E0477]: the type `*mut &'a isize` does not fulfill the required lifetime - --> $DIR/regions-bounded-by-trait-requiring-static.rs:59:5 + --> $DIR/regions-bounded-by-trait-requiring-static.rs:73:5 | LL | assert_send::<*mut &'a isize>(); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | note: type must satisfy the static lifetime as required by this binding - --> $DIR/regions-bounded-by-trait-requiring-static.rs:6:18 + --> $DIR/regions-bounded-by-trait-requiring-static.rs:10:18 | LL | fn assert_send() { } | ^^^^^^^ diff --git a/src/test/ui/regions/regions-bounded-by-trait-requiring-static.nll.stderr b/src/test/ui/regions/regions-bounded-by-trait-requiring-static.nll.stderr index 86bd100538d..558a77516bb 100644 --- a/src/test/ui/regions/regions-bounded-by-trait-requiring-static.nll.stderr +++ b/src/test/ui/regions/regions-bounded-by-trait-requiring-static.nll.stderr @@ -1,5 +1,5 @@ error: lifetime may not live long enough - --> $DIR/regions-bounded-by-trait-requiring-static.rs:22:5 + --> $DIR/regions-bounded-by-trait-requiring-static.rs:26:5 | LL | fn param_not_ok<'a>(x: &'a isize) { | -- lifetime `'a` defined here @@ -7,7 +7,7 @@ LL | assert_send::<&'a isize>(); | ^^^^^^^^^^^^^^^^^^^^^^^^ requires that `'a` must outlive `'static` error: lifetime may not live long enough - --> $DIR/regions-bounded-by-trait-requiring-static.rs:26:5 + --> $DIR/regions-bounded-by-trait-requiring-static.rs:32:5 | LL | fn param_not_ok1<'a>(_: &'a isize) { | -- lifetime `'a` defined here @@ -15,7 +15,7 @@ LL | assert_send::<&'a str>(); | ^^^^^^^^^^^^^^^^^^^^^^ requires that `'a` must outlive `'static` error: lifetime may not live long enough - --> $DIR/regions-bounded-by-trait-requiring-static.rs:30:5 + --> $DIR/regions-bounded-by-trait-requiring-static.rs:38:5 | LL | fn param_not_ok2<'a>(_: &'a isize) { | -- lifetime `'a` defined here @@ -23,7 +23,7 @@ LL | assert_send::<&'a [isize]>(); | ^^^^^^^^^^^^^^^^^^^^^^^^^^ requires that `'a` must outlive `'static` error: lifetime may not live long enough - --> $DIR/regions-bounded-by-trait-requiring-static.rs:44:5 + --> $DIR/regions-bounded-by-trait-requiring-static.rs:54:5 | LL | fn box_with_region_not_ok<'a>() { | -- lifetime `'a` defined here @@ -31,7 +31,7 @@ LL | assert_send::>(); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ requires that `'a` must outlive `'static` error: lifetime may not live long enough - --> $DIR/regions-bounded-by-trait-requiring-static.rs:55:5 + --> $DIR/regions-bounded-by-trait-requiring-static.rs:67:5 | LL | fn unsafe_ok2<'a>(_: &'a isize) { | -- lifetime `'a` defined here @@ -39,7 +39,7 @@ LL | assert_send::<*const &'a isize>(); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ requires that `'a` must outlive `'static` error: lifetime may not live long enough - --> $DIR/regions-bounded-by-trait-requiring-static.rs:59:5 + --> $DIR/regions-bounded-by-trait-requiring-static.rs:73:5 | LL | fn unsafe_ok3<'a>(_: &'a isize) { | -- lifetime `'a` defined here diff --git a/src/test/ui/regions/regions-bounded-by-trait-requiring-static.rs b/src/test/ui/regions/regions-bounded-by-trait-requiring-static.rs index c583f43638a..37dc1300d39 100644 --- a/src/test/ui/regions/regions-bounded-by-trait-requiring-static.rs +++ b/src/test/ui/regions/regions-bounded-by-trait-requiring-static.rs @@ -2,6 +2,10 @@ // in this file all test region bound and lifetime violations that are // detected during type check. +// revisions: base nll +// ignore-compare-mode-nll +//[nll] compile-flags: -Z borrowck=mir + trait Dummy : 'static { } fn assert_send() { } @@ -19,15 +23,21 @@ fn static_lifime_ok<'a,T,U:Send>(_: &'a isize) { // otherwise lifetime pointers are not ok fn param_not_ok<'a>(x: &'a isize) { - assert_send::<&'a isize>(); //~ ERROR does not fulfill the required lifetime + assert_send::<&'a isize>(); + //[base]~^ ERROR does not fulfill the required lifetime + //[nll]~^^ ERROR lifetime may not live long enough } fn param_not_ok1<'a>(_: &'a isize) { - assert_send::<&'a str>(); //~ ERROR does not fulfill the required lifetime + assert_send::<&'a str>(); + //[base]~^ ERROR does not fulfill the required lifetime + //[nll]~^^ ERROR lifetime may not live long enough } fn param_not_ok2<'a>(_: &'a isize) { - assert_send::<&'a [isize]>(); //~ ERROR does not fulfill the required lifetime + assert_send::<&'a [isize]>(); + //[base]~^ ERROR does not fulfill the required lifetime + //[nll]~^^ ERROR lifetime may not live long enough } // boxes are ok @@ -41,7 +51,9 @@ fn box_ok() { // but not if they own a bad thing fn box_with_region_not_ok<'a>() { - assert_send::>(); //~ ERROR does not fulfill the required lifetime + assert_send::>(); + //[base]~^ ERROR does not fulfill the required lifetime + //[nll]~^^ ERROR lifetime may not live long enough } // raw pointers are ok unless they point at unsendable things @@ -52,11 +64,15 @@ fn unsafe_ok1<'a>(_: &'a isize) { } fn unsafe_ok2<'a>(_: &'a isize) { - assert_send::<*const &'a isize>(); //~ ERROR does not fulfill the required lifetime + assert_send::<*const &'a isize>(); + //[base]~^ ERROR does not fulfill the required lifetime + //[nll]~^^ ERROR lifetime may not live long enough } fn unsafe_ok3<'a>(_: &'a isize) { - assert_send::<*mut &'a isize>(); //~ ERROR does not fulfill the required lifetime + assert_send::<*mut &'a isize>(); + //[base]~^ ERROR does not fulfill the required lifetime + //[nll]~^^ ERROR lifetime may not live long enough } fn main() { diff --git a/src/test/ui/regions/regions-bounded-method-type-parameters-cross-crate.stderr b/src/test/ui/regions/regions-bounded-method-type-parameters-cross-crate.base.stderr similarity index 98% rename from src/test/ui/regions/regions-bounded-method-type-parameters-cross-crate.stderr rename to src/test/ui/regions/regions-bounded-method-type-parameters-cross-crate.base.stderr index eb205a303db..e031f0db412 100644 --- a/src/test/ui/regions/regions-bounded-method-type-parameters-cross-crate.stderr +++ b/src/test/ui/regions/regions-bounded-method-type-parameters-cross-crate.base.stderr @@ -1,5 +1,5 @@ error[E0623]: lifetime mismatch - --> $DIR/regions-bounded-method-type-parameters-cross-crate.rs:20:7 + --> $DIR/regions-bounded-method-type-parameters-cross-crate.rs:23:7 | LL | fn call_bigger_region<'x, 'y>(a: Inv<'x>, b: Inv<'y>) { | ------- ------- these two types are declared with different lifetimes... diff --git a/src/test/ui/regions/regions-bounded-method-type-parameters-cross-crate.nll.stderr b/src/test/ui/regions/regions-bounded-method-type-parameters-cross-crate.nll.stderr index 6193bf02f6d..4f5d747be71 100644 --- a/src/test/ui/regions/regions-bounded-method-type-parameters-cross-crate.nll.stderr +++ b/src/test/ui/regions/regions-bounded-method-type-parameters-cross-crate.nll.stderr @@ -1,5 +1,5 @@ error: lifetime may not live long enough - --> $DIR/regions-bounded-method-type-parameters-cross-crate.rs:20:5 + --> $DIR/regions-bounded-method-type-parameters-cross-crate.rs:23:5 | LL | fn call_bigger_region<'x, 'y>(a: Inv<'x>, b: Inv<'y>) { | -- -- lifetime `'y` defined here diff --git a/src/test/ui/regions/regions-bounded-method-type-parameters-cross-crate.rs b/src/test/ui/regions/regions-bounded-method-type-parameters-cross-crate.rs index a7987d0e1fe..e0965613f1d 100644 --- a/src/test/ui/regions/regions-bounded-method-type-parameters-cross-crate.rs +++ b/src/test/ui/regions/regions-bounded-method-type-parameters-cross-crate.rs @@ -1,4 +1,7 @@ // aux-build:rbmtp_cross_crate_lib.rs +// revisions: base nll +// ignore-compare-mode-nll +//[nll] compile-flags: -Z borrowck=mir // Check explicit region bounds on methods in the cross crate case. @@ -17,7 +20,9 @@ fn call_into_maybe_owned<'x,F:IntoMaybeOwned<'x>>(f: F) { fn call_bigger_region<'x, 'y>(a: Inv<'x>, b: Inv<'y>) { // Here the value provided for 'y is 'y, and hence 'y:'x does not hold. - a.bigger_region(b) //~ ERROR lifetime mismatch [E0623] + a.bigger_region(b) + //[base]~^ ERROR lifetime mismatch [E0623] + //[nll]~^^ ERROR lifetime may not live long enough } fn main() { } diff --git a/src/test/ui/regions/regions-bounded-method-type-parameters-trait-bound.stderr b/src/test/ui/regions/regions-bounded-method-type-parameters-trait-bound.base.stderr similarity index 98% rename from src/test/ui/regions/regions-bounded-method-type-parameters-trait-bound.stderr rename to src/test/ui/regions/regions-bounded-method-type-parameters-trait-bound.base.stderr index de1073cd1d9..0a213e3f779 100644 --- a/src/test/ui/regions/regions-bounded-method-type-parameters-trait-bound.stderr +++ b/src/test/ui/regions/regions-bounded-method-type-parameters-trait-bound.base.stderr @@ -1,5 +1,5 @@ error[E0623]: lifetime mismatch - --> $DIR/regions-bounded-method-type-parameters-trait-bound.rs:20:7 + --> $DIR/regions-bounded-method-type-parameters-trait-bound.rs:24:7 | LL | fn caller2<'a,'b,F:Foo<'a>>(a: Inv<'a>, b: Inv<'b>, f: F) { | ------- ------- these two types are declared with different lifetimes... diff --git a/src/test/ui/regions/regions-bounded-method-type-parameters-trait-bound.nll.stderr b/src/test/ui/regions/regions-bounded-method-type-parameters-trait-bound.nll.stderr index 0e0086be9ea..1c2f46a5fc1 100644 --- a/src/test/ui/regions/regions-bounded-method-type-parameters-trait-bound.nll.stderr +++ b/src/test/ui/regions/regions-bounded-method-type-parameters-trait-bound.nll.stderr @@ -1,5 +1,5 @@ error: lifetime may not live long enough - --> $DIR/regions-bounded-method-type-parameters-trait-bound.rs:20:5 + --> $DIR/regions-bounded-method-type-parameters-trait-bound.rs:24:5 | LL | fn caller2<'a,'b,F:Foo<'a>>(a: Inv<'a>, b: Inv<'b>, f: F) { | -- -- lifetime `'b` defined here diff --git a/src/test/ui/regions/regions-bounded-method-type-parameters-trait-bound.rs b/src/test/ui/regions/regions-bounded-method-type-parameters-trait-bound.rs index 8adf496b230..8a52a1549ab 100644 --- a/src/test/ui/regions/regions-bounded-method-type-parameters-trait-bound.rs +++ b/src/test/ui/regions/regions-bounded-method-type-parameters-trait-bound.rs @@ -2,6 +2,10 @@ // nominal types (but not on other types) and that they are type // checked. +// revisions: base nll +// ignore-compare-mode-nll +//[nll] compile-flags: -Z borrowck=mir + struct Inv<'a> { // invariant w/r/t 'a x: &'a mut &'a isize } @@ -17,7 +21,9 @@ fn caller1<'a,'b,F:Foo<'a>>(a: Inv<'a>, b: Inv<'b>, f: F) { fn caller2<'a,'b,F:Foo<'a>>(a: Inv<'a>, b: Inv<'b>, f: F) { // Here the value provided for 'y is 'b, and hence 'b:'a does not hold. - f.method(b); //~ ERROR lifetime mismatch [E0623] + f.method(b); + //[base]~^ ERROR lifetime mismatch [E0623] + //[nll]~^^ ERROR lifetime may not live long enough } fn caller3<'a,'b:'a,F:Foo<'a>>(a: Inv<'a>, b: Inv<'b>, f: F) { diff --git a/src/test/ui/regions/regions-bounded-method-type-parameters.stderr b/src/test/ui/regions/regions-bounded-method-type-parameters.base.stderr similarity index 77% rename from src/test/ui/regions/regions-bounded-method-type-parameters.stderr rename to src/test/ui/regions/regions-bounded-method-type-parameters.base.stderr index 318e9d006a1..3d37a1ba47b 100644 --- a/src/test/ui/regions/regions-bounded-method-type-parameters.stderr +++ b/src/test/ui/regions/regions-bounded-method-type-parameters.base.stderr @@ -1,11 +1,11 @@ error[E0477]: the type `&'a isize` does not fulfill the required lifetime - --> $DIR/regions-bounded-method-type-parameters.rs:12:9 + --> $DIR/regions-bounded-method-type-parameters.rs:16:9 | LL | Foo.some_method::<&'a isize>(); | ^^^^^^^^^^^ | note: type must satisfy the static lifetime as required by this binding - --> $DIR/regions-bounded-method-type-parameters.rs:8:22 + --> $DIR/regions-bounded-method-type-parameters.rs:12:22 | LL | fn some_method(self) { } | ^^^^^^^ diff --git a/src/test/ui/regions/regions-bounded-method-type-parameters.nll.stderr b/src/test/ui/regions/regions-bounded-method-type-parameters.nll.stderr index b6d7b8aac5f..05c3fa58ea3 100644 --- a/src/test/ui/regions/regions-bounded-method-type-parameters.nll.stderr +++ b/src/test/ui/regions/regions-bounded-method-type-parameters.nll.stderr @@ -1,5 +1,5 @@ error: lifetime may not live long enough - --> $DIR/regions-bounded-method-type-parameters.rs:12:9 + --> $DIR/regions-bounded-method-type-parameters.rs:16:9 | LL | fn caller<'a>(x: &isize) { | -- lifetime `'a` defined here diff --git a/src/test/ui/regions/regions-bounded-method-type-parameters.rs b/src/test/ui/regions/regions-bounded-method-type-parameters.rs index 90af120f052..06bc1544a38 100644 --- a/src/test/ui/regions/regions-bounded-method-type-parameters.rs +++ b/src/test/ui/regions/regions-bounded-method-type-parameters.rs @@ -2,6 +2,10 @@ // nominal types (but not on other types) and that they are type // checked. +// revisions: base nll +// ignore-compare-mode-nll +//[nll] compile-flags: -Z borrowck=mir + struct Foo; impl Foo { @@ -10,7 +14,8 @@ impl Foo { fn caller<'a>(x: &isize) { Foo.some_method::<&'a isize>(); - //~^ ERROR does not fulfill the required lifetime + //[base]~^ ERROR does not fulfill the required lifetime + //[nll]~^^ ERROR lifetime may not live long enough } fn main() { } diff --git a/src/test/ui/regions/regions-bounds.stderr b/src/test/ui/regions/regions-bounds.base.stderr similarity index 91% rename from src/test/ui/regions/regions-bounds.stderr rename to src/test/ui/regions/regions-bounds.base.stderr index 90227e574ad..d853cdde336 100644 --- a/src/test/ui/regions/regions-bounds.stderr +++ b/src/test/ui/regions/regions-bounds.base.stderr @@ -1,5 +1,5 @@ error[E0308]: mismatched types - --> $DIR/regions-bounds.rs:9:12 + --> $DIR/regions-bounds.rs:13:12 | LL | return e; | ^ lifetime mismatch @@ -7,18 +7,18 @@ LL | return e; = note: expected struct `TupleStruct<'b>` found struct `TupleStruct<'a>` note: the lifetime `'a` as defined here... - --> $DIR/regions-bounds.rs:8:10 + --> $DIR/regions-bounds.rs:12:10 | LL | fn a_fn1<'a,'b>(e: TupleStruct<'a>) -> TupleStruct<'b> { | ^^ note: ...does not necessarily outlive the lifetime `'b` as defined here - --> $DIR/regions-bounds.rs:8:13 + --> $DIR/regions-bounds.rs:12:13 | LL | fn a_fn1<'a,'b>(e: TupleStruct<'a>) -> TupleStruct<'b> { | ^^ error[E0308]: mismatched types - --> $DIR/regions-bounds.rs:13:12 + --> $DIR/regions-bounds.rs:19:12 | LL | return e; | ^ lifetime mismatch @@ -26,12 +26,12 @@ LL | return e; = note: expected struct `Struct<'b>` found struct `Struct<'a>` note: the lifetime `'a` as defined here... - --> $DIR/regions-bounds.rs:12:10 + --> $DIR/regions-bounds.rs:18:10 | LL | fn a_fn3<'a,'b>(e: Struct<'a>) -> Struct<'b> { | ^^ note: ...does not necessarily outlive the lifetime `'b` as defined here - --> $DIR/regions-bounds.rs:12:13 + --> $DIR/regions-bounds.rs:18:13 | LL | fn a_fn3<'a,'b>(e: Struct<'a>) -> Struct<'b> { | ^^ diff --git a/src/test/ui/regions/regions-bounds.nll.stderr b/src/test/ui/regions/regions-bounds.nll.stderr index 84226a57553..7109220165f 100644 --- a/src/test/ui/regions/regions-bounds.nll.stderr +++ b/src/test/ui/regions/regions-bounds.nll.stderr @@ -1,5 +1,5 @@ error: lifetime may not live long enough - --> $DIR/regions-bounds.rs:9:12 + --> $DIR/regions-bounds.rs:13:12 | LL | fn a_fn1<'a,'b>(e: TupleStruct<'a>) -> TupleStruct<'b> { | -- -- lifetime `'b` defined here @@ -11,7 +11,7 @@ LL | return e; = help: consider adding the following bound: `'a: 'b` error: lifetime may not live long enough - --> $DIR/regions-bounds.rs:13:12 + --> $DIR/regions-bounds.rs:19:12 | LL | fn a_fn3<'a,'b>(e: Struct<'a>) -> Struct<'b> { | -- -- lifetime `'b` defined here diff --git a/src/test/ui/regions/regions-bounds.rs b/src/test/ui/regions/regions-bounds.rs index d3e4e6e8712..b13dac49f8c 100644 --- a/src/test/ui/regions/regions-bounds.rs +++ b/src/test/ui/regions/regions-bounds.rs @@ -2,15 +2,23 @@ // nominal types (but not on other types) and that they are type // checked. +// revisions: base nll +// ignore-compare-mode-nll +//[nll] compile-flags: -Z borrowck=mir + struct TupleStruct<'a>(&'a isize); struct Struct<'a> { x:&'a isize } fn a_fn1<'a,'b>(e: TupleStruct<'a>) -> TupleStruct<'b> { - return e; //~ ERROR mismatched types + return e; + //[base]~^ ERROR mismatched types + //[nll]~^^ ERROR lifetime may not live long enough } fn a_fn3<'a,'b>(e: Struct<'a>) -> Struct<'b> { - return e; //~ ERROR mismatched types + return e; + //[base]~^ ERROR mismatched types + //[nll]~^^ ERROR lifetime may not live long enough } fn main() { } diff --git a/src/test/ui/regions/regions-close-associated-type-into-object.stderr b/src/test/ui/regions/regions-close-associated-type-into-object.base.stderr similarity index 85% rename from src/test/ui/regions/regions-close-associated-type-into-object.stderr rename to src/test/ui/regions/regions-close-associated-type-into-object.base.stderr index 536a1b5e359..fbbb5980401 100644 --- a/src/test/ui/regions/regions-close-associated-type-into-object.stderr +++ b/src/test/ui/regions/regions-close-associated-type-into-object.base.stderr @@ -1,5 +1,5 @@ error[E0310]: the associated type `::Item` may not live long enough - --> $DIR/regions-close-associated-type-into-object.rs:15:5 + --> $DIR/regions-close-associated-type-into-object.rs:19:5 | LL | Box::new(item) | ^^^^^^^^^^^^^^ @@ -8,7 +8,7 @@ LL | Box::new(item) = note: ...so that the type `::Item` will meet its required lifetime bounds error[E0310]: the associated type `::Item` may not live long enough - --> $DIR/regions-close-associated-type-into-object.rs:22:5 + --> $DIR/regions-close-associated-type-into-object.rs:26:5 | LL | Box::new(item) | ^^^^^^^^^^^^^^ @@ -17,7 +17,7 @@ LL | Box::new(item) = note: ...so that the type `Box<::Item>` will meet its required lifetime bounds error[E0309]: the associated type `::Item` may not live long enough - --> $DIR/regions-close-associated-type-into-object.rs:28:5 + --> $DIR/regions-close-associated-type-into-object.rs:32:5 | LL | Box::new(item) | ^^^^^^^^^^^^^^ @@ -26,7 +26,7 @@ LL | Box::new(item) = note: ...so that the type `::Item` will meet its required lifetime bounds error[E0309]: the associated type `::Item` may not live long enough - --> $DIR/regions-close-associated-type-into-object.rs:35:5 + --> $DIR/regions-close-associated-type-into-object.rs:39:5 | LL | Box::new(item) | ^^^^^^^^^^^^^^ diff --git a/src/test/ui/regions/regions-close-associated-type-into-object.nll.stderr b/src/test/ui/regions/regions-close-associated-type-into-object.nll.stderr index f7dcaa9d97e..dd4b97aa562 100644 --- a/src/test/ui/regions/regions-close-associated-type-into-object.nll.stderr +++ b/src/test/ui/regions/regions-close-associated-type-into-object.nll.stderr @@ -1,5 +1,5 @@ error[E0310]: the associated type `::Item` may not live long enough - --> $DIR/regions-close-associated-type-into-object.rs:15:5 + --> $DIR/regions-close-associated-type-into-object.rs:19:5 | LL | Box::new(item) | ^^^^^^^^^^^^^^ @@ -8,7 +8,7 @@ LL | Box::new(item) = note: ...so that the type `::Item` will meet its required lifetime bounds error[E0310]: the associated type `::Item` may not live long enough - --> $DIR/regions-close-associated-type-into-object.rs:22:5 + --> $DIR/regions-close-associated-type-into-object.rs:26:5 | LL | Box::new(item) | ^^^^^^^^^^^^^^ @@ -17,7 +17,7 @@ LL | Box::new(item) = note: ...so that the type `::Item` will meet its required lifetime bounds error[E0309]: the associated type `::Item` may not live long enough - --> $DIR/regions-close-associated-type-into-object.rs:28:5 + --> $DIR/regions-close-associated-type-into-object.rs:32:5 | LL | Box::new(item) | ^^^^^^^^^^^^^^ @@ -26,7 +26,7 @@ LL | Box::new(item) = note: ...so that the type `::Item` will meet its required lifetime bounds error[E0309]: the associated type `::Item` may not live long enough - --> $DIR/regions-close-associated-type-into-object.rs:35:5 + --> $DIR/regions-close-associated-type-into-object.rs:39:5 | LL | Box::new(item) | ^^^^^^^^^^^^^^ diff --git a/src/test/ui/regions/regions-close-associated-type-into-object.rs b/src/test/ui/regions/regions-close-associated-type-into-object.rs index 428477e2489..94199f56212 100644 --- a/src/test/ui/regions/regions-close-associated-type-into-object.rs +++ b/src/test/ui/regions/regions-close-associated-type-into-object.rs @@ -1,3 +1,7 @@ +// revisions: base nll +// ignore-compare-mode-nll +//[nll] compile-flags: -Z borrowck=mir + trait X {} diff --git a/src/test/ui/regions/regions-close-object-into-object-2.stderr b/src/test/ui/regions/regions-close-object-into-object-2.base.stderr similarity index 92% rename from src/test/ui/regions/regions-close-object-into-object-2.stderr rename to src/test/ui/regions/regions-close-object-into-object-2.base.stderr index 4153f4f29bc..ddf168ffd10 100644 --- a/src/test/ui/regions/regions-close-object-into-object-2.stderr +++ b/src/test/ui/regions/regions-close-object-into-object-2.base.stderr @@ -1,5 +1,5 @@ error[E0759]: `v` has lifetime `'a` but it needs to satisfy a `'static` lifetime requirement - --> $DIR/regions-close-object-into-object-2.rs:9:16 + --> $DIR/regions-close-object-into-object-2.rs:13:16 | LL | fn g<'a, T: 'static>(v: Box + 'a>) -> Box { | ------------------ this data with lifetime `'a`... @@ -7,7 +7,7 @@ LL | Box::new(B(&*v)) as Box | ^^^ ...is used and required to live as long as `'static` here | note: `'static` lifetime requirement introduced by the return type - --> $DIR/regions-close-object-into-object-2.rs:8:60 + --> $DIR/regions-close-object-into-object-2.rs:12:60 | LL | fn g<'a, T: 'static>(v: Box + 'a>) -> Box { | ^^^^^^^ `'static` requirement introduced here diff --git a/src/test/ui/regions/regions-close-object-into-object-2.nll.stderr b/src/test/ui/regions/regions-close-object-into-object-2.nll.stderr index 6a0e9586161..1a79da2776b 100644 --- a/src/test/ui/regions/regions-close-object-into-object-2.nll.stderr +++ b/src/test/ui/regions/regions-close-object-into-object-2.nll.stderr @@ -1,5 +1,5 @@ error: lifetime may not live long enough - --> $DIR/regions-close-object-into-object-2.rs:9:5 + --> $DIR/regions-close-object-into-object-2.rs:13:5 | LL | fn g<'a, T: 'static>(v: Box + 'a>) -> Box { | -- lifetime `'a` defined here @@ -7,7 +7,7 @@ LL | Box::new(B(&*v)) as Box | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ returning this value requires that `'a` must outlive `'static` error[E0515]: cannot return value referencing local data `*v` - --> $DIR/regions-close-object-into-object-2.rs:9:5 + --> $DIR/regions-close-object-into-object-2.rs:13:5 | LL | Box::new(B(&*v)) as Box | ^^^^^^^^^^^---^^^^^^^^^^^^^^^^ diff --git a/src/test/ui/regions/regions-close-object-into-object-2.rs b/src/test/ui/regions/regions-close-object-into-object-2.rs index 9c41174e24d..33ea03f061e 100644 --- a/src/test/ui/regions/regions-close-object-into-object-2.rs +++ b/src/test/ui/regions/regions-close-object-into-object-2.rs @@ -1,3 +1,7 @@ +// revisions: base nll +// ignore-compare-mode-nll +//[nll] compile-flags: -Z borrowck=mir + trait A { } struct B<'a, T:'a>(&'a (dyn A + 'a)); @@ -6,7 +10,10 @@ trait X { } impl<'a, T> X for B<'a, T> {} fn g<'a, T: 'static>(v: Box + 'a>) -> Box { - Box::new(B(&*v)) as Box //~ ERROR E0759 + Box::new(B(&*v)) as Box + //[base]~^ ERROR E0759 + //[nll]~^^ ERROR lifetime may not live long enough + //[nll]~| ERROR cannot return value referencing local data `*v` [E0515] } fn main() { } diff --git a/src/test/ui/regions/regions-close-object-into-object-4.stderr b/src/test/ui/regions/regions-close-object-into-object-4.base.stderr similarity index 91% rename from src/test/ui/regions/regions-close-object-into-object-4.stderr rename to src/test/ui/regions/regions-close-object-into-object-4.base.stderr index 2ea4b431b38..33d4df3d194 100644 --- a/src/test/ui/regions/regions-close-object-into-object-4.stderr +++ b/src/test/ui/regions/regions-close-object-into-object-4.base.stderr @@ -1,5 +1,5 @@ error[E0759]: `v` has lifetime `'a` but it needs to satisfy a `'static` lifetime requirement - --> $DIR/regions-close-object-into-object-4.rs:9:16 + --> $DIR/regions-close-object-into-object-4.rs:13:16 | LL | fn i<'a, T, U>(v: Box+'a>) -> Box { | ---------------- this data with lifetime `'a`... @@ -7,7 +7,7 @@ LL | Box::new(B(&*v)) as Box | ^^^ ...is used and required to live as long as `'static` here | note: `'static` lifetime requirement introduced by the return type - --> $DIR/regions-close-object-into-object-4.rs:8:52 + --> $DIR/regions-close-object-into-object-4.rs:12:52 | LL | fn i<'a, T, U>(v: Box+'a>) -> Box { | ^^^^^^^ `'static` requirement introduced here diff --git a/src/test/ui/regions/regions-close-object-into-object-4.nll.stderr b/src/test/ui/regions/regions-close-object-into-object-4.nll.stderr index 6a2429e51ec..993b13ddbf8 100644 --- a/src/test/ui/regions/regions-close-object-into-object-4.nll.stderr +++ b/src/test/ui/regions/regions-close-object-into-object-4.nll.stderr @@ -1,5 +1,5 @@ error[E0310]: the parameter type `U` may not live long enough - --> $DIR/regions-close-object-into-object-4.rs:9:5 + --> $DIR/regions-close-object-into-object-4.rs:13:5 | LL | fn i<'a, T, U>(v: Box+'a>) -> Box { | - help: consider adding an explicit lifetime bound...: `U: 'static` @@ -7,7 +7,7 @@ LL | Box::new(B(&*v)) as Box | ^^^^^^^^ ...so that the type `U` will meet its required lifetime bounds error[E0310]: the parameter type `U` may not live long enough - --> $DIR/regions-close-object-into-object-4.rs:9:5 + --> $DIR/regions-close-object-into-object-4.rs:13:5 | LL | fn i<'a, T, U>(v: Box+'a>) -> Box { | - help: consider adding an explicit lifetime bound...: `U: 'static` @@ -15,7 +15,7 @@ LL | Box::new(B(&*v)) as Box | ^^^^^^^^^^^^^^^^ ...so that the type `U` will meet its required lifetime bounds error[E0310]: the parameter type `U` may not live long enough - --> $DIR/regions-close-object-into-object-4.rs:9:5 + --> $DIR/regions-close-object-into-object-4.rs:13:5 | LL | fn i<'a, T, U>(v: Box+'a>) -> Box { | - help: consider adding an explicit lifetime bound...: `U: 'static` @@ -23,7 +23,7 @@ LL | Box::new(B(&*v)) as Box | ^^^^^^^^^^^^^^^^ ...so that the type `U` will meet its required lifetime bounds error: lifetime may not live long enough - --> $DIR/regions-close-object-into-object-4.rs:9:5 + --> $DIR/regions-close-object-into-object-4.rs:13:5 | LL | fn i<'a, T, U>(v: Box+'a>) -> Box { | -- lifetime `'a` defined here @@ -31,7 +31,7 @@ LL | Box::new(B(&*v)) as Box | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ returning this value requires that `'a` must outlive `'static` error[E0515]: cannot return value referencing local data `*v` - --> $DIR/regions-close-object-into-object-4.rs:9:5 + --> $DIR/regions-close-object-into-object-4.rs:13:5 | LL | Box::new(B(&*v)) as Box | ^^^^^^^^^^^---^^^^^^^^^^^^^^^^ @@ -40,7 +40,7 @@ LL | Box::new(B(&*v)) as Box | returns a value referencing data owned by the current function error[E0310]: the parameter type `U` may not live long enough - --> $DIR/regions-close-object-into-object-4.rs:9:14 + --> $DIR/regions-close-object-into-object-4.rs:13:14 | LL | fn i<'a, T, U>(v: Box+'a>) -> Box { | - help: consider adding an explicit lifetime bound...: `U: 'static` diff --git a/src/test/ui/regions/regions-close-object-into-object-4.rs b/src/test/ui/regions/regions-close-object-into-object-4.rs index 2a06a2b7c05..5a852b7329a 100644 --- a/src/test/ui/regions/regions-close-object-into-object-4.rs +++ b/src/test/ui/regions/regions-close-object-into-object-4.rs @@ -1,3 +1,7 @@ +// revisions: base nll +// ignore-compare-mode-nll +//[nll] compile-flags: -Z borrowck=mir + trait A { } struct B<'a, T:'a>(&'a (dyn A + 'a)); @@ -6,7 +10,15 @@ trait X { } impl<'a, T> X for B<'a, T> {} fn i<'a, T, U>(v: Box+'a>) -> Box { - Box::new(B(&*v)) as Box //~ ERROR E0759 + Box::new(B(&*v)) as Box + //[base]~^ ERROR E0759 + //[nll]~^^ ERROR the parameter type `U` may not live long enough [E0310] + //[nll]~| ERROR the parameter type `U` may not live long enough [E0310] + //[nll]~| ERROR the parameter type `U` may not live long enough [E0310] + //[nll]~| ERROR lifetime may not live long enough + //[nll]~| ERROR cannot return value referencing local data `*v` [E0515] + //[nll]~| ERROR the parameter type `U` may not live long enough [E0310] + } fn main() {} diff --git a/src/test/ui/regions/regions-close-object-into-object-5.stderr b/src/test/ui/regions/regions-close-object-into-object-5.base.stderr similarity index 84% rename from src/test/ui/regions/regions-close-object-into-object-5.stderr rename to src/test/ui/regions/regions-close-object-into-object-5.base.stderr index 512a7ab35fb..8b5a06bab71 100644 --- a/src/test/ui/regions/regions-close-object-into-object-5.stderr +++ b/src/test/ui/regions/regions-close-object-into-object-5.base.stderr @@ -1,5 +1,5 @@ error[E0310]: the parameter type `T` may not live long enough - --> $DIR/regions-close-object-into-object-5.rs:17:5 + --> $DIR/regions-close-object-into-object-5.rs:21:5 | LL | fn f<'a, T, U>(v: Box + 'static>) -> Box { | - help: consider adding an explicit lifetime bound...: `T: 'static` @@ -8,13 +8,13 @@ LL | Box::new(B(&*v)) as Box | ^^^^^^^^ ...so that the type `T` will meet its required lifetime bounds... | note: ...that is required by this bound - --> $DIR/regions-close-object-into-object-5.rs:9:17 + --> $DIR/regions-close-object-into-object-5.rs:13:17 | LL | struct B<'a, T: 'a>(&'a (A + 'a)); | ^^ error[E0310]: the parameter type `T` may not live long enough - --> $DIR/regions-close-object-into-object-5.rs:17:5 + --> $DIR/regions-close-object-into-object-5.rs:21:5 | LL | fn f<'a, T, U>(v: Box + 'static>) -> Box { | - help: consider adding an explicit lifetime bound...: `T: 'static` @@ -23,7 +23,7 @@ LL | Box::new(B(&*v)) as Box | ^^^^^^^^^^^^^^^^ ...so that the type `B<'_, T>` will meet its required lifetime bounds error[E0310]: the parameter type `T` may not live long enough - --> $DIR/regions-close-object-into-object-5.rs:17:14 + --> $DIR/regions-close-object-into-object-5.rs:21:14 | LL | fn f<'a, T, U>(v: Box + 'static>) -> Box { | - help: consider adding an explicit lifetime bound...: `T: 'static` @@ -32,13 +32,13 @@ LL | Box::new(B(&*v)) as Box | ^ ...so that the type `T` will meet its required lifetime bounds... | note: ...that is required by this bound - --> $DIR/regions-close-object-into-object-5.rs:9:17 + --> $DIR/regions-close-object-into-object-5.rs:13:17 | LL | struct B<'a, T: 'a>(&'a (A + 'a)); | ^^ error[E0310]: the parameter type `T` may not live long enough - --> $DIR/regions-close-object-into-object-5.rs:17:14 + --> $DIR/regions-close-object-into-object-5.rs:21:14 | LL | fn f<'a, T, U>(v: Box + 'static>) -> Box { | - help: consider adding an explicit lifetime bound...: `T: 'static` @@ -47,13 +47,13 @@ LL | Box::new(B(&*v)) as Box | ^^^^^^ ...so that the type `T` will meet its required lifetime bounds... | note: ...that is required by this bound - --> $DIR/regions-close-object-into-object-5.rs:9:17 + --> $DIR/regions-close-object-into-object-5.rs:13:17 | LL | struct B<'a, T: 'a>(&'a (A + 'a)); | ^^ error[E0310]: the parameter type `T` may not live long enough - --> $DIR/regions-close-object-into-object-5.rs:17:16 + --> $DIR/regions-close-object-into-object-5.rs:21:16 | LL | fn f<'a, T, U>(v: Box + 'static>) -> Box { | - help: consider adding an explicit lifetime bound...: `T: 'static` @@ -62,7 +62,7 @@ LL | Box::new(B(&*v)) as Box | ^^^ ...so that the reference type `&dyn A` does not outlive the data it points at error[E0310]: the parameter type `T` may not live long enough - --> $DIR/regions-close-object-into-object-5.rs:17:16 + --> $DIR/regions-close-object-into-object-5.rs:21:16 | LL | fn f<'a, T, U>(v: Box + 'static>) -> Box { | - help: consider adding an explicit lifetime bound...: `T: 'static` @@ -71,7 +71,7 @@ LL | Box::new(B(&*v)) as Box | ^^^ ...so that the type `(dyn A + 'static)` is not borrowed for too long error[E0310]: the parameter type `T` may not live long enough - --> $DIR/regions-close-object-into-object-5.rs:17:16 + --> $DIR/regions-close-object-into-object-5.rs:21:16 | LL | fn f<'a, T, U>(v: Box + 'static>) -> Box { | - help: consider adding an explicit lifetime bound...: `T: 'static` diff --git a/src/test/ui/regions/regions-close-object-into-object-5.nll.stderr b/src/test/ui/regions/regions-close-object-into-object-5.nll.stderr index 54302cc6dca..f4e3809e916 100644 --- a/src/test/ui/regions/regions-close-object-into-object-5.nll.stderr +++ b/src/test/ui/regions/regions-close-object-into-object-5.nll.stderr @@ -1,5 +1,5 @@ error[E0310]: the parameter type `T` may not live long enough - --> $DIR/regions-close-object-into-object-5.rs:17:5 + --> $DIR/regions-close-object-into-object-5.rs:21:5 | LL | fn f<'a, T, U>(v: Box + 'static>) -> Box { | - help: consider adding an explicit lifetime bound...: `T: 'static` @@ -8,7 +8,7 @@ LL | Box::new(B(&*v)) as Box | ^^^^^^^^ ...so that the type `T` will meet its required lifetime bounds error[E0310]: the parameter type `T` may not live long enough - --> $DIR/regions-close-object-into-object-5.rs:17:5 + --> $DIR/regions-close-object-into-object-5.rs:21:5 | LL | fn f<'a, T, U>(v: Box + 'static>) -> Box { | - help: consider adding an explicit lifetime bound...: `T: 'static` @@ -17,7 +17,7 @@ LL | Box::new(B(&*v)) as Box | ^^^^^^^^^^^^^^^^ ...so that the type `T` will meet its required lifetime bounds error[E0310]: the parameter type `T` may not live long enough - --> $DIR/regions-close-object-into-object-5.rs:17:5 + --> $DIR/regions-close-object-into-object-5.rs:21:5 | LL | fn f<'a, T, U>(v: Box + 'static>) -> Box { | - help: consider adding an explicit lifetime bound...: `T: 'static` @@ -26,7 +26,7 @@ LL | Box::new(B(&*v)) as Box | ^^^^^^^^^^^^^^^^ ...so that the type `T` will meet its required lifetime bounds error[E0515]: cannot return value referencing local data `*v` - --> $DIR/regions-close-object-into-object-5.rs:17:5 + --> $DIR/regions-close-object-into-object-5.rs:21:5 | LL | Box::new(B(&*v)) as Box | ^^^^^^^^^^^---^^^^^^^^^^^^^^^^ @@ -35,7 +35,7 @@ LL | Box::new(B(&*v)) as Box | returns a value referencing data owned by the current function error[E0310]: the parameter type `T` may not live long enough - --> $DIR/regions-close-object-into-object-5.rs:17:14 + --> $DIR/regions-close-object-into-object-5.rs:21:14 | LL | fn f<'a, T, U>(v: Box + 'static>) -> Box { | - help: consider adding an explicit lifetime bound...: `T: 'static` diff --git a/src/test/ui/regions/regions-close-object-into-object-5.rs b/src/test/ui/regions/regions-close-object-into-object-5.rs index 5471c375b49..0e5fec28d19 100644 --- a/src/test/ui/regions/regions-close-object-into-object-5.rs +++ b/src/test/ui/regions/regions-close-object-into-object-5.rs @@ -1,3 +1,7 @@ +// revisions: base nll +// ignore-compare-mode-nll +//[nll] compile-flags: -Z borrowck=mir + #![allow(warnings)] @@ -19,9 +23,10 @@ fn f<'a, T, U>(v: Box + 'static>) -> Box { //~| ERROR the parameter type `T` may not live long enough //~| ERROR the parameter type `T` may not live long enough //~| ERROR the parameter type `T` may not live long enough - //~| ERROR the parameter type `T` may not live long enough - //~| ERROR the parameter type `T` may not live long enough - //~| ERROR the parameter type `T` may not live long enough + //[base]~| ERROR the parameter type `T` may not live long enough + //[base]~| ERROR the parameter type `T` may not live long enough + //[base]~| ERROR the parameter type `T` may not live long enough + //[nll]~| ERROR cannot return value referencing local data `*v` [E0515] } fn main() {} diff --git a/src/test/ui/regions/regions-close-over-type-parameter-1.stderr b/src/test/ui/regions/regions-close-over-type-parameter-1.base.stderr similarity index 89% rename from src/test/ui/regions/regions-close-over-type-parameter-1.stderr rename to src/test/ui/regions/regions-close-over-type-parameter-1.base.stderr index 063c3b19a19..41dc03e86dd 100644 --- a/src/test/ui/regions/regions-close-over-type-parameter-1.stderr +++ b/src/test/ui/regions/regions-close-over-type-parameter-1.base.stderr @@ -1,5 +1,5 @@ error[E0310]: the parameter type `A` may not live long enough - --> $DIR/regions-close-over-type-parameter-1.rs:12:5 + --> $DIR/regions-close-over-type-parameter-1.rs:15:5 | LL | fn make_object1(v: A) -> Box { | -- help: consider adding an explicit lifetime bound...: `A: 'static +` @@ -7,7 +7,7 @@ LL | Box::new(v) as Box | ^^^^^^^^^^^ ...so that the type `A` will meet its required lifetime bounds error[E0309]: the parameter type `A` may not live long enough - --> $DIR/regions-close-over-type-parameter-1.rs:21:5 + --> $DIR/regions-close-over-type-parameter-1.rs:24:5 | LL | fn make_object3<'a, 'b, A: SomeTrait + 'a>(v: A) -> Box { | -- help: consider adding an explicit lifetime bound...: `A: 'b +` diff --git a/src/test/ui/regions/regions-close-over-type-parameter-1.nll.stderr b/src/test/ui/regions/regions-close-over-type-parameter-1.nll.stderr index 063c3b19a19..41dc03e86dd 100644 --- a/src/test/ui/regions/regions-close-over-type-parameter-1.nll.stderr +++ b/src/test/ui/regions/regions-close-over-type-parameter-1.nll.stderr @@ -1,5 +1,5 @@ error[E0310]: the parameter type `A` may not live long enough - --> $DIR/regions-close-over-type-parameter-1.rs:12:5 + --> $DIR/regions-close-over-type-parameter-1.rs:15:5 | LL | fn make_object1(v: A) -> Box { | -- help: consider adding an explicit lifetime bound...: `A: 'static +` @@ -7,7 +7,7 @@ LL | Box::new(v) as Box | ^^^^^^^^^^^ ...so that the type `A` will meet its required lifetime bounds error[E0309]: the parameter type `A` may not live long enough - --> $DIR/regions-close-over-type-parameter-1.rs:21:5 + --> $DIR/regions-close-over-type-parameter-1.rs:24:5 | LL | fn make_object3<'a, 'b, A: SomeTrait + 'a>(v: A) -> Box { | -- help: consider adding an explicit lifetime bound...: `A: 'b +` diff --git a/src/test/ui/regions/regions-close-over-type-parameter-1.rs b/src/test/ui/regions/regions-close-over-type-parameter-1.rs index 52d18c5d7a6..cf425bcd4f3 100644 --- a/src/test/ui/regions/regions-close-over-type-parameter-1.rs +++ b/src/test/ui/regions/regions-close-over-type-parameter-1.rs @@ -2,6 +2,9 @@ // an object. This should yield errors unless `A` (and the object) // both have suitable bounds. +// revisions: base nll +// ignore-compare-mode-nll +//[nll] compile-flags: -Z borrowck=mir trait SomeTrait { fn get(&self) -> isize; diff --git a/src/test/ui/regions/regions-close-over-type-parameter-multiple.stderr b/src/test/ui/regions/regions-close-over-type-parameter-multiple.base.stderr similarity index 77% rename from src/test/ui/regions/regions-close-over-type-parameter-multiple.stderr rename to src/test/ui/regions/regions-close-over-type-parameter-multiple.base.stderr index aa22fd96deb..171203897d7 100644 --- a/src/test/ui/regions/regions-close-over-type-parameter-multiple.stderr +++ b/src/test/ui/regions/regions-close-over-type-parameter-multiple.base.stderr @@ -1,26 +1,26 @@ error[E0495]: cannot infer an appropriate lifetime due to conflicting requirements - --> $DIR/regions-close-over-type-parameter-multiple.rs:20:5 + --> $DIR/regions-close-over-type-parameter-multiple.rs:23:5 | LL | Box::new(v) as Box | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | note: first, the lifetime cannot outlive the lifetime `'a` as defined here... - --> $DIR/regions-close-over-type-parameter-multiple.rs:18:20 + --> $DIR/regions-close-over-type-parameter-multiple.rs:21:20 | LL | fn make_object_bad<'a,'b,'c,A:SomeTrait+'a+'b>(v: A) -> Box { | ^^ note: ...so that the declared lifetime parameter bounds are satisfied - --> $DIR/regions-close-over-type-parameter-multiple.rs:20:5 + --> $DIR/regions-close-over-type-parameter-multiple.rs:23:5 | LL | Box::new(v) as Box | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ note: but, the lifetime must be valid for the lifetime `'c` as defined here... - --> $DIR/regions-close-over-type-parameter-multiple.rs:18:26 + --> $DIR/regions-close-over-type-parameter-multiple.rs:21:26 | LL | fn make_object_bad<'a,'b,'c,A:SomeTrait+'a+'b>(v: A) -> Box { | ^^ note: ...so that the types are compatible - --> $DIR/regions-close-over-type-parameter-multiple.rs:20:5 + --> $DIR/regions-close-over-type-parameter-multiple.rs:23:5 | LL | Box::new(v) as Box | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/src/test/ui/regions/regions-close-over-type-parameter-multiple.nll.stderr b/src/test/ui/regions/regions-close-over-type-parameter-multiple.nll.stderr index 25566742099..66459957ed4 100644 --- a/src/test/ui/regions/regions-close-over-type-parameter-multiple.nll.stderr +++ b/src/test/ui/regions/regions-close-over-type-parameter-multiple.nll.stderr @@ -1,5 +1,5 @@ error: lifetime may not live long enough - --> $DIR/regions-close-over-type-parameter-multiple.rs:20:5 + --> $DIR/regions-close-over-type-parameter-multiple.rs:23:5 | LL | fn make_object_bad<'a,'b,'c,A:SomeTrait+'a+'b>(v: A) -> Box { | -- -- lifetime `'c` defined here diff --git a/src/test/ui/regions/regions-close-over-type-parameter-multiple.rs b/src/test/ui/regions/regions-close-over-type-parameter-multiple.rs index fc7696e7e03..3d5f4e12665 100644 --- a/src/test/ui/regions/regions-close-over-type-parameter-multiple.rs +++ b/src/test/ui/regions/regions-close-over-type-parameter-multiple.rs @@ -1,6 +1,9 @@ // Various tests where we over type parameters with multiple lifetime // bounds. +// revisions: base nll +// ignore-compare-mode-nll +//[nll] compile-flags: -Z borrowck=mir trait SomeTrait { fn get(&self) -> isize; } @@ -17,7 +20,9 @@ fn make_object_good2<'a,'b,A:SomeTrait+'a+'b>(v: A) -> Box { fn make_object_bad<'a,'b,'c,A:SomeTrait+'a+'b>(v: A) -> Box { // A outlives 'a AND 'b...but not 'c. - Box::new(v) as Box //~ ERROR cannot infer an appropriate lifetime + Box::new(v) as Box + //[base]~^ ERROR cannot infer an appropriate lifetime + //[nll]~^^ ERROR lifetime may not live long enough } fn main() { diff --git a/src/test/ui/regions/regions-close-param-into-object.stderr b/src/test/ui/regions/regions-close-param-into-object.base.stderr similarity index 87% rename from src/test/ui/regions/regions-close-param-into-object.stderr rename to src/test/ui/regions/regions-close-param-into-object.base.stderr index 5c355bbb734..7e135c65450 100644 --- a/src/test/ui/regions/regions-close-param-into-object.stderr +++ b/src/test/ui/regions/regions-close-param-into-object.base.stderr @@ -1,5 +1,5 @@ error[E0310]: the parameter type `T` may not live long enough - --> $DIR/regions-close-param-into-object.rs:6:5 + --> $DIR/regions-close-param-into-object.rs:10:5 | LL | fn p1(v: T) -> Box | - help: consider adding an explicit lifetime bound...: `T: 'static` @@ -8,7 +8,7 @@ LL | Box::new(v) | ^^^^^^^^^^^ ...so that the type `T` will meet its required lifetime bounds error[E0310]: the parameter type `T` may not live long enough - --> $DIR/regions-close-param-into-object.rs:12:5 + --> $DIR/regions-close-param-into-object.rs:16:5 | LL | fn p2(v: Box) -> Box | - help: consider adding an explicit lifetime bound...: `T: 'static` @@ -17,7 +17,7 @@ LL | Box::new(v) | ^^^^^^^^^^^ ...so that the type `Box` will meet its required lifetime bounds error[E0309]: the parameter type `T` may not live long enough - --> $DIR/regions-close-param-into-object.rs:18:5 + --> $DIR/regions-close-param-into-object.rs:22:5 | LL | fn p3<'a,T>(v: T) -> Box | - help: consider adding an explicit lifetime bound...: `T: 'a` @@ -26,7 +26,7 @@ LL | Box::new(v) | ^^^^^^^^^^^ ...so that the type `T` will meet its required lifetime bounds error[E0309]: the parameter type `T` may not live long enough - --> $DIR/regions-close-param-into-object.rs:24:5 + --> $DIR/regions-close-param-into-object.rs:28:5 | LL | fn p4<'a,T>(v: Box) -> Box | - help: consider adding an explicit lifetime bound...: `T: 'a` diff --git a/src/test/ui/regions/regions-close-param-into-object.nll.stderr b/src/test/ui/regions/regions-close-param-into-object.nll.stderr index f0464e299bb..3fbc1022631 100644 --- a/src/test/ui/regions/regions-close-param-into-object.nll.stderr +++ b/src/test/ui/regions/regions-close-param-into-object.nll.stderr @@ -1,5 +1,5 @@ error[E0310]: the parameter type `T` may not live long enough - --> $DIR/regions-close-param-into-object.rs:6:5 + --> $DIR/regions-close-param-into-object.rs:10:5 | LL | fn p1(v: T) -> Box | - help: consider adding an explicit lifetime bound...: `T: 'static` @@ -8,7 +8,7 @@ LL | Box::new(v) | ^^^^^^^^^^^ ...so that the type `T` will meet its required lifetime bounds error[E0310]: the parameter type `T` may not live long enough - --> $DIR/regions-close-param-into-object.rs:12:5 + --> $DIR/regions-close-param-into-object.rs:16:5 | LL | fn p2(v: Box) -> Box | - help: consider adding an explicit lifetime bound...: `T: 'static` @@ -17,7 +17,7 @@ LL | Box::new(v) | ^^^^^^^^^^^ ...so that the type `T` will meet its required lifetime bounds error[E0309]: the parameter type `T` may not live long enough - --> $DIR/regions-close-param-into-object.rs:18:5 + --> $DIR/regions-close-param-into-object.rs:22:5 | LL | fn p3<'a,T>(v: T) -> Box | - help: consider adding an explicit lifetime bound...: `T: 'a` @@ -26,7 +26,7 @@ LL | Box::new(v) | ^^^^^^^^^^^ ...so that the type `T` will meet its required lifetime bounds error[E0309]: the parameter type `T` may not live long enough - --> $DIR/regions-close-param-into-object.rs:24:5 + --> $DIR/regions-close-param-into-object.rs:28:5 | LL | fn p4<'a,T>(v: Box) -> Box | - help: consider adding an explicit lifetime bound...: `T: 'a` diff --git a/src/test/ui/regions/regions-close-param-into-object.rs b/src/test/ui/regions/regions-close-param-into-object.rs index 2760e5eed95..aab3ad202e6 100644 --- a/src/test/ui/regions/regions-close-param-into-object.rs +++ b/src/test/ui/regions/regions-close-param-into-object.rs @@ -1,3 +1,7 @@ +// revisions: base nll +// ignore-compare-mode-nll +//[nll] compile-flags: -Z borrowck=mir + trait X { fn foo(&self) {} } fn p1(v: T) -> Box diff --git a/src/test/ui/regions/regions-creating-enums3.stderr b/src/test/ui/regions/regions-creating-enums3.base.stderr similarity index 92% rename from src/test/ui/regions/regions-creating-enums3.stderr rename to src/test/ui/regions/regions-creating-enums3.base.stderr index 2fc1fc3f681..68a7b473695 100644 --- a/src/test/ui/regions/regions-creating-enums3.stderr +++ b/src/test/ui/regions/regions-creating-enums3.base.stderr @@ -1,5 +1,5 @@ error[E0623]: lifetime mismatch - --> $DIR/regions-creating-enums3.rs:7:5 + --> $DIR/regions-creating-enums3.rs:11:5 | LL | fn mk_add_bad1<'a,'b>(x: &'a Ast<'a>, y: &'b Ast<'b>) -> Ast<'a> { | ----------- ------- diff --git a/src/test/ui/regions/regions-creating-enums3.nll.stderr b/src/test/ui/regions/regions-creating-enums3.nll.stderr index 41d609b56d2..8334dc77687 100644 --- a/src/test/ui/regions/regions-creating-enums3.nll.stderr +++ b/src/test/ui/regions/regions-creating-enums3.nll.stderr @@ -1,5 +1,5 @@ error: lifetime may not live long enough - --> $DIR/regions-creating-enums3.rs:7:5 + --> $DIR/regions-creating-enums3.rs:11:5 | LL | fn mk_add_bad1<'a,'b>(x: &'a Ast<'a>, y: &'b Ast<'b>) -> Ast<'a> { | -- -- lifetime `'b` defined here diff --git a/src/test/ui/regions/regions-creating-enums3.rs b/src/test/ui/regions/regions-creating-enums3.rs index 3da0cb4cb81..dcea761d33f 100644 --- a/src/test/ui/regions/regions-creating-enums3.rs +++ b/src/test/ui/regions/regions-creating-enums3.rs @@ -1,10 +1,16 @@ +// revisions: base nll +// ignore-compare-mode-nll +//[nll] compile-flags: -Z borrowck=mir + enum Ast<'a> { Num(usize), Add(&'a Ast<'a>, &'a Ast<'a>) } fn mk_add_bad1<'a,'b>(x: &'a Ast<'a>, y: &'b Ast<'b>) -> Ast<'a> { - Ast::Add(x, y) //~ ERROR lifetime mismatch [E0623] + Ast::Add(x, y) + //[base]~^ ERROR lifetime mismatch [E0623] + //[nll]~^^ ERROR lifetime may not live long enough } fn main() { diff --git a/src/test/ui/regions/regions-creating-enums4.stderr b/src/test/ui/regions/regions-creating-enums4.base.stderr similarity index 81% rename from src/test/ui/regions/regions-creating-enums4.stderr rename to src/test/ui/regions/regions-creating-enums4.base.stderr index 8b1b90f5b1a..445a4291f27 100644 --- a/src/test/ui/regions/regions-creating-enums4.stderr +++ b/src/test/ui/regions/regions-creating-enums4.base.stderr @@ -1,28 +1,28 @@ error[E0495]: cannot infer an appropriate lifetime for lifetime parameter `'a` due to conflicting requirements - --> $DIR/regions-creating-enums4.rs:7:5 + --> $DIR/regions-creating-enums4.rs:11:5 | LL | Ast::Add(x, y) | ^^^^^^^^ | note: first, the lifetime cannot outlive the lifetime `'a` as defined here... - --> $DIR/regions-creating-enums4.rs:6:16 + --> $DIR/regions-creating-enums4.rs:10:16 | LL | fn mk_add_bad2<'a,'b>(x: &'a Ast<'a>, y: &'a Ast<'a>, z: &Ast) -> Ast<'b> { | ^^ note: ...so that the expression is assignable - --> $DIR/regions-creating-enums4.rs:7:14 + --> $DIR/regions-creating-enums4.rs:11:14 | LL | Ast::Add(x, y) | ^ = note: expected `&Ast<'_>` found `&Ast<'a>` note: but, the lifetime must be valid for the lifetime `'b` as defined here... - --> $DIR/regions-creating-enums4.rs:6:19 + --> $DIR/regions-creating-enums4.rs:10:19 | LL | fn mk_add_bad2<'a,'b>(x: &'a Ast<'a>, y: &'a Ast<'a>, z: &Ast) -> Ast<'b> { | ^^ note: ...so that the types are compatible - --> $DIR/regions-creating-enums4.rs:7:5 + --> $DIR/regions-creating-enums4.rs:11:5 | LL | Ast::Add(x, y) | ^^^^^^^^^^^^^^ diff --git a/src/test/ui/regions/regions-creating-enums4.nll.stderr b/src/test/ui/regions/regions-creating-enums4.nll.stderr index 91cf57e099d..e215c63d39d 100644 --- a/src/test/ui/regions/regions-creating-enums4.nll.stderr +++ b/src/test/ui/regions/regions-creating-enums4.nll.stderr @@ -1,5 +1,5 @@ error: lifetime may not live long enough - --> $DIR/regions-creating-enums4.rs:7:5 + --> $DIR/regions-creating-enums4.rs:11:5 | LL | fn mk_add_bad2<'a,'b>(x: &'a Ast<'a>, y: &'a Ast<'a>, z: &Ast) -> Ast<'b> { | -- -- lifetime `'b` defined here diff --git a/src/test/ui/regions/regions-creating-enums4.rs b/src/test/ui/regions/regions-creating-enums4.rs index 11d3d831151..18bd592b1c3 100644 --- a/src/test/ui/regions/regions-creating-enums4.rs +++ b/src/test/ui/regions/regions-creating-enums4.rs @@ -1,10 +1,16 @@ +// revisions: base nll +// ignore-compare-mode-nll +//[nll] compile-flags: -Z borrowck=mir + enum Ast<'a> { Num(usize), Add(&'a Ast<'a>, &'a Ast<'a>) } fn mk_add_bad2<'a,'b>(x: &'a Ast<'a>, y: &'a Ast<'a>, z: &Ast) -> Ast<'b> { - Ast::Add(x, y) //~ ERROR cannot infer + Ast::Add(x, y) + //[base]~^ ERROR cannot infer + //[nll]~^^ ERROR lifetime may not live long enough } fn main() { diff --git a/src/test/ui/regions/regions-early-bound-error-method.stderr b/src/test/ui/regions/regions-early-bound-error-method.base.stderr similarity index 76% rename from src/test/ui/regions/regions-early-bound-error-method.stderr rename to src/test/ui/regions/regions-early-bound-error-method.base.stderr index 99a5f0ce4cd..9e1f2b0e5bd 100644 --- a/src/test/ui/regions/regions-early-bound-error-method.stderr +++ b/src/test/ui/regions/regions-early-bound-error-method.base.stderr @@ -1,16 +1,16 @@ error[E0312]: lifetime of reference outlives lifetime of borrowed content... - --> $DIR/regions-early-bound-error-method.rs:20:9 + --> $DIR/regions-early-bound-error-method.rs:24:9 | LL | g2.get() | ^^^^^^^^ | note: ...the reference is valid for the lifetime `'a` as defined here... - --> $DIR/regions-early-bound-error-method.rs:18:6 + --> $DIR/regions-early-bound-error-method.rs:22:6 | LL | impl<'a> Box<'a> { | ^^ note: ...but the borrowed content is only valid for the lifetime `'b` as defined here - --> $DIR/regions-early-bound-error-method.rs:19:11 + --> $DIR/regions-early-bound-error-method.rs:23:11 | LL | fn or<'b,G:GetRef<'b>>(&self, g2: G) -> &'a isize { | ^^ diff --git a/src/test/ui/regions/regions-early-bound-error-method.nll.stderr b/src/test/ui/regions/regions-early-bound-error-method.nll.stderr index 7f10c051f29..98389ed0ca5 100644 --- a/src/test/ui/regions/regions-early-bound-error-method.nll.stderr +++ b/src/test/ui/regions/regions-early-bound-error-method.nll.stderr @@ -1,5 +1,5 @@ error: lifetime may not live long enough - --> $DIR/regions-early-bound-error-method.rs:20:9 + --> $DIR/regions-early-bound-error-method.rs:24:9 | LL | impl<'a> Box<'a> { | -- lifetime `'a` defined here diff --git a/src/test/ui/regions/regions-early-bound-error-method.rs b/src/test/ui/regions/regions-early-bound-error-method.rs index 32428143ef9..44ee19fa898 100644 --- a/src/test/ui/regions/regions-early-bound-error-method.rs +++ b/src/test/ui/regions/regions-early-bound-error-method.rs @@ -1,6 +1,10 @@ // Tests that you can use a fn lifetime parameter as part of // the value for a type parameter in a bound. +// revisions: base nll +// ignore-compare-mode-nll +//[nll] compile-flags: -Z borrowck=mir + trait GetRef<'a> { fn get(&self) -> &'a isize; } @@ -18,7 +22,8 @@ impl<'a> GetRef<'a> for Box<'a> { impl<'a> Box<'a> { fn or<'b,G:GetRef<'b>>(&self, g2: G) -> &'a isize { g2.get() - //~^ ERROR E0312 + //[base]~^ ERROR E0312 + //[nll]~^^ ERROR lifetime may not live long enough } } diff --git a/src/test/ui/regions/regions-early-bound-error.stderr b/src/test/ui/regions/regions-early-bound-error.base.stderr similarity index 81% rename from src/test/ui/regions/regions-early-bound-error.stderr rename to src/test/ui/regions/regions-early-bound-error.base.stderr index df9e979eacf..e1b60536d29 100644 --- a/src/test/ui/regions/regions-early-bound-error.stderr +++ b/src/test/ui/regions/regions-early-bound-error.base.stderr @@ -1,16 +1,16 @@ error[E0312]: lifetime of reference outlives lifetime of borrowed content... - --> $DIR/regions-early-bound-error.rs:19:5 + --> $DIR/regions-early-bound-error.rs:23:5 | LL | g1.get() | ^^^^^^^^ | note: ...the reference is valid for the lifetime `'b` as defined here... - --> $DIR/regions-early-bound-error.rs:18:11 + --> $DIR/regions-early-bound-error.rs:22:11 | LL | fn get<'a,'b,G:GetRef<'a, isize>>(g1: G, b: &'b isize) -> &'b isize { | ^^ note: ...but the borrowed content is only valid for the lifetime `'a` as defined here - --> $DIR/regions-early-bound-error.rs:18:8 + --> $DIR/regions-early-bound-error.rs:22:8 | LL | fn get<'a,'b,G:GetRef<'a, isize>>(g1: G, b: &'b isize) -> &'b isize { | ^^ diff --git a/src/test/ui/regions/regions-early-bound-error.nll.stderr b/src/test/ui/regions/regions-early-bound-error.nll.stderr index eb4cd5ca72e..f57249e4e8f 100644 --- a/src/test/ui/regions/regions-early-bound-error.nll.stderr +++ b/src/test/ui/regions/regions-early-bound-error.nll.stderr @@ -1,5 +1,5 @@ error: lifetime may not live long enough - --> $DIR/regions-early-bound-error.rs:19:5 + --> $DIR/regions-early-bound-error.rs:23:5 | LL | fn get<'a,'b,G:GetRef<'a, isize>>(g1: G, b: &'b isize) -> &'b isize { | -- -- lifetime `'b` defined here diff --git a/src/test/ui/regions/regions-early-bound-error.rs b/src/test/ui/regions/regions-early-bound-error.rs index 78dad4f2649..372596cd5f4 100644 --- a/src/test/ui/regions/regions-early-bound-error.rs +++ b/src/test/ui/regions/regions-early-bound-error.rs @@ -1,6 +1,10 @@ // Tests that you can use a fn lifetime parameter as part of // the value for a type parameter in a bound. +// revisions: base nll +// ignore-compare-mode-nll +//[nll] compile-flags: -Z borrowck=mir + trait GetRef<'a, T> { fn get(&self) -> &'a T; } @@ -17,7 +21,8 @@ impl<'a,T:Clone> GetRef<'a,T> for Box<'a,T> { fn get<'a,'b,G:GetRef<'a, isize>>(g1: G, b: &'b isize) -> &'b isize { g1.get() - //~^ ERROR E0312 + //[base]~^ ERROR E0312 + //[nll]~^^ ERROR lifetime may not live long enough } fn main() { diff --git a/src/test/ui/regions/regions-fn-subtyping-return-static-fail.stderr b/src/test/ui/regions/regions-fn-subtyping-return-static-fail.base.stderr similarity index 85% rename from src/test/ui/regions/regions-fn-subtyping-return-static-fail.stderr rename to src/test/ui/regions/regions-fn-subtyping-return-static-fail.base.stderr index c9ce936c7d4..2182d8f661f 100644 --- a/src/test/ui/regions/regions-fn-subtyping-return-static-fail.stderr +++ b/src/test/ui/regions/regions-fn-subtyping-return-static-fail.base.stderr @@ -1,5 +1,5 @@ error[E0308]: mismatched types - --> $DIR/regions-fn-subtyping-return-static-fail.rs:48:12 + --> $DIR/regions-fn-subtyping-return-static-fail.rs:52:12 | LL | want_G(baz); | ^^^ one type is more general than the other diff --git a/src/test/ui/regions/regions-fn-subtyping-return-static-fail.nll.stderr b/src/test/ui/regions/regions-fn-subtyping-return-static-fail.nll.stderr index c2956cd8958..0bca2cfbefd 100644 --- a/src/test/ui/regions/regions-fn-subtyping-return-static-fail.nll.stderr +++ b/src/test/ui/regions/regions-fn-subtyping-return-static-fail.nll.stderr @@ -1,5 +1,5 @@ error[E0308]: mismatched types - --> $DIR/regions-fn-subtyping-return-static-fail.rs:48:5 + --> $DIR/regions-fn-subtyping-return-static-fail.rs:52:5 | LL | want_G(baz); | ^^^^^^^^^^^ one type is more general than the other diff --git a/src/test/ui/regions/regions-fn-subtyping-return-static-fail.rs b/src/test/ui/regions/regions-fn-subtyping-return-static-fail.rs index 539221b5a04..05c6ac0cb1a 100644 --- a/src/test/ui/regions/regions-fn-subtyping-return-static-fail.rs +++ b/src/test/ui/regions/regions-fn-subtyping-return-static-fail.rs @@ -6,6 +6,10 @@ // This can safely be considered to be an instance of `F` because all // lifetimes are sublifetimes of 'static. +// revisions: base nll +// ignore-compare-mode-nll +//[nll] compile-flags: -Z borrowck=mir + #![allow(dead_code)] #![allow(unused_variables)] diff --git a/src/test/ui/regions/regions-free-region-ordering-callee.stderr b/src/test/ui/regions/regions-free-region-ordering-callee.base.stderr similarity index 90% rename from src/test/ui/regions/regions-free-region-ordering-callee.stderr rename to src/test/ui/regions/regions-free-region-ordering-callee.base.stderr index 4648bf046bc..ae6d95dd469 100644 --- a/src/test/ui/regions/regions-free-region-ordering-callee.stderr +++ b/src/test/ui/regions/regions-free-region-ordering-callee.base.stderr @@ -1,5 +1,5 @@ error[E0623]: lifetime mismatch - --> $DIR/regions-free-region-ordering-callee.rs:13:5 + --> $DIR/regions-free-region-ordering-callee.rs:17:5 | LL | fn ordering2<'a, 'b>(x: &'a &'b usize, y: &'a usize) -> &'b usize { | ------------- --------- @@ -10,7 +10,7 @@ LL | &*y | ^^^ ...but data from `x` is returned here error[E0623]: lifetime mismatch - --> $DIR/regions-free-region-ordering-callee.rs:18:24 + --> $DIR/regions-free-region-ordering-callee.rs:24:24 | LL | fn ordering3<'a, 'b>(x: &'a usize, y: &'b usize) -> &'a &'b usize { | --------- ------------- diff --git a/src/test/ui/regions/regions-free-region-ordering-callee.nll.stderr b/src/test/ui/regions/regions-free-region-ordering-callee.nll.stderr index f61f068a486..7dfff2bb060 100644 --- a/src/test/ui/regions/regions-free-region-ordering-callee.nll.stderr +++ b/src/test/ui/regions/regions-free-region-ordering-callee.nll.stderr @@ -1,5 +1,5 @@ error: lifetime may not live long enough - --> $DIR/regions-free-region-ordering-callee.rs:13:5 + --> $DIR/regions-free-region-ordering-callee.rs:17:5 | LL | fn ordering2<'a, 'b>(x: &'a &'b usize, y: &'a usize) -> &'b usize { | -- -- lifetime `'b` defined here @@ -12,7 +12,7 @@ LL | &*y = help: consider adding the following bound: `'a: 'b` error: lifetime may not live long enough - --> $DIR/regions-free-region-ordering-callee.rs:18:12 + --> $DIR/regions-free-region-ordering-callee.rs:24:12 | LL | fn ordering3<'a, 'b>(x: &'a usize, y: &'b usize) -> &'a &'b usize { | -- -- lifetime `'b` defined here diff --git a/src/test/ui/regions/regions-free-region-ordering-callee.rs b/src/test/ui/regions/regions-free-region-ordering-callee.rs index ee9a977a74f..eca863f2e79 100644 --- a/src/test/ui/regions/regions-free-region-ordering-callee.rs +++ b/src/test/ui/regions/regions-free-region-ordering-callee.rs @@ -2,6 +2,10 @@ // that appear in their parameter list. See also // regions-free-region-ordering-caller.rs +// revisions: base nll +// ignore-compare-mode-nll +//[nll] compile-flags: -Z borrowck=mir + fn ordering1<'a, 'b>(x: &'a &'b usize) -> &'a usize { // It is safe to assume that 'a <= 'b due to the type of x let y: &'b usize = &**x; @@ -10,13 +14,16 @@ fn ordering1<'a, 'b>(x: &'a &'b usize) -> &'a usize { fn ordering2<'a, 'b>(x: &'a &'b usize, y: &'a usize) -> &'b usize { // However, it is not safe to assume that 'b <= 'a - &*y //~ ERROR lifetime mismatch [E0623] + &*y + //[base]~^ ERROR lifetime mismatch [E0623] + //[nll]~^^ ERROR lifetime may not live long enough } fn ordering3<'a, 'b>(x: &'a usize, y: &'b usize) -> &'a &'b usize { // Do not infer an ordering from the return value. let z: &'b usize = &*x; - //~^ ERROR lifetime mismatch [E0623] + //[base]~^ ERROR lifetime mismatch [E0623] + //[nll]~^^ ERROR lifetime may not live long enough panic!(); } diff --git a/src/test/ui/regions/regions-free-region-ordering-incorrect.stderr b/src/test/ui/regions/regions-free-region-ordering-incorrect.base.stderr similarity index 75% rename from src/test/ui/regions/regions-free-region-ordering-incorrect.stderr rename to src/test/ui/regions/regions-free-region-ordering-incorrect.base.stderr index b0a8f4af397..eb4ffce89a3 100644 --- a/src/test/ui/regions/regions-free-region-ordering-incorrect.stderr +++ b/src/test/ui/regions/regions-free-region-ordering-incorrect.base.stderr @@ -1,26 +1,26 @@ error[E0495]: cannot infer an appropriate lifetime for borrow expression due to conflicting requirements - --> $DIR/regions-free-region-ordering-incorrect.rs:17:21 + --> $DIR/regions-free-region-ordering-incorrect.rs:21:21 | LL | None => &self.val | ^^^^^^^^^ | note: first, the lifetime cannot outlive the lifetime `'a` as defined here... - --> $DIR/regions-free-region-ordering-incorrect.rs:14:12 + --> $DIR/regions-free-region-ordering-incorrect.rs:18:12 | LL | fn get<'a>(&'a self) -> &'b T { | ^^ note: ...so that reference does not outlive borrowed content - --> $DIR/regions-free-region-ordering-incorrect.rs:17:21 + --> $DIR/regions-free-region-ordering-incorrect.rs:21:21 | LL | None => &self.val | ^^^^^^^^^ note: but, the lifetime must be valid for the lifetime `'b` as defined here... - --> $DIR/regions-free-region-ordering-incorrect.rs:13:6 + --> $DIR/regions-free-region-ordering-incorrect.rs:17:6 | LL | impl<'b, T> Node<'b, T> { | ^^ note: ...so that reference does not outlive borrowed content - --> $DIR/regions-free-region-ordering-incorrect.rs:15:9 + --> $DIR/regions-free-region-ordering-incorrect.rs:19:9 | LL | / match self.next { LL | | Some(ref next) => next.get(), diff --git a/src/test/ui/regions/regions-free-region-ordering-incorrect.nll.stderr b/src/test/ui/regions/regions-free-region-ordering-incorrect.nll.stderr index f7c75033c04..336cfd3e6c5 100644 --- a/src/test/ui/regions/regions-free-region-ordering-incorrect.nll.stderr +++ b/src/test/ui/regions/regions-free-region-ordering-incorrect.nll.stderr @@ -1,5 +1,5 @@ error: lifetime may not live long enough - --> $DIR/regions-free-region-ordering-incorrect.rs:15:9 + --> $DIR/regions-free-region-ordering-incorrect.rs:19:9 | LL | impl<'b, T> Node<'b, T> { | -- lifetime `'b` defined here diff --git a/src/test/ui/regions/regions-free-region-ordering-incorrect.rs b/src/test/ui/regions/regions-free-region-ordering-incorrect.rs index 65e3f52609e..43427d13ffa 100644 --- a/src/test/ui/regions/regions-free-region-ordering-incorrect.rs +++ b/src/test/ui/regions/regions-free-region-ordering-incorrect.rs @@ -5,6 +5,10 @@ // // This test began its life as a test for issue #4325. +// revisions: base nll +// ignore-compare-mode-nll +//[nll] compile-flags: -Z borrowck=mir + struct Node<'b, T: 'b> { val: T, next: Option<&'b Node<'b, T>> @@ -12,9 +16,9 @@ struct Node<'b, T: 'b> { impl<'b, T> Node<'b, T> { fn get<'a>(&'a self) -> &'b T { - match self.next { + match self.next { //[nll]~ ERROR lifetime may not live long enough Some(ref next) => next.get(), - None => &self.val //~ ERROR cannot infer + None => &self.val //[base]~ ERROR cannot infer } } } diff --git a/src/test/ui/regions/regions-implied-bounds-projection-gap-1.stderr b/src/test/ui/regions/regions-implied-bounds-projection-gap-1.base.stderr similarity index 87% rename from src/test/ui/regions/regions-implied-bounds-projection-gap-1.stderr rename to src/test/ui/regions/regions-implied-bounds-projection-gap-1.base.stderr index ea59ea11a14..ef68674a18f 100644 --- a/src/test/ui/regions/regions-implied-bounds-projection-gap-1.stderr +++ b/src/test/ui/regions/regions-implied-bounds-projection-gap-1.base.stderr @@ -1,5 +1,5 @@ error[E0309]: the parameter type `T` may not live long enough - --> $DIR/regions-implied-bounds-projection-gap-1.rs:16:10 + --> $DIR/regions-implied-bounds-projection-gap-1.rs:20:10 | LL | fn func<'x, T:Trait1<'x>>(t: &'x T::Foo) | -- help: consider adding an explicit lifetime bound...: `T: 'x +` diff --git a/src/test/ui/regions/regions-implied-bounds-projection-gap-1.nll.stderr b/src/test/ui/regions/regions-implied-bounds-projection-gap-1.nll.stderr index 0e1db8acf1f..6d63de6d6bd 100644 --- a/src/test/ui/regions/regions-implied-bounds-projection-gap-1.nll.stderr +++ b/src/test/ui/regions/regions-implied-bounds-projection-gap-1.nll.stderr @@ -1,5 +1,5 @@ error[E0309]: the parameter type `T` may not live long enough - --> $DIR/regions-implied-bounds-projection-gap-1.rs:16:5 + --> $DIR/regions-implied-bounds-projection-gap-1.rs:20:5 | LL | fn func<'x, T:Trait1<'x>>(t: &'x T::Foo) | -- help: consider adding an explicit lifetime bound...: `T: 'x +` diff --git a/src/test/ui/regions/regions-implied-bounds-projection-gap-1.rs b/src/test/ui/regions/regions-implied-bounds-projection-gap-1.rs index 38fc9c462da..f11fc207b91 100644 --- a/src/test/ui/regions/regions-implied-bounds-projection-gap-1.rs +++ b/src/test/ui/regions/regions-implied-bounds-projection-gap-1.rs @@ -3,6 +3,10 @@ // there might be other ways for the caller of `func` to show that // `T::Foo: 'x` holds (e.g., where-clause). +// revisions: base nll +// ignore-compare-mode-nll +//[nll] compile-flags: -Z borrowck=mir + trait Trait1<'x> { type Foo; } diff --git a/src/test/ui/regions/regions-infer-bound-from-trait-self.stderr b/src/test/ui/regions/regions-infer-bound-from-trait-self.base.stderr similarity index 82% rename from src/test/ui/regions/regions-infer-bound-from-trait-self.stderr rename to src/test/ui/regions/regions-infer-bound-from-trait-self.base.stderr index 97a3947bc0a..faa638aa281 100644 --- a/src/test/ui/regions/regions-infer-bound-from-trait-self.stderr +++ b/src/test/ui/regions/regions-infer-bound-from-trait-self.base.stderr @@ -1,5 +1,5 @@ error[E0309]: the parameter type `Self` may not live long enough - --> $DIR/regions-infer-bound-from-trait-self.rs:46:9 + --> $DIR/regions-infer-bound-from-trait-self.rs:50:9 | LL | check_bound(x, self) | ^^^^^^^^^^^ @@ -7,7 +7,7 @@ LL | check_bound(x, self) = help: consider adding an explicit lifetime bound `Self: 'a`... = note: ...so that the type `Self` will meet its required lifetime bounds... note: ...that is required by this bound - --> $DIR/regions-infer-bound-from-trait-self.rs:12:21 + --> $DIR/regions-infer-bound-from-trait-self.rs:16:21 | LL | fn check_bound<'a,A:'a>(x: Inv<'a>, a: A) { } | ^^ diff --git a/src/test/ui/regions/regions-infer-bound-from-trait-self.nll.stderr b/src/test/ui/regions/regions-infer-bound-from-trait-self.nll.stderr index e88f79a3a8c..9c886c42c72 100644 --- a/src/test/ui/regions/regions-infer-bound-from-trait-self.nll.stderr +++ b/src/test/ui/regions/regions-infer-bound-from-trait-self.nll.stderr @@ -1,5 +1,5 @@ error[E0309]: the parameter type `Self` may not live long enough - --> $DIR/regions-infer-bound-from-trait-self.rs:46:9 + --> $DIR/regions-infer-bound-from-trait-self.rs:50:9 | LL | check_bound(x, self) | ^^^^^^^^^^^^^^^^^^^^ diff --git a/src/test/ui/regions/regions-infer-bound-from-trait-self.rs b/src/test/ui/regions/regions-infer-bound-from-trait-self.rs index d15bfffe9d9..ef8be05b2d2 100644 --- a/src/test/ui/regions/regions-infer-bound-from-trait-self.rs +++ b/src/test/ui/regions/regions-infer-bound-from-trait-self.rs @@ -1,6 +1,10 @@ // Test that we can derive lifetime bounds on `Self` from trait // inheritance. +// revisions: base nll +// ignore-compare-mode-nll +//[nll] compile-flags: -Z borrowck=mir + trait Static : 'static { } trait Is<'a> : 'a { } diff --git a/src/test/ui/regions/regions-infer-bound-from-trait.stderr b/src/test/ui/regions/regions-infer-bound-from-trait.base.stderr similarity index 87% rename from src/test/ui/regions/regions-infer-bound-from-trait.stderr rename to src/test/ui/regions/regions-infer-bound-from-trait.base.stderr index fd1090d2dbd..6a7e8ba1347 100644 --- a/src/test/ui/regions/regions-infer-bound-from-trait.stderr +++ b/src/test/ui/regions/regions-infer-bound-from-trait.base.stderr @@ -1,5 +1,5 @@ error[E0309]: the parameter type `A` may not live long enough - --> $DIR/regions-infer-bound-from-trait.rs:33:5 + --> $DIR/regions-infer-bound-from-trait.rs:37:5 | LL | fn bar1<'a,A>(x: Inv<'a>, a: A) { | - help: consider adding an explicit lifetime bound...: `A: 'a` @@ -7,13 +7,13 @@ LL | check_bound(x, a) | ^^^^^^^^^^^ ...so that the type `A` will meet its required lifetime bounds... | note: ...that is required by this bound - --> $DIR/regions-infer-bound-from-trait.rs:12:21 + --> $DIR/regions-infer-bound-from-trait.rs:16:21 | LL | fn check_bound<'a,A:'a>(x: Inv<'a>, a: A) { } | ^^ error[E0309]: the parameter type `A` may not live long enough - --> $DIR/regions-infer-bound-from-trait.rs:37:5 + --> $DIR/regions-infer-bound-from-trait.rs:41:5 | LL | fn bar2<'a,'b,A:Is<'b>>(x: Inv<'a>, y: Inv<'b>, a: A) { | -- help: consider adding an explicit lifetime bound...: `A: 'a +` @@ -21,7 +21,7 @@ LL | check_bound(x, a) | ^^^^^^^^^^^ ...so that the type `A` will meet its required lifetime bounds... | note: ...that is required by this bound - --> $DIR/regions-infer-bound-from-trait.rs:12:21 + --> $DIR/regions-infer-bound-from-trait.rs:16:21 | LL | fn check_bound<'a,A:'a>(x: Inv<'a>, a: A) { } | ^^ diff --git a/src/test/ui/regions/regions-infer-bound-from-trait.nll.stderr b/src/test/ui/regions/regions-infer-bound-from-trait.nll.stderr index fe077499544..4aa4b468eaa 100644 --- a/src/test/ui/regions/regions-infer-bound-from-trait.nll.stderr +++ b/src/test/ui/regions/regions-infer-bound-from-trait.nll.stderr @@ -1,5 +1,5 @@ error[E0309]: the parameter type `A` may not live long enough - --> $DIR/regions-infer-bound-from-trait.rs:33:5 + --> $DIR/regions-infer-bound-from-trait.rs:37:5 | LL | fn bar1<'a,A>(x: Inv<'a>, a: A) { | - help: consider adding an explicit lifetime bound...: `A: 'a` @@ -7,7 +7,7 @@ LL | check_bound(x, a) | ^^^^^^^^^^^^^^^^^ ...so that the type `A` will meet its required lifetime bounds error[E0309]: the parameter type `A` may not live long enough - --> $DIR/regions-infer-bound-from-trait.rs:37:5 + --> $DIR/regions-infer-bound-from-trait.rs:41:5 | LL | fn bar2<'a,'b,A:Is<'b>>(x: Inv<'a>, y: Inv<'b>, a: A) { | -- help: consider adding an explicit lifetime bound...: `A: 'a +` diff --git a/src/test/ui/regions/regions-infer-bound-from-trait.rs b/src/test/ui/regions/regions-infer-bound-from-trait.rs index 610452182f8..96f9125313b 100644 --- a/src/test/ui/regions/regions-infer-bound-from-trait.rs +++ b/src/test/ui/regions/regions-infer-bound-from-trait.rs @@ -1,6 +1,10 @@ // Test that we can derive lifetime bounds on type parameters // from trait inheritance. +// revisions: base nll +// ignore-compare-mode-nll +//[nll] compile-flags: -Z borrowck=mir + trait Static : 'static { } trait Is<'a> : 'a { } diff --git a/src/test/ui/regions/regions-infer-contravariance-due-to-decl.stderr b/src/test/ui/regions/regions-infer-contravariance-due-to-decl.base.stderr similarity index 90% rename from src/test/ui/regions/regions-infer-contravariance-due-to-decl.stderr rename to src/test/ui/regions/regions-infer-contravariance-due-to-decl.base.stderr index f3a0358b90f..fbe2c0da6e2 100644 --- a/src/test/ui/regions/regions-infer-contravariance-due-to-decl.stderr +++ b/src/test/ui/regions/regions-infer-contravariance-due-to-decl.base.stderr @@ -1,5 +1,5 @@ error[E0623]: lifetime mismatch - --> $DIR/regions-infer-contravariance-due-to-decl.rs:25:35 + --> $DIR/regions-infer-contravariance-due-to-decl.rs:29:35 | LL | fn use_<'short,'long>(c: Contravariant<'short>, | --------------------- these two types are declared with different lifetimes... diff --git a/src/test/ui/regions/regions-infer-contravariance-due-to-decl.nll.stderr b/src/test/ui/regions/regions-infer-contravariance-due-to-decl.nll.stderr index 94b80852d01..0b1bf5271a7 100644 --- a/src/test/ui/regions/regions-infer-contravariance-due-to-decl.nll.stderr +++ b/src/test/ui/regions/regions-infer-contravariance-due-to-decl.nll.stderr @@ -1,5 +1,5 @@ error: lifetime may not live long enough - --> $DIR/regions-infer-contravariance-due-to-decl.rs:25:12 + --> $DIR/regions-infer-contravariance-due-to-decl.rs:29:12 | LL | fn use_<'short,'long>(c: Contravariant<'short>, | ------ ----- lifetime `'long` defined here diff --git a/src/test/ui/regions/regions-infer-contravariance-due-to-decl.rs b/src/test/ui/regions/regions-infer-contravariance-due-to-decl.rs index 84161388a6e..233f72fd296 100644 --- a/src/test/ui/regions/regions-infer-contravariance-due-to-decl.rs +++ b/src/test/ui/regions/regions-infer-contravariance-due-to-decl.rs @@ -4,6 +4,10 @@ // Note: see variance-regions-*.rs for the tests that check that the // variance inference works in the first place. +// revisions: base nll +// ignore-compare-mode-nll +//[nll] compile-flags: -Z borrowck=mir + use std::marker; // This is contravariant with respect to 'a, meaning that @@ -22,7 +26,9 @@ fn use_<'short,'long>(c: Contravariant<'short>, // 'short <= 'long, this would be true if the Contravariant type were // covariant with respect to its parameter 'a. - let _: Contravariant<'long> = c; //~ ERROR E0623 + let _: Contravariant<'long> = c; + //[base]~^ ERROR E0623 + //[nll]~^^ ERROR lifetime may not live long enough } fn main() {} diff --git a/src/test/ui/regions/regions-infer-covariance-due-to-decl.stderr b/src/test/ui/regions/regions-infer-covariance-due-to-decl.base.stderr similarity index 89% rename from src/test/ui/regions/regions-infer-covariance-due-to-decl.stderr rename to src/test/ui/regions/regions-infer-covariance-due-to-decl.base.stderr index c3e2075fbc3..bb22e15af69 100644 --- a/src/test/ui/regions/regions-infer-covariance-due-to-decl.stderr +++ b/src/test/ui/regions/regions-infer-covariance-due-to-decl.base.stderr @@ -1,5 +1,5 @@ error[E0623]: lifetime mismatch - --> $DIR/regions-infer-covariance-due-to-decl.rs:22:32 + --> $DIR/regions-infer-covariance-due-to-decl.rs:26:32 | LL | fn use_<'short,'long>(c: Covariant<'long>, | ---------------- diff --git a/src/test/ui/regions/regions-infer-covariance-due-to-decl.nll.stderr b/src/test/ui/regions/regions-infer-covariance-due-to-decl.nll.stderr index f44a0fad59b..4d72b8471dc 100644 --- a/src/test/ui/regions/regions-infer-covariance-due-to-decl.nll.stderr +++ b/src/test/ui/regions/regions-infer-covariance-due-to-decl.nll.stderr @@ -1,5 +1,5 @@ error: lifetime may not live long enough - --> $DIR/regions-infer-covariance-due-to-decl.rs:22:12 + --> $DIR/regions-infer-covariance-due-to-decl.rs:26:12 | LL | fn use_<'short,'long>(c: Covariant<'long>, | ------ ----- lifetime `'long` defined here diff --git a/src/test/ui/regions/regions-infer-covariance-due-to-decl.rs b/src/test/ui/regions/regions-infer-covariance-due-to-decl.rs index b5079206578..c4225e76967 100644 --- a/src/test/ui/regions/regions-infer-covariance-due-to-decl.rs +++ b/src/test/ui/regions/regions-infer-covariance-due-to-decl.rs @@ -4,6 +4,10 @@ // Note: see variance-regions-*.rs for the tests that check that the // variance inference works in the first place. +// revisions: base nll +// ignore-compare-mode-nll +//[nll] compile-flags: -Z borrowck=mir + use std::marker; struct Covariant<'a> { @@ -19,7 +23,9 @@ fn use_<'short,'long>(c: Covariant<'long>, // 'short <= 'long, this would be true if the Covariant type were // contravariant with respect to its parameter 'a. - let _: Covariant<'short> = c; //~ ERROR E0623 + let _: Covariant<'short> = c; + //[base]~^ ERROR E0623 + //[nll]~^^ ERROR lifetime may not live long enough } fn main() {} diff --git a/src/test/ui/regions/regions-infer-invariance-due-to-decl.stderr b/src/test/ui/regions/regions-infer-invariance-due-to-decl.base.stderr similarity index 81% rename from src/test/ui/regions/regions-infer-invariance-due-to-decl.stderr rename to src/test/ui/regions/regions-infer-invariance-due-to-decl.base.stderr index afd522aa003..dc7d0005ca2 100644 --- a/src/test/ui/regions/regions-infer-invariance-due-to-decl.stderr +++ b/src/test/ui/regions/regions-infer-invariance-due-to-decl.base.stderr @@ -1,5 +1,5 @@ error[E0308]: mismatched types - --> $DIR/regions-infer-invariance-due-to-decl.rs:12:5 + --> $DIR/regions-infer-invariance-due-to-decl.rs:16:5 | LL | b_isize | ^^^^^^^ lifetime mismatch @@ -7,7 +7,7 @@ LL | b_isize = note: expected struct `Invariant<'static>` found struct `Invariant<'r>` note: the lifetime `'r` as defined here... - --> $DIR/regions-infer-invariance-due-to-decl.rs:11:23 + --> $DIR/regions-infer-invariance-due-to-decl.rs:15:23 | LL | fn to_longer_lifetime<'r>(b_isize: Invariant<'r>) -> Invariant<'static> { | ^^ diff --git a/src/test/ui/regions/regions-infer-invariance-due-to-decl.nll.stderr b/src/test/ui/regions/regions-infer-invariance-due-to-decl.nll.stderr index c8c7808e06c..d7b7f9883a7 100644 --- a/src/test/ui/regions/regions-infer-invariance-due-to-decl.nll.stderr +++ b/src/test/ui/regions/regions-infer-invariance-due-to-decl.nll.stderr @@ -1,5 +1,5 @@ error: lifetime may not live long enough - --> $DIR/regions-infer-invariance-due-to-decl.rs:12:5 + --> $DIR/regions-infer-invariance-due-to-decl.rs:16:5 | LL | fn to_longer_lifetime<'r>(b_isize: Invariant<'r>) -> Invariant<'static> { | -- lifetime `'r` defined here diff --git a/src/test/ui/regions/regions-infer-invariance-due-to-decl.rs b/src/test/ui/regions/regions-infer-invariance-due-to-decl.rs index e0fa904e8fe..6433773b2d1 100644 --- a/src/test/ui/regions/regions-infer-invariance-due-to-decl.rs +++ b/src/test/ui/regions/regions-infer-invariance-due-to-decl.rs @@ -1,3 +1,7 @@ +// revisions: base nll +// ignore-compare-mode-nll +//[nll] compile-flags: -Z borrowck=mir + use std::marker; struct Invariant<'a> { @@ -9,7 +13,9 @@ fn to_same_lifetime<'r>(b_isize: Invariant<'r>) { } fn to_longer_lifetime<'r>(b_isize: Invariant<'r>) -> Invariant<'static> { - b_isize //~ ERROR mismatched types + b_isize + //[base]~^ ERROR mismatched types + //[nll]~^^ ERROR lifetime may not live long enough } fn main() { diff --git a/src/test/ui/regions/regions-infer-invariance-due-to-mutability-4.stderr b/src/test/ui/regions/regions-infer-invariance-due-to-mutability-3.base.stderr similarity index 79% rename from src/test/ui/regions/regions-infer-invariance-due-to-mutability-4.stderr rename to src/test/ui/regions/regions-infer-invariance-due-to-mutability-3.base.stderr index 04d11b5b7c7..b2530d7b6cd 100644 --- a/src/test/ui/regions/regions-infer-invariance-due-to-mutability-4.stderr +++ b/src/test/ui/regions/regions-infer-invariance-due-to-mutability-3.base.stderr @@ -1,5 +1,5 @@ error[E0308]: mismatched types - --> $DIR/regions-infer-invariance-due-to-mutability-4.rs:10:5 + --> $DIR/regions-infer-invariance-due-to-mutability-3.rs:14:5 | LL | b_isize | ^^^^^^^ lifetime mismatch @@ -7,7 +7,7 @@ LL | b_isize = note: expected struct `Invariant<'static>` found struct `Invariant<'r>` note: the lifetime `'r` as defined here... - --> $DIR/regions-infer-invariance-due-to-mutability-4.rs:9:23 + --> $DIR/regions-infer-invariance-due-to-mutability-3.rs:13:23 | LL | fn to_longer_lifetime<'r>(b_isize: Invariant<'r>) -> Invariant<'static> { | ^^ diff --git a/src/test/ui/regions/regions-infer-invariance-due-to-mutability-3.nll.stderr b/src/test/ui/regions/regions-infer-invariance-due-to-mutability-3.nll.stderr index 1165011c1f4..37fa5e3bf44 100644 --- a/src/test/ui/regions/regions-infer-invariance-due-to-mutability-3.nll.stderr +++ b/src/test/ui/regions/regions-infer-invariance-due-to-mutability-3.nll.stderr @@ -1,5 +1,5 @@ error: lifetime may not live long enough - --> $DIR/regions-infer-invariance-due-to-mutability-3.rs:10:5 + --> $DIR/regions-infer-invariance-due-to-mutability-3.rs:14:5 | LL | fn to_longer_lifetime<'r>(b_isize: Invariant<'r>) -> Invariant<'static> { | -- lifetime `'r` defined here diff --git a/src/test/ui/regions/regions-infer-invariance-due-to-mutability-3.rs b/src/test/ui/regions/regions-infer-invariance-due-to-mutability-3.rs index 5843598ab48..4690f9d8b08 100644 --- a/src/test/ui/regions/regions-infer-invariance-due-to-mutability-3.rs +++ b/src/test/ui/regions/regions-infer-invariance-due-to-mutability-3.rs @@ -1,3 +1,7 @@ +// revisions: base nll +// ignore-compare-mode-nll +//[nll] compile-flags: -Z borrowck=mir + struct Invariant<'a> { f: Box, } @@ -7,7 +11,9 @@ fn to_same_lifetime<'r>(b_isize: Invariant<'r>) { } fn to_longer_lifetime<'r>(b_isize: Invariant<'r>) -> Invariant<'static> { - b_isize //~ ERROR mismatched types + b_isize + //[base]~^ ERROR mismatched types + //[nll]~^^ ERROR lifetime may not live long enough } fn main() { diff --git a/src/test/ui/regions/regions-infer-invariance-due-to-mutability-3.stderr b/src/test/ui/regions/regions-infer-invariance-due-to-mutability-4.base.stderr similarity index 79% rename from src/test/ui/regions/regions-infer-invariance-due-to-mutability-3.stderr rename to src/test/ui/regions/regions-infer-invariance-due-to-mutability-4.base.stderr index bb594f3676e..12774ca92e2 100644 --- a/src/test/ui/regions/regions-infer-invariance-due-to-mutability-3.stderr +++ b/src/test/ui/regions/regions-infer-invariance-due-to-mutability-4.base.stderr @@ -1,5 +1,5 @@ error[E0308]: mismatched types - --> $DIR/regions-infer-invariance-due-to-mutability-3.rs:10:5 + --> $DIR/regions-infer-invariance-due-to-mutability-4.rs:14:5 | LL | b_isize | ^^^^^^^ lifetime mismatch @@ -7,7 +7,7 @@ LL | b_isize = note: expected struct `Invariant<'static>` found struct `Invariant<'r>` note: the lifetime `'r` as defined here... - --> $DIR/regions-infer-invariance-due-to-mutability-3.rs:9:23 + --> $DIR/regions-infer-invariance-due-to-mutability-4.rs:13:23 | LL | fn to_longer_lifetime<'r>(b_isize: Invariant<'r>) -> Invariant<'static> { | ^^ diff --git a/src/test/ui/regions/regions-infer-invariance-due-to-mutability-4.nll.stderr b/src/test/ui/regions/regions-infer-invariance-due-to-mutability-4.nll.stderr index f3973a93bad..1b3ef7bc028 100644 --- a/src/test/ui/regions/regions-infer-invariance-due-to-mutability-4.nll.stderr +++ b/src/test/ui/regions/regions-infer-invariance-due-to-mutability-4.nll.stderr @@ -1,5 +1,5 @@ error: lifetime may not live long enough - --> $DIR/regions-infer-invariance-due-to-mutability-4.rs:10:5 + --> $DIR/regions-infer-invariance-due-to-mutability-4.rs:14:5 | LL | fn to_longer_lifetime<'r>(b_isize: Invariant<'r>) -> Invariant<'static> { | -- lifetime `'r` defined here diff --git a/src/test/ui/regions/regions-infer-invariance-due-to-mutability-4.rs b/src/test/ui/regions/regions-infer-invariance-due-to-mutability-4.rs index f0af18cf618..8e257c4fd0e 100644 --- a/src/test/ui/regions/regions-infer-invariance-due-to-mutability-4.rs +++ b/src/test/ui/regions/regions-infer-invariance-due-to-mutability-4.rs @@ -1,3 +1,7 @@ +// revisions: base nll +// ignore-compare-mode-nll +//[nll] compile-flags: -Z borrowck=mir + struct Invariant<'a> { f: Box *mut &'a isize + 'static>, } @@ -7,7 +11,9 @@ fn to_same_lifetime<'r>(b_isize: Invariant<'r>) { } fn to_longer_lifetime<'r>(b_isize: Invariant<'r>) -> Invariant<'static> { - b_isize //~ ERROR mismatched types + b_isize + //[base]~^ ERROR mismatched types + //[nll]~^^ ERROR lifetime may not live long enough } fn main() { diff --git a/src/test/ui/regions/regions-infer-not-param.stderr b/src/test/ui/regions/regions-infer-not-param.base.stderr similarity index 84% rename from src/test/ui/regions/regions-infer-not-param.stderr rename to src/test/ui/regions/regions-infer-not-param.base.stderr index a23bdeb834f..f43274163d0 100644 --- a/src/test/ui/regions/regions-infer-not-param.stderr +++ b/src/test/ui/regions/regions-infer-not-param.base.stderr @@ -1,5 +1,5 @@ error[E0308]: mismatched types - --> $DIR/regions-infer-not-param.rs:15:54 + --> $DIR/regions-infer-not-param.rs:19:54 | LL | fn take_direct<'a,'b>(p: Direct<'a>) -> Direct<'b> { p } | ^ lifetime mismatch @@ -7,18 +7,18 @@ LL | fn take_direct<'a,'b>(p: Direct<'a>) -> Direct<'b> { p } = note: expected struct `Direct<'b>` found struct `Direct<'a>` note: the lifetime `'a` as defined here... - --> $DIR/regions-infer-not-param.rs:15:16 + --> $DIR/regions-infer-not-param.rs:19:16 | LL | fn take_direct<'a,'b>(p: Direct<'a>) -> Direct<'b> { p } | ^^ note: ...does not necessarily outlive the lifetime `'b` as defined here - --> $DIR/regions-infer-not-param.rs:15:19 + --> $DIR/regions-infer-not-param.rs:19:19 | LL | fn take_direct<'a,'b>(p: Direct<'a>) -> Direct<'b> { p } | ^^ error[E0308]: mismatched types - --> $DIR/regions-infer-not-param.rs:19:63 + --> $DIR/regions-infer-not-param.rs:25:63 | LL | fn take_indirect2<'a,'b>(p: Indirect2<'a>) -> Indirect2<'b> { p } | ^ lifetime mismatch @@ -26,18 +26,18 @@ LL | fn take_indirect2<'a,'b>(p: Indirect2<'a>) -> Indirect2<'b> { p } = note: expected struct `Indirect2<'b>` found struct `Indirect2<'a>` note: the lifetime `'a` as defined here... - --> $DIR/regions-infer-not-param.rs:19:19 + --> $DIR/regions-infer-not-param.rs:25:19 | LL | fn take_indirect2<'a,'b>(p: Indirect2<'a>) -> Indirect2<'b> { p } | ^^ note: ...does not necessarily outlive the lifetime `'b` as defined here - --> $DIR/regions-infer-not-param.rs:19:22 + --> $DIR/regions-infer-not-param.rs:25:22 | LL | fn take_indirect2<'a,'b>(p: Indirect2<'a>) -> Indirect2<'b> { p } | ^^ error[E0308]: mismatched types - --> $DIR/regions-infer-not-param.rs:19:63 + --> $DIR/regions-infer-not-param.rs:25:63 | LL | fn take_indirect2<'a,'b>(p: Indirect2<'a>) -> Indirect2<'b> { p } | ^ lifetime mismatch @@ -45,12 +45,12 @@ LL | fn take_indirect2<'a,'b>(p: Indirect2<'a>) -> Indirect2<'b> { p } = note: expected struct `Indirect2<'b>` found struct `Indirect2<'a>` note: the lifetime `'b` as defined here... - --> $DIR/regions-infer-not-param.rs:19:22 + --> $DIR/regions-infer-not-param.rs:25:22 | LL | fn take_indirect2<'a,'b>(p: Indirect2<'a>) -> Indirect2<'b> { p } | ^^ note: ...does not necessarily outlive the lifetime `'a` as defined here - --> $DIR/regions-infer-not-param.rs:19:19 + --> $DIR/regions-infer-not-param.rs:25:19 | LL | fn take_indirect2<'a,'b>(p: Indirect2<'a>) -> Indirect2<'b> { p } | ^^ diff --git a/src/test/ui/regions/regions-infer-not-param.nll.stderr b/src/test/ui/regions/regions-infer-not-param.nll.stderr index f4875e49c3d..95e6b03c350 100644 --- a/src/test/ui/regions/regions-infer-not-param.nll.stderr +++ b/src/test/ui/regions/regions-infer-not-param.nll.stderr @@ -1,5 +1,5 @@ error: lifetime may not live long enough - --> $DIR/regions-infer-not-param.rs:15:54 + --> $DIR/regions-infer-not-param.rs:19:54 | LL | fn take_direct<'a,'b>(p: Direct<'a>) -> Direct<'b> { p } | -- -- lifetime `'b` defined here ^ function was supposed to return data with lifetime `'b` but it is returning data with lifetime `'a` @@ -9,7 +9,7 @@ LL | fn take_direct<'a,'b>(p: Direct<'a>) -> Direct<'b> { p } = help: consider adding the following bound: `'a: 'b` error: lifetime may not live long enough - --> $DIR/regions-infer-not-param.rs:19:63 + --> $DIR/regions-infer-not-param.rs:25:63 | LL | fn take_indirect2<'a,'b>(p: Indirect2<'a>) -> Indirect2<'b> { p } | -- -- lifetime `'b` defined here ^ function was supposed to return data with lifetime `'a` but it is returning data with lifetime `'b` @@ -22,7 +22,7 @@ LL | fn take_indirect2<'a,'b>(p: Indirect2<'a>) -> Indirect2<'b> { p } = help: see for more information about variance error: lifetime may not live long enough - --> $DIR/regions-infer-not-param.rs:19:63 + --> $DIR/regions-infer-not-param.rs:25:63 | LL | fn take_indirect2<'a,'b>(p: Indirect2<'a>) -> Indirect2<'b> { p } | -- -- lifetime `'b` defined here ^ function was supposed to return data with lifetime `'b` but it is returning data with lifetime `'a` diff --git a/src/test/ui/regions/regions-infer-not-param.rs b/src/test/ui/regions/regions-infer-not-param.rs index 7643be64d5b..0b8af5bc152 100644 --- a/src/test/ui/regions/regions-infer-not-param.rs +++ b/src/test/ui/regions/regions-infer-not-param.rs @@ -1,3 +1,7 @@ +// revisions: base nll +// ignore-compare-mode-nll +//[nll] compile-flags: -Z borrowck=mir + struct Direct<'a> { f: &'a isize } @@ -12,15 +16,20 @@ struct Indirect2<'a> { g: Box) + 'static> } -fn take_direct<'a,'b>(p: Direct<'a>) -> Direct<'b> { p } //~ ERROR mismatched types +fn take_direct<'a,'b>(p: Direct<'a>) -> Direct<'b> { p } +//[base]~^ ERROR mismatched types +//[nll]~^^ ERROR lifetime may not live long enough fn take_indirect1(p: Indirect1) -> Indirect1 { p } -fn take_indirect2<'a,'b>(p: Indirect2<'a>) -> Indirect2<'b> { p } //~ ERROR mismatched types -//~| expected struct `Indirect2<'b>` -//~| found struct `Indirect2<'a>` -//~| ERROR mismatched types -//~| expected struct `Indirect2<'b>` -//~| found struct `Indirect2<'a>` +fn take_indirect2<'a,'b>(p: Indirect2<'a>) -> Indirect2<'b> { p } +//[base]~^ ERROR mismatched types +//[base]~| expected struct `Indirect2<'b>` +//[base]~| found struct `Indirect2<'a>` +//[base]~| ERROR mismatched types +//[base]~| expected struct `Indirect2<'b>` +//[base]~| found struct `Indirect2<'a>` +//[nll]~^^^^^^^ ERROR lifetime may not live long enough +//[nll]~| ERROR lifetime may not live long enough fn main() {} diff --git a/src/test/ui/regions/regions-infer-paramd-indirect.stderr b/src/test/ui/regions/regions-infer-paramd-indirect.base.stderr similarity index 79% rename from src/test/ui/regions/regions-infer-paramd-indirect.stderr rename to src/test/ui/regions/regions-infer-paramd-indirect.base.stderr index d2b369fb07b..1d4471f910d 100644 --- a/src/test/ui/regions/regions-infer-paramd-indirect.stderr +++ b/src/test/ui/regions/regions-infer-paramd-indirect.base.stderr @@ -1,5 +1,5 @@ error[E0308]: mismatched types - --> $DIR/regions-infer-paramd-indirect.rs:22:18 + --> $DIR/regions-infer-paramd-indirect.rs:26:18 | LL | self.f = b; | ^ lifetime mismatch @@ -7,12 +7,12 @@ LL | self.f = b; = note: expected struct `Box>` found struct `Box>` note: the anonymous lifetime defined here... - --> $DIR/regions-infer-paramd-indirect.rs:21:36 + --> $DIR/regions-infer-paramd-indirect.rs:25:36 | LL | fn set_f_bad(&mut self, b: Box) { | ^ note: ...does not necessarily outlive the lifetime `'a` as defined here - --> $DIR/regions-infer-paramd-indirect.rs:16:6 + --> $DIR/regions-infer-paramd-indirect.rs:20:6 | LL | impl<'a> SetF<'a> for C<'a> { | ^^ diff --git a/src/test/ui/regions/regions-infer-paramd-indirect.nll.stderr b/src/test/ui/regions/regions-infer-paramd-indirect.nll.stderr index afabdc1de1c..96377cbdab4 100644 --- a/src/test/ui/regions/regions-infer-paramd-indirect.nll.stderr +++ b/src/test/ui/regions/regions-infer-paramd-indirect.nll.stderr @@ -1,5 +1,5 @@ error: lifetime may not live long enough - --> $DIR/regions-infer-paramd-indirect.rs:22:9 + --> $DIR/regions-infer-paramd-indirect.rs:26:9 | LL | impl<'a> SetF<'a> for C<'a> { | -- lifetime `'a` defined here diff --git a/src/test/ui/regions/regions-infer-paramd-indirect.rs b/src/test/ui/regions/regions-infer-paramd-indirect.rs index 3b18bbf1df3..060306f611e 100644 --- a/src/test/ui/regions/regions-infer-paramd-indirect.rs +++ b/src/test/ui/regions/regions-infer-paramd-indirect.rs @@ -1,6 +1,10 @@ // Check that we correctly infer that b and c must be region // parameterized because they reference a which requires a region. +// revisions: base nll +// ignore-compare-mode-nll +//[nll] compile-flags: -Z borrowck=mir + type A<'a> = &'a isize; type B<'a> = Box>; @@ -20,10 +24,11 @@ impl<'a> SetF<'a> for C<'a> { fn set_f_bad(&mut self, b: Box) { self.f = b; - //~^ ERROR mismatched types - //~| expected struct `Box>` - //~| found struct `Box>` - //~| lifetime mismatch + //[base]~^ ERROR mismatched types + //[base]~| expected struct `Box>` + //[base]~| found struct `Box>` + //[base]~| lifetime mismatch + //[nll]~^^^^^ ERROR lifetime may not live long enough } } diff --git a/src/test/ui/regions/regions-lifetime-bounds-on-fns.stderr b/src/test/ui/regions/regions-lifetime-bounds-on-fns.base.stderr similarity index 88% rename from src/test/ui/regions/regions-lifetime-bounds-on-fns.stderr rename to src/test/ui/regions/regions-lifetime-bounds-on-fns.base.stderr index 2b2dd0dbbf2..e57b06aac39 100644 --- a/src/test/ui/regions/regions-lifetime-bounds-on-fns.stderr +++ b/src/test/ui/regions/regions-lifetime-bounds-on-fns.base.stderr @@ -1,5 +1,5 @@ error[E0623]: lifetime mismatch - --> $DIR/regions-lifetime-bounds-on-fns.rs:8:10 + --> $DIR/regions-lifetime-bounds-on-fns.rs:12:10 | LL | fn b<'a, 'b>(x: &mut &'a isize, y: &mut &'b isize) { | --------- --------- these two types are declared with different lifetimes... @@ -8,7 +8,7 @@ LL | *x = *y; | ^^ ...but data from `y` flows into `x` here error[E0623]: lifetime mismatch - --> $DIR/regions-lifetime-bounds-on-fns.rs:14:7 + --> $DIR/regions-lifetime-bounds-on-fns.rs:20:7 | LL | fn c<'a,'b>(x: &mut &'a isize, y: &mut &'b isize) { | --------- --------- these two types are declared with different lifetimes... @@ -17,7 +17,7 @@ LL | a(x, y); | ^ ...but data from `y` flows into `x` here error[E0308]: mismatched types - --> $DIR/regions-lifetime-bounds-on-fns.rs:20:43 + --> $DIR/regions-lifetime-bounds-on-fns.rs:28:43 | LL | let _: fn(&mut &isize, &mut &isize) = a; | ^ one type is more general than the other diff --git a/src/test/ui/regions/regions-lifetime-bounds-on-fns.nll.stderr b/src/test/ui/regions/regions-lifetime-bounds-on-fns.nll.stderr index ee3dcef1cb5..7fe8b4bf57f 100644 --- a/src/test/ui/regions/regions-lifetime-bounds-on-fns.nll.stderr +++ b/src/test/ui/regions/regions-lifetime-bounds-on-fns.nll.stderr @@ -1,5 +1,5 @@ error: lifetime may not live long enough - --> $DIR/regions-lifetime-bounds-on-fns.rs:8:5 + --> $DIR/regions-lifetime-bounds-on-fns.rs:12:5 | LL | fn b<'a, 'b>(x: &mut &'a isize, y: &mut &'b isize) { | -- -- lifetime `'b` defined here @@ -12,7 +12,7 @@ LL | *x = *y; = help: consider adding the following bound: `'b: 'a` error: lifetime may not live long enough - --> $DIR/regions-lifetime-bounds-on-fns.rs:14:5 + --> $DIR/regions-lifetime-bounds-on-fns.rs:20:5 | LL | fn c<'a,'b>(x: &mut &'a isize, y: &mut &'b isize) { | -- -- lifetime `'b` defined here @@ -28,7 +28,7 @@ LL | a(x, y); = help: see for more information about variance error[E0308]: mismatched types - --> $DIR/regions-lifetime-bounds-on-fns.rs:20:12 + --> $DIR/regions-lifetime-bounds-on-fns.rs:28:12 | LL | let _: fn(&mut &isize, &mut &isize) = a; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ one type is more general than the other @@ -37,7 +37,7 @@ LL | let _: fn(&mut &isize, &mut &isize) = a; found fn pointer `for<'r, 's> fn(&'r mut &isize, &'s mut &isize)` error[E0308]: mismatched types - --> $DIR/regions-lifetime-bounds-on-fns.rs:20:12 + --> $DIR/regions-lifetime-bounds-on-fns.rs:28:12 | LL | let _: fn(&mut &isize, &mut &isize) = a; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ one type is more general than the other diff --git a/src/test/ui/regions/regions-lifetime-bounds-on-fns.rs b/src/test/ui/regions/regions-lifetime-bounds-on-fns.rs index 7d7f62e1979..97c08d8ab0e 100644 --- a/src/test/ui/regions/regions-lifetime-bounds-on-fns.rs +++ b/src/test/ui/regions/regions-lifetime-bounds-on-fns.rs @@ -1,3 +1,7 @@ +// revisions: base nll +// ignore-compare-mode-nll +//[nll] compile-flags: -Z borrowck=mir + fn a<'a, 'b:'a>(x: &mut &'a isize, y: &mut &'b isize) { // Note: this is legal because of the `'b:'a` declaration. *x = *y; @@ -5,19 +9,25 @@ fn a<'a, 'b:'a>(x: &mut &'a isize, y: &mut &'b isize) { fn b<'a, 'b>(x: &mut &'a isize, y: &mut &'b isize) { // Illegal now because there is no `'b:'a` declaration. - *x = *y; //~ ERROR E0623 + *x = *y; + //[base]~^ ERROR lifetime mismatch [E0623] + //[nll]~^^ ERROR lifetime may not live long enough } fn c<'a,'b>(x: &mut &'a isize, y: &mut &'b isize) { // Here we try to call `foo` but do not know that `'a` and `'b` are // related as required. - a(x, y); //~ ERROR lifetime mismatch [E0623] + a(x, y); + //[base]~^ ERROR lifetime mismatch [E0623] + //[nll]~^^ ERROR lifetime may not live long enough } fn d() { // 'a and 'b are early bound in the function `a` because they appear // inconstraints: - let _: fn(&mut &isize, &mut &isize) = a; //~ ERROR E0308 + let _: fn(&mut &isize, &mut &isize) = a; + //~^ ERROR mismatched types [E0308] + //[nll]~^^ ERROR mismatched types [E0308] } fn e() { diff --git a/src/test/ui/regions/regions-nested-fns.stderr b/src/test/ui/regions/regions-nested-fns.base.stderr similarity index 85% rename from src/test/ui/regions/regions-nested-fns.stderr rename to src/test/ui/regions/regions-nested-fns.base.stderr index 11affcaaa79..37ce569e761 100644 --- a/src/test/ui/regions/regions-nested-fns.stderr +++ b/src/test/ui/regions/regions-nested-fns.base.stderr @@ -1,40 +1,46 @@ error[E0495]: cannot infer an appropriate lifetime due to conflicting requirements - --> $DIR/regions-nested-fns.rs:5:18 + --> $DIR/regions-nested-fns.rs:9:18 | LL | let mut ay = &y; | ^^ | note: first, the lifetime cannot outlive the anonymous lifetime #1 defined here... - --> $DIR/regions-nested-fns.rs:7:58 + --> $DIR/regions-nested-fns.rs:13:58 | LL | ignore:: FnMut(&'z isize)>>(Box::new(|z| { | __________________________________________________________^ LL | | ay = x; LL | | ay = &y; +LL | | LL | | ay = z; +LL | | LL | | })); | |_____^ note: ...so that reference does not outlive borrowed content - --> $DIR/regions-nested-fns.rs:10:14 + --> $DIR/regions-nested-fns.rs:17:14 | LL | ay = z; | ^ note: but, the lifetime must be valid for the anonymous lifetime #1 defined here... - --> $DIR/regions-nested-fns.rs:13:72 + --> $DIR/regions-nested-fns.rs:21:72 | LL | ignore::< Box FnMut(&'z isize) -> &'z isize>>(Box::new(|z| { | ________________________________________________________________________^ LL | | if false { return x; } +LL | | +LL | | LL | | if false { return ay; } LL | | return z; LL | | })); | |_____^ note: ...so that the types are compatible - --> $DIR/regions-nested-fns.rs:13:76 + --> $DIR/regions-nested-fns.rs:21:76 | LL | ignore::< Box FnMut(&'z isize) -> &'z isize>>(Box::new(|z| { | ____________________________________________________________________________^ LL | | if false { return x; } +LL | | +LL | | LL | | if false { return ay; } LL | | return z; LL | | })); @@ -43,23 +49,25 @@ LL | | })); found `&isize` error[E0312]: lifetime of reference outlives lifetime of borrowed content... - --> $DIR/regions-nested-fns.rs:14:27 + --> $DIR/regions-nested-fns.rs:22:27 | LL | if false { return x; } | ^ | note: ...the reference is valid for the anonymous lifetime #1 defined here... - --> $DIR/regions-nested-fns.rs:13:72 + --> $DIR/regions-nested-fns.rs:21:72 | LL | ignore::< Box FnMut(&'z isize) -> &'z isize>>(Box::new(|z| { | ________________________________________________________________________^ LL | | if false { return x; } +LL | | +LL | | LL | | if false { return ay; } LL | | return z; LL | | })); | |_____^ note: ...but the borrowed content is only valid for the lifetime `'x` as defined here - --> $DIR/regions-nested-fns.rs:3:11 + --> $DIR/regions-nested-fns.rs:7:11 | LL | fn nested<'x>(x: &'x isize) { | ^^ diff --git a/src/test/ui/regions/regions-nested-fns.nll.stderr b/src/test/ui/regions/regions-nested-fns.nll.stderr index a0cfa362472..6f2a89994b0 100644 --- a/src/test/ui/regions/regions-nested-fns.nll.stderr +++ b/src/test/ui/regions/regions-nested-fns.nll.stderr @@ -1,9 +1,9 @@ error[E0521]: borrowed data escapes outside of closure - --> $DIR/regions-nested-fns.rs:10:9 + --> $DIR/regions-nested-fns.rs:17:9 | LL | let mut ay = &y; | ------ `ay` declared here, outside of the closure body -LL | +... LL | ignore:: FnMut(&'z isize)>>(Box::new(|z| { | - `z` is a reference that is only valid in the closure body ... @@ -11,7 +11,7 @@ LL | ay = z; | ^^^^^^ `z` escapes the closure body here error[E0597]: `y` does not live long enough - --> $DIR/regions-nested-fns.rs:5:18 + --> $DIR/regions-nested-fns.rs:9:18 | LL | let mut ay = &y; | ^^ borrowed value does not live long enough @@ -23,7 +23,7 @@ LL | } | - `y` dropped here while still borrowed error[E0597]: `y` does not live long enough - --> $DIR/regions-nested-fns.rs:9:15 + --> $DIR/regions-nested-fns.rs:15:15 | LL | ignore:: FnMut(&'z isize)>>(Box::new(|z| { | --- value captured here @@ -38,7 +38,7 @@ LL | } | - `y` dropped here while still borrowed error: lifetime may not live long enough - --> $DIR/regions-nested-fns.rs:14:27 + --> $DIR/regions-nested-fns.rs:22:27 | LL | fn nested<'x>(x: &'x isize) { | -- lifetime `'x` defined here diff --git a/src/test/ui/regions/regions-nested-fns.rs b/src/test/ui/regions/regions-nested-fns.rs index c02d4e0ce45..8cc39792bd9 100644 --- a/src/test/ui/regions/regions-nested-fns.rs +++ b/src/test/ui/regions/regions-nested-fns.rs @@ -1,17 +1,27 @@ +// revisions: base nll +// ignore-compare-mode-nll +//[nll] compile-flags: -Z borrowck=mir + fn ignore(t: T) {} fn nested<'x>(x: &'x isize) { let y = 3; - let mut ay = &y; //~ ERROR E0495 + let mut ay = &y; + //[base]~^ ERROR E0495 + //[nll]~^^ ERROR `y` does not live long enough [E0597] ignore:: FnMut(&'z isize)>>(Box::new(|z| { ay = x; ay = &y; + //[nll]~^ ERROR `y` does not live long enough ay = z; + //[nll]~^ ERROR borrowed data escapes outside of closure [E0521] })); ignore::< Box FnMut(&'z isize) -> &'z isize>>(Box::new(|z| { - if false { return x; } //~ ERROR E0312 + if false { return x; } + //[base]~^ ERROR E0312 + //[nll]~^^ ERROR lifetime may not live long enough if false { return ay; } return z; })); diff --git a/src/test/ui/regions/regions-outlives-projection-container.stderr b/src/test/ui/regions/regions-outlives-projection-container.base.stderr similarity index 75% rename from src/test/ui/regions/regions-outlives-projection-container.stderr rename to src/test/ui/regions/regions-outlives-projection-container.base.stderr index 8c2b2c1e24a..9a66f67ea6e 100644 --- a/src/test/ui/regions/regions-outlives-projection-container.stderr +++ b/src/test/ui/regions/regions-outlives-projection-container.base.stderr @@ -1,67 +1,67 @@ error[E0491]: in type `&'a WithAssoc>`, reference has a longer lifetime than the data it references - --> $DIR/regions-outlives-projection-container.rs:36:13 + --> $DIR/regions-outlives-projection-container.rs:40:13 | LL | let _x: &'a WithAssoc> = loop { }; | ^^^^^^^^^^^^^^^^^^^^^^^^^^ | note: the pointer is valid for the lifetime `'a` as defined here - --> $DIR/regions-outlives-projection-container.rs:28:15 + --> $DIR/regions-outlives-projection-container.rs:32:15 | LL | fn with_assoc<'a,'b>() { | ^^ note: but the referenced data is only valid for the lifetime `'b` as defined here - --> $DIR/regions-outlives-projection-container.rs:28:18 + --> $DIR/regions-outlives-projection-container.rs:32:18 | LL | fn with_assoc<'a,'b>() { | ^^ error[E0491]: in type `&'a WithoutAssoc>`, reference has a longer lifetime than the data it references - --> $DIR/regions-outlives-projection-container.rs:54:13 + --> $DIR/regions-outlives-projection-container.rs:59:13 | LL | let _x: &'a WithoutAssoc> = loop { }; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | note: the pointer is valid for the lifetime `'a` as defined here - --> $DIR/regions-outlives-projection-container.rs:50:18 + --> $DIR/regions-outlives-projection-container.rs:55:18 | LL | fn without_assoc<'a,'b>() { | ^^ note: but the referenced data is only valid for the lifetime `'b` as defined here - --> $DIR/regions-outlives-projection-container.rs:50:21 + --> $DIR/regions-outlives-projection-container.rs:55:21 | LL | fn without_assoc<'a,'b>() { | ^^ error[E0491]: in type `&'a WithAssoc>`, reference has a longer lifetime than the data it references - --> $DIR/regions-outlives-projection-container.rs:63:12 + --> $DIR/regions-outlives-projection-container.rs:69:12 | LL | call::<&'a WithAssoc>>(); | ^^^^^^^^^^^^^^^^^^^^^^^^^^ | note: the pointer is valid for the lifetime `'a` as defined here - --> $DIR/regions-outlives-projection-container.rs:58:20 + --> $DIR/regions-outlives-projection-container.rs:64:20 | LL | fn call_with_assoc<'a,'b>() { | ^^ note: but the referenced data is only valid for the lifetime `'b` as defined here - --> $DIR/regions-outlives-projection-container.rs:58:23 + --> $DIR/regions-outlives-projection-container.rs:64:23 | LL | fn call_with_assoc<'a,'b>() { | ^^ error[E0491]: in type `&'a WithoutAssoc>`, reference has a longer lifetime than the data it references - --> $DIR/regions-outlives-projection-container.rs:70:12 + --> $DIR/regions-outlives-projection-container.rs:77:12 | LL | call::<&'a WithoutAssoc>>(); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | note: the pointer is valid for the lifetime `'a` as defined here - --> $DIR/regions-outlives-projection-container.rs:67:23 + --> $DIR/regions-outlives-projection-container.rs:74:23 | LL | fn call_without_assoc<'a,'b>() { | ^^ note: but the referenced data is only valid for the lifetime `'b` as defined here - --> $DIR/regions-outlives-projection-container.rs:67:26 + --> $DIR/regions-outlives-projection-container.rs:74:26 | LL | fn call_without_assoc<'a,'b>() { | ^^ diff --git a/src/test/ui/regions/regions-outlives-projection-container.nll.stderr b/src/test/ui/regions/regions-outlives-projection-container.nll.stderr index 073a3190022..d93eef9ce0b 100644 --- a/src/test/ui/regions/regions-outlives-projection-container.nll.stderr +++ b/src/test/ui/regions/regions-outlives-projection-container.nll.stderr @@ -1,5 +1,5 @@ error: lifetime may not live long enough - --> $DIR/regions-outlives-projection-container.rs:36:13 + --> $DIR/regions-outlives-projection-container.rs:40:13 | LL | fn with_assoc<'a,'b>() { | -- -- lifetime `'b` defined here @@ -12,7 +12,7 @@ LL | let _x: &'a WithAssoc> = loop { }; = help: consider adding the following bound: `'b: 'a` error: lifetime may not live long enough - --> $DIR/regions-outlives-projection-container.rs:54:13 + --> $DIR/regions-outlives-projection-container.rs:59:13 | LL | fn without_assoc<'a,'b>() { | -- -- lifetime `'b` defined here @@ -25,7 +25,7 @@ LL | let _x: &'a WithoutAssoc> = loop { }; = help: consider adding the following bound: `'b: 'a` error: lifetime may not live long enough - --> $DIR/regions-outlives-projection-container.rs:63:5 + --> $DIR/regions-outlives-projection-container.rs:69:5 | LL | fn call_with_assoc<'a,'b>() { | -- -- lifetime `'b` defined here @@ -38,7 +38,7 @@ LL | call::<&'a WithAssoc>>(); = help: consider adding the following bound: `'b: 'a` error: lifetime may not live long enough - --> $DIR/regions-outlives-projection-container.rs:70:5 + --> $DIR/regions-outlives-projection-container.rs:77:5 | LL | fn call_without_assoc<'a,'b>() { | -- -- lifetime `'b` defined here diff --git a/src/test/ui/regions/regions-outlives-projection-container.rs b/src/test/ui/regions/regions-outlives-projection-container.rs index 3afc600becb..ccfd2213b6f 100644 --- a/src/test/ui/regions/regions-outlives-projection-container.rs +++ b/src/test/ui/regions/regions-outlives-projection-container.rs @@ -2,6 +2,10 @@ // type of a bound that appears in the where clause on a struct must // outlive the location in which the type appears. Issue #22246. +// revisions: base nll +// ignore-compare-mode-nll +//[nll] compile-flags: -Z borrowck=mir + #![allow(dead_code)] #![feature(rustc_attrs)] @@ -34,7 +38,8 @@ fn with_assoc<'a,'b>() { // FIXME (#54943) NLL doesn't enforce WF condition in unreachable code if // `_x` is changed to `_` let _x: &'a WithAssoc> = loop { }; - //~^ ERROR reference has a longer lifetime + //[base]~^ ERROR reference has a longer lifetime + //[nll]~^^ ERROR lifetime may not live long enough } fn with_assoc1<'a,'b>() where 'b : 'a { @@ -52,7 +57,8 @@ fn without_assoc<'a,'b>() { // that `'b:'a` holds because the `'b` appears in `TheType<'b>`. let _x: &'a WithoutAssoc> = loop { }; - //~^ ERROR reference has a longer lifetime + //[base]~^ ERROR reference has a longer lifetime + //[nll]~^^ ERROR lifetime may not live long enough } fn call_with_assoc<'a,'b>() { @@ -61,13 +67,16 @@ fn call_with_assoc<'a,'b>() { // no data. call::<&'a WithAssoc>>(); - //~^ ERROR reference has a longer lifetime + //[base]~^ ERROR reference has a longer lifetime + //[nll]~^^ ERROR lifetime may not live long enough } fn call_without_assoc<'a,'b>() { // As `without_assoc`, but in a distinct scenario. - call::<&'a WithoutAssoc>>(); //~ ERROR reference has a longer lifetime + call::<&'a WithoutAssoc>>(); + //[base]~^ ERROR reference has a longer lifetime + //[nll]~^^ ERROR lifetime may not live long enough } fn call() { } diff --git a/src/test/ui/regions/regions-proc-bound-capture.stderr b/src/test/ui/regions/regions-proc-bound-capture.base.stderr similarity index 93% rename from src/test/ui/regions/regions-proc-bound-capture.stderr rename to src/test/ui/regions/regions-proc-bound-capture.base.stderr index 2ebe874da93..427c6f4ec8c 100644 --- a/src/test/ui/regions/regions-proc-bound-capture.stderr +++ b/src/test/ui/regions/regions-proc-bound-capture.base.stderr @@ -1,5 +1,5 @@ error[E0759]: `x` has an anonymous lifetime `'_` but it needs to satisfy a `'static` lifetime requirement - --> $DIR/regions-proc-bound-capture.rs:9:14 + --> $DIR/regions-proc-bound-capture.rs:13:14 | LL | fn static_proc(x: &isize) -> Box (isize) + 'static> { | ------ this data with an anonymous lifetime `'_`... @@ -8,7 +8,7 @@ LL | Box::new(move || { *x }) | ^^^^^^^^^^^^^^ ...is used and required to live as long as `'static` here | note: `'static` lifetime requirement introduced by the return type - --> $DIR/regions-proc-bound-capture.rs:7:59 + --> $DIR/regions-proc-bound-capture.rs:11:59 | LL | fn static_proc(x: &isize) -> Box (isize) + 'static> { | ^^^^^^^ `'static` requirement introduced here diff --git a/src/test/ui/regions/regions-proc-bound-capture.nll.stderr b/src/test/ui/regions/regions-proc-bound-capture.nll.stderr index 75890b85815..6120a53eb09 100644 --- a/src/test/ui/regions/regions-proc-bound-capture.nll.stderr +++ b/src/test/ui/regions/regions-proc-bound-capture.nll.stderr @@ -1,5 +1,5 @@ error: lifetime may not live long enough - --> $DIR/regions-proc-bound-capture.rs:9:5 + --> $DIR/regions-proc-bound-capture.rs:13:5 | LL | fn static_proc(x: &isize) -> Box (isize) + 'static> { | - let's call the lifetime of this reference `'1` diff --git a/src/test/ui/regions/regions-proc-bound-capture.rs b/src/test/ui/regions/regions-proc-bound-capture.rs index 55d964ac534..1033163c8dd 100644 --- a/src/test/ui/regions/regions-proc-bound-capture.rs +++ b/src/test/ui/regions/regions-proc-bound-capture.rs @@ -1,3 +1,7 @@ +// revisions: base nll +// ignore-compare-mode-nll +//[nll] compile-flags: -Z borrowck=mir + fn borrowed_proc<'a>(x: &'a isize) -> Box(isize) + 'a> { // This is legal, because the region bound on `proc` // states that it captures `x`. @@ -6,7 +10,9 @@ fn borrowed_proc<'a>(x: &'a isize) -> Box(isize) + 'a> { fn static_proc(x: &isize) -> Box (isize) + 'static> { // This is illegal, because the region bound on `proc` is 'static. - Box::new(move || { *x }) //~ ERROR E0759 + Box::new(move || { *x }) + //[base]~^ ERROR E0759 + //[nll]~^^ ERROR lifetime may not live long enough } fn main() { } diff --git a/src/test/ui/regions/regions-reborrow-from-shorter-mut-ref-mut-ref.stderr b/src/test/ui/regions/regions-reborrow-from-shorter-mut-ref-mut-ref.base.stderr similarity index 89% rename from src/test/ui/regions/regions-reborrow-from-shorter-mut-ref-mut-ref.stderr rename to src/test/ui/regions/regions-reborrow-from-shorter-mut-ref-mut-ref.base.stderr index aca3a1ed057..7ecdb0cd15e 100644 --- a/src/test/ui/regions/regions-reborrow-from-shorter-mut-ref-mut-ref.stderr +++ b/src/test/ui/regions/regions-reborrow-from-shorter-mut-ref-mut-ref.base.stderr @@ -1,5 +1,5 @@ error[E0623]: lifetime mismatch - --> $DIR/regions-reborrow-from-shorter-mut-ref-mut-ref.rs:4:5 + --> $DIR/regions-reborrow-from-shorter-mut-ref-mut-ref.rs:8:5 | LL | fn copy_borrowed_ptr<'a, 'b, 'c>(p: &'a mut &'b mut &'c mut isize) -> &'b mut isize { | ----------------------------- ------------- diff --git a/src/test/ui/regions/regions-reborrow-from-shorter-mut-ref-mut-ref.nll.stderr b/src/test/ui/regions/regions-reborrow-from-shorter-mut-ref-mut-ref.nll.stderr index dc905d076bb..519ada7bdfc 100644 --- a/src/test/ui/regions/regions-reborrow-from-shorter-mut-ref-mut-ref.nll.stderr +++ b/src/test/ui/regions/regions-reborrow-from-shorter-mut-ref-mut-ref.nll.stderr @@ -1,5 +1,5 @@ error: lifetime may not live long enough - --> $DIR/regions-reborrow-from-shorter-mut-ref-mut-ref.rs:4:5 + --> $DIR/regions-reborrow-from-shorter-mut-ref-mut-ref.rs:8:5 | LL | fn copy_borrowed_ptr<'a, 'b, 'c>(p: &'a mut &'b mut &'c mut isize) -> &'b mut isize { | -- -- lifetime `'b` defined here diff --git a/src/test/ui/regions/regions-reborrow-from-shorter-mut-ref-mut-ref.rs b/src/test/ui/regions/regions-reborrow-from-shorter-mut-ref-mut-ref.rs index 35aca8be25b..c4ad05010fb 100644 --- a/src/test/ui/regions/regions-reborrow-from-shorter-mut-ref-mut-ref.rs +++ b/src/test/ui/regions/regions-reborrow-from-shorter-mut-ref-mut-ref.rs @@ -1,7 +1,13 @@ // Issue #8624. Test for reborrowing with 3 levels, not just two. +// revisions: base nll +// ignore-compare-mode-nll +//[nll] compile-flags: -Z borrowck=mir + fn copy_borrowed_ptr<'a, 'b, 'c>(p: &'a mut &'b mut &'c mut isize) -> &'b mut isize { - &mut ***p //~ ERROR lifetime mismatch [E0623] + &mut ***p + //[base]~^ ERROR lifetime mismatch [E0623] + //[nll]~^^ ERROR lifetime may not live long enough } fn main() { diff --git a/src/test/ui/regions/regions-reborrow-from-shorter-mut-ref.stderr b/src/test/ui/regions/regions-reborrow-from-shorter-mut-ref.base.stderr similarity index 90% rename from src/test/ui/regions/regions-reborrow-from-shorter-mut-ref.stderr rename to src/test/ui/regions/regions-reborrow-from-shorter-mut-ref.base.stderr index a9916dbe4f5..3cb7de15850 100644 --- a/src/test/ui/regions/regions-reborrow-from-shorter-mut-ref.stderr +++ b/src/test/ui/regions/regions-reborrow-from-shorter-mut-ref.base.stderr @@ -1,5 +1,5 @@ error[E0623]: lifetime mismatch - --> $DIR/regions-reborrow-from-shorter-mut-ref.rs:6:5 + --> $DIR/regions-reborrow-from-shorter-mut-ref.rs:10:5 | LL | fn copy_borrowed_ptr<'a, 'b>(p: &'a mut &'b mut isize) -> &'b mut isize { | --------------------- ------------- diff --git a/src/test/ui/regions/regions-reborrow-from-shorter-mut-ref.nll.stderr b/src/test/ui/regions/regions-reborrow-from-shorter-mut-ref.nll.stderr index c98ec477417..4dd2a83739c 100644 --- a/src/test/ui/regions/regions-reborrow-from-shorter-mut-ref.nll.stderr +++ b/src/test/ui/regions/regions-reborrow-from-shorter-mut-ref.nll.stderr @@ -1,5 +1,5 @@ error: lifetime may not live long enough - --> $DIR/regions-reborrow-from-shorter-mut-ref.rs:6:5 + --> $DIR/regions-reborrow-from-shorter-mut-ref.rs:10:5 | LL | fn copy_borrowed_ptr<'a, 'b>(p: &'a mut &'b mut isize) -> &'b mut isize { | -- -- lifetime `'b` defined here diff --git a/src/test/ui/regions/regions-reborrow-from-shorter-mut-ref.rs b/src/test/ui/regions/regions-reborrow-from-shorter-mut-ref.rs index 77041ab4f05..c41e76e4d2a 100644 --- a/src/test/ui/regions/regions-reborrow-from-shorter-mut-ref.rs +++ b/src/test/ui/regions/regions-reborrow-from-shorter-mut-ref.rs @@ -2,8 +2,14 @@ // pointer which is backed by another `&'a mut` can only be done // for `'a` (which must be a sublifetime of `'b`). +// revisions: base nll +// ignore-compare-mode-nll +//[nll] compile-flags: -Z borrowck=mir + fn copy_borrowed_ptr<'a, 'b>(p: &'a mut &'b mut isize) -> &'b mut isize { - &mut **p //~ ERROR lifetime mismatch [E0623] + &mut **p + //[base]~^ ERROR lifetime mismatch [E0623] + //[nll]~^^ ERROR lifetime may not live long enough } fn main() { diff --git a/src/test/ui/regions/regions-ret-borrowed-1.stderr b/src/test/ui/regions/regions-ret-borrowed-1.base.stderr similarity index 78% rename from src/test/ui/regions/regions-ret-borrowed-1.stderr rename to src/test/ui/regions/regions-ret-borrowed-1.base.stderr index 86df7bfeb70..d102f93a647 100644 --- a/src/test/ui/regions/regions-ret-borrowed-1.stderr +++ b/src/test/ui/regions/regions-ret-borrowed-1.base.stderr @@ -1,28 +1,28 @@ error[E0495]: cannot infer an appropriate lifetime due to conflicting requirements - --> $DIR/regions-ret-borrowed-1.rs:10:14 + --> $DIR/regions-ret-borrowed-1.rs:14:14 | LL | with(|o| o) | ^ | note: first, the lifetime cannot outlive the anonymous lifetime #1 defined here... - --> $DIR/regions-ret-borrowed-1.rs:10:10 + --> $DIR/regions-ret-borrowed-1.rs:14:10 | LL | with(|o| o) | ^^^^^ note: ...so that the types are compatible - --> $DIR/regions-ret-borrowed-1.rs:10:14 + --> $DIR/regions-ret-borrowed-1.rs:14:14 | LL | with(|o| o) | ^ = note: expected `&isize` found `&isize` note: but, the lifetime must be valid for the lifetime `'a` as defined here... - --> $DIR/regions-ret-borrowed-1.rs:9:14 + --> $DIR/regions-ret-borrowed-1.rs:13:14 | LL | fn return_it<'a>() -> &'a isize { | ^^ note: ...so that reference does not outlive borrowed content - --> $DIR/regions-ret-borrowed-1.rs:10:5 + --> $DIR/regions-ret-borrowed-1.rs:14:5 | LL | with(|o| o) | ^^^^^^^^^^^ diff --git a/src/test/ui/regions/regions-ret-borrowed-1.nll.stderr b/src/test/ui/regions/regions-ret-borrowed-1.nll.stderr index 0784e894ea9..4fdadccab15 100644 --- a/src/test/ui/regions/regions-ret-borrowed-1.nll.stderr +++ b/src/test/ui/regions/regions-ret-borrowed-1.nll.stderr @@ -1,5 +1,5 @@ error: lifetime may not live long enough - --> $DIR/regions-ret-borrowed-1.rs:10:14 + --> $DIR/regions-ret-borrowed-1.rs:14:14 | LL | with(|o| o) | -- ^ returning this value requires that `'1` must outlive `'2` diff --git a/src/test/ui/regions/regions-ret-borrowed-1.rs b/src/test/ui/regions/regions-ret-borrowed-1.rs index 1be5edee599..fed631320b4 100644 --- a/src/test/ui/regions/regions-ret-borrowed-1.rs +++ b/src/test/ui/regions/regions-ret-borrowed-1.rs @@ -2,13 +2,18 @@ // some point regions-ret-borrowed reported an error but this file did // not, due to special hardcoding around the anonymous region. +// revisions: base nll +// ignore-compare-mode-nll +//[nll] compile-flags: -Z borrowck=mir + fn with(f: F) -> R where F: for<'a> FnOnce(&'a isize) -> R { f(&3) } fn return_it<'a>() -> &'a isize { with(|o| o) - //~^ ERROR cannot infer + //[base]~^ ERROR cannot infer an appropriate lifetime due to conflicting requirements [E0495] + //[nll]~^^ ERROR lifetime may not live long enough } fn main() { diff --git a/src/test/ui/regions/regions-ret-borrowed.stderr b/src/test/ui/regions/regions-ret-borrowed.base.stderr similarity index 79% rename from src/test/ui/regions/regions-ret-borrowed.stderr rename to src/test/ui/regions/regions-ret-borrowed.base.stderr index b9a06d97433..62b42b5dd11 100644 --- a/src/test/ui/regions/regions-ret-borrowed.stderr +++ b/src/test/ui/regions/regions-ret-borrowed.base.stderr @@ -1,28 +1,28 @@ error[E0495]: cannot infer an appropriate lifetime due to conflicting requirements - --> $DIR/regions-ret-borrowed.rs:13:14 + --> $DIR/regions-ret-borrowed.rs:17:14 | LL | with(|o| o) | ^ | note: first, the lifetime cannot outlive the anonymous lifetime #1 defined here... - --> $DIR/regions-ret-borrowed.rs:13:10 + --> $DIR/regions-ret-borrowed.rs:17:10 | LL | with(|o| o) | ^^^^^ note: ...so that the types are compatible - --> $DIR/regions-ret-borrowed.rs:13:14 + --> $DIR/regions-ret-borrowed.rs:17:14 | LL | with(|o| o) | ^ = note: expected `&isize` found `&isize` note: but, the lifetime must be valid for the lifetime `'a` as defined here... - --> $DIR/regions-ret-borrowed.rs:12:14 + --> $DIR/regions-ret-borrowed.rs:16:14 | LL | fn return_it<'a>() -> &'a isize { | ^^ note: ...so that reference does not outlive borrowed content - --> $DIR/regions-ret-borrowed.rs:13:5 + --> $DIR/regions-ret-borrowed.rs:17:5 | LL | with(|o| o) | ^^^^^^^^^^^ diff --git a/src/test/ui/regions/regions-ret-borrowed.nll.stderr b/src/test/ui/regions/regions-ret-borrowed.nll.stderr index d9be5ef89cc..d3ea5bd875f 100644 --- a/src/test/ui/regions/regions-ret-borrowed.nll.stderr +++ b/src/test/ui/regions/regions-ret-borrowed.nll.stderr @@ -1,5 +1,5 @@ error: lifetime may not live long enough - --> $DIR/regions-ret-borrowed.rs:13:14 + --> $DIR/regions-ret-borrowed.rs:17:14 | LL | with(|o| o) | -- ^ returning this value requires that `'1` must outlive `'2` diff --git a/src/test/ui/regions/regions-ret-borrowed.rs b/src/test/ui/regions/regions-ret-borrowed.rs index 5fca92d68b6..2b6855d1c71 100644 --- a/src/test/ui/regions/regions-ret-borrowed.rs +++ b/src/test/ui/regions/regions-ret-borrowed.rs @@ -5,13 +5,18 @@ // used to successfully compile because we failed to account for the // fact that fn(x: &isize) rebound the region &. +// revisions: base nll +// ignore-compare-mode-nll +//[nll] compile-flags: -Z borrowck=mir + fn with(f: F) -> R where F: FnOnce(&isize) -> R { f(&3) } fn return_it<'a>() -> &'a isize { with(|o| o) - //~^ ERROR cannot infer + //[base]~^ ERROR cannot infer an appropriate lifetime due to conflicting requirements [E0495] + //[nll]~^^ ERROR lifetime may not live long enough } fn main() { diff --git a/src/test/ui/regions/regions-static-bound.stderr b/src/test/ui/regions/regions-static-bound.base.stderr similarity index 86% rename from src/test/ui/regions/regions-static-bound.stderr rename to src/test/ui/regions/regions-static-bound.base.stderr index b8e69e02609..b37ce1e76bd 100644 --- a/src/test/ui/regions/regions-static-bound.stderr +++ b/src/test/ui/regions/regions-static-bound.base.stderr @@ -1,18 +1,18 @@ error[E0312]: lifetime of reference outlives lifetime of borrowed content... - --> $DIR/regions-static-bound.rs:6:5 + --> $DIR/regions-static-bound.rs:10:5 | LL | t | ^ | = note: ...the reference is valid for the static lifetime... note: ...but the borrowed content is only valid for the lifetime `'a` as defined here - --> $DIR/regions-static-bound.rs:5:24 + --> $DIR/regions-static-bound.rs:9:24 | LL | fn static_id_wrong_way<'a>(t: &'a ()) -> &'static () where 'static: 'a { | ^^ error[E0759]: `u` has an anonymous lifetime `'_` but it needs to satisfy a `'static` lifetime requirement - --> $DIR/regions-static-bound.rs:10:5 + --> $DIR/regions-static-bound.rs:16:5 | LL | fn error(u: &(), v: &()) { | --- this data with an anonymous lifetime `'_`... @@ -20,22 +20,22 @@ LL | static_id(&u); | ^^^^^^^^^ -- ...is used here... | note: ...and is required to live as long as `'static` here - --> $DIR/regions-static-bound.rs:10:5 + --> $DIR/regions-static-bound.rs:16:5 | LL | static_id(&u); | ^^^^^^^^^ error[E0759]: `v` has an anonymous lifetime `'_` but it needs to satisfy a `'static` lifetime requirement - --> $DIR/regions-static-bound.rs:11:5 + --> $DIR/regions-static-bound.rs:19:5 | LL | fn error(u: &(), v: &()) { | --- this data with an anonymous lifetime `'_`... -LL | static_id(&u); +... LL | static_id_indirect(&v); | ^^^^^^^^^^^^^^^^^^ -- ...is used here... | note: ...and is required to live as long as `'static` here - --> $DIR/regions-static-bound.rs:11:5 + --> $DIR/regions-static-bound.rs:19:5 | LL | static_id_indirect(&v); | ^^^^^^^^^^^^^^^^^^ diff --git a/src/test/ui/regions/regions-static-bound.nll.stderr b/src/test/ui/regions/regions-static-bound.nll.stderr index 699638c7ef9..d228c42f995 100644 --- a/src/test/ui/regions/regions-static-bound.nll.stderr +++ b/src/test/ui/regions/regions-static-bound.nll.stderr @@ -1,5 +1,5 @@ error: lifetime may not live long enough - --> $DIR/regions-static-bound.rs:6:5 + --> $DIR/regions-static-bound.rs:10:5 | LL | fn static_id_wrong_way<'a>(t: &'a ()) -> &'static () where 'static: 'a { | -- lifetime `'a` defined here @@ -7,7 +7,7 @@ LL | t | ^ returning this value requires that `'a` must outlive `'static` error[E0521]: borrowed data escapes outside of function - --> $DIR/regions-static-bound.rs:10:5 + --> $DIR/regions-static-bound.rs:16:5 | LL | fn error(u: &(), v: &()) { | - - let's call the lifetime of this reference `'1` @@ -20,13 +20,13 @@ LL | static_id(&u); | argument requires that `'1` must outlive `'static` error[E0521]: borrowed data escapes outside of function - --> $DIR/regions-static-bound.rs:11:5 + --> $DIR/regions-static-bound.rs:19:5 | LL | fn error(u: &(), v: &()) { | - - let's call the lifetime of this reference `'2` | | | `v` is a reference that is only valid in the function body -LL | static_id(&u); +... LL | static_id_indirect(&v); | ^^^^^^^^^^^^^^^^^^^^^^ | | diff --git a/src/test/ui/regions/regions-static-bound.rs b/src/test/ui/regions/regions-static-bound.rs index a977a8b36d0..058b717c95d 100644 --- a/src/test/ui/regions/regions-static-bound.rs +++ b/src/test/ui/regions/regions-static-bound.rs @@ -1,14 +1,24 @@ +// revisions: base nll +// ignore-compare-mode-nll +//[nll] compile-flags: -Z borrowck=mir + fn static_id<'a,'b>(t: &'a ()) -> &'static () where 'a: 'static { t } fn static_id_indirect<'a,'b>(t: &'a ()) -> &'static () where 'a: 'b, 'b: 'static { t } fn static_id_wrong_way<'a>(t: &'a ()) -> &'static () where 'static: 'a { - t //~ ERROR E0312 + t + //[base]~^ ERROR E0312 + //[nll]~^^ ERROR lifetime may not live long enough } fn error(u: &(), v: &()) { - static_id(&u); //~ ERROR `u` has an anonymous lifetime `'_` but it needs to satisfy a `'static` lifetime requirement [E0759] - static_id_indirect(&v); //~ ERROR `v` has an anonymous lifetime `'_` but it needs to satisfy a `'static` lifetime requirement [E0759] + static_id(&u); + //[base]~^ ERROR `u` has an anonymous lifetime `'_` but it needs to satisfy a `'static` lifetime requirement [E0759] + //[nll]~^^ ERROR borrowed data escapes outside of function [E0521] + static_id_indirect(&v); + //[base]~^ ERROR `v` has an anonymous lifetime `'_` but it needs to satisfy a `'static` lifetime requirement [E0759] + //[nll]~^^ ERROR borrowed data escapes outside of function [E0521] } fn main() {} diff --git a/src/test/ui/regions/regions-trait-object-subtyping.stderr b/src/test/ui/regions/regions-trait-object-subtyping.base.stderr similarity index 76% rename from src/test/ui/regions/regions-trait-object-subtyping.stderr rename to src/test/ui/regions/regions-trait-object-subtyping.base.stderr index d45ca94ad27..9f52136f0c0 100644 --- a/src/test/ui/regions/regions-trait-object-subtyping.stderr +++ b/src/test/ui/regions/regions-trait-object-subtyping.base.stderr @@ -1,43 +1,43 @@ error[E0478]: lifetime bound not satisfied - --> $DIR/regions-trait-object-subtyping.rs:15:5 + --> $DIR/regions-trait-object-subtyping.rs:19:5 | LL | x | ^ | note: lifetime parameter instantiated with the lifetime `'a` as defined here - --> $DIR/regions-trait-object-subtyping.rs:13:9 + --> $DIR/regions-trait-object-subtyping.rs:17:9 | LL | fn foo3<'a,'b>(x: &'a mut dyn Dummy) -> &'b mut dyn Dummy { | ^^ note: but lifetime parameter must outlive the lifetime `'b` as defined here - --> $DIR/regions-trait-object-subtyping.rs:13:12 + --> $DIR/regions-trait-object-subtyping.rs:17:12 | LL | fn foo3<'a,'b>(x: &'a mut dyn Dummy) -> &'b mut dyn Dummy { | ^^ error[E0495]: cannot infer an appropriate lifetime for automatic coercion due to conflicting requirements - --> $DIR/regions-trait-object-subtyping.rs:15:5 + --> $DIR/regions-trait-object-subtyping.rs:19:5 | LL | x | ^ | note: first, the lifetime cannot outlive the lifetime `'a` as defined here... - --> $DIR/regions-trait-object-subtyping.rs:13:9 + --> $DIR/regions-trait-object-subtyping.rs:17:9 | LL | fn foo3<'a,'b>(x: &'a mut dyn Dummy) -> &'b mut dyn Dummy { | ^^ note: ...so that reference does not outlive borrowed content - --> $DIR/regions-trait-object-subtyping.rs:15:5 + --> $DIR/regions-trait-object-subtyping.rs:19:5 | LL | x | ^ note: but, the lifetime must be valid for the lifetime `'b` as defined here... - --> $DIR/regions-trait-object-subtyping.rs:13:12 + --> $DIR/regions-trait-object-subtyping.rs:17:12 | LL | fn foo3<'a,'b>(x: &'a mut dyn Dummy) -> &'b mut dyn Dummy { | ^^ note: ...so that the types are compatible - --> $DIR/regions-trait-object-subtyping.rs:15:5 + --> $DIR/regions-trait-object-subtyping.rs:19:5 | LL | x | ^ @@ -45,7 +45,7 @@ LL | x found `&mut (dyn Dummy + 'b)` error[E0308]: mismatched types - --> $DIR/regions-trait-object-subtyping.rs:22:5 + --> $DIR/regions-trait-object-subtyping.rs:28:5 | LL | x | ^ lifetime mismatch @@ -53,12 +53,12 @@ LL | x = note: expected struct `Wrapper<&'b mut (dyn Dummy + 'b)>` found struct `Wrapper<&'a mut (dyn Dummy + 'a)>` note: the lifetime `'b` as defined here... - --> $DIR/regions-trait-object-subtyping.rs:20:15 + --> $DIR/regions-trait-object-subtyping.rs:26:15 | LL | fn foo4<'a:'b,'b>(x: Wrapper<&'a mut dyn Dummy>) -> Wrapper<&'b mut dyn Dummy> { | ^^ note: ...does not necessarily outlive the lifetime `'a` as defined here - --> $DIR/regions-trait-object-subtyping.rs:20:9 + --> $DIR/regions-trait-object-subtyping.rs:26:9 | LL | fn foo4<'a:'b,'b>(x: Wrapper<&'a mut dyn Dummy>) -> Wrapper<&'b mut dyn Dummy> { | ^^ diff --git a/src/test/ui/regions/regions-trait-object-subtyping.nll.stderr b/src/test/ui/regions/regions-trait-object-subtyping.nll.stderr index 1b3a116d508..c8cec3bd377 100644 --- a/src/test/ui/regions/regions-trait-object-subtyping.nll.stderr +++ b/src/test/ui/regions/regions-trait-object-subtyping.nll.stderr @@ -1,5 +1,5 @@ error: lifetime may not live long enough - --> $DIR/regions-trait-object-subtyping.rs:15:5 + --> $DIR/regions-trait-object-subtyping.rs:19:5 | LL | fn foo3<'a,'b>(x: &'a mut dyn Dummy) -> &'b mut dyn Dummy { | -- -- lifetime `'b` defined here @@ -15,7 +15,7 @@ LL | x = help: see for more information about variance error: lifetime may not live long enough - --> $DIR/regions-trait-object-subtyping.rs:22:5 + --> $DIR/regions-trait-object-subtyping.rs:28:5 | LL | fn foo4<'a:'b,'b>(x: Wrapper<&'a mut dyn Dummy>) -> Wrapper<&'b mut dyn Dummy> { | -- -- lifetime `'b` defined here diff --git a/src/test/ui/regions/regions-trait-object-subtyping.rs b/src/test/ui/regions/regions-trait-object-subtyping.rs index 5b36194870e..f108fc81cea 100644 --- a/src/test/ui/regions/regions-trait-object-subtyping.rs +++ b/src/test/ui/regions/regions-trait-object-subtyping.rs @@ -1,3 +1,7 @@ +// revisions: base nll +// ignore-compare-mode-nll +//[nll] compile-flags: -Z borrowck=mir + trait Dummy { fn dummy(&self); } fn foo1<'a:'b,'b>(x: &'a mut (dyn Dummy+'a)) -> &'b mut (dyn Dummy+'b) { @@ -12,14 +16,18 @@ fn foo2<'a:'b,'b>(x: &'b mut (dyn Dummy+'a)) -> &'b mut (dyn Dummy+'b) { fn foo3<'a,'b>(x: &'a mut dyn Dummy) -> &'b mut dyn Dummy { // Without knowing 'a:'b, we can't coerce - x //~ ERROR lifetime bound not satisfied - //~^ ERROR cannot infer an appropriate lifetime + x + //[base]~^ ERROR lifetime bound not satisfied + //[base]~| ERROR cannot infer an appropriate lifetime + //[nll]~^^^ ERROR lifetime may not live long enough } struct Wrapper(T); fn foo4<'a:'b,'b>(x: Wrapper<&'a mut dyn Dummy>) -> Wrapper<&'b mut dyn Dummy> { // We can't coerce because it is packed in `Wrapper` - x //~ ERROR mismatched types + x + //[base]~^ ERROR mismatched types + //[nll]~^^ ERROR lifetime may not live long enough } fn main() {} diff --git a/src/test/ui/regions/regions-variance-contravariant-use-covariant-in-second-position.stderr b/src/test/ui/regions/regions-variance-contravariant-use-covariant-in-second-position.base.stderr similarity index 96% rename from src/test/ui/regions/regions-variance-contravariant-use-covariant-in-second-position.stderr rename to src/test/ui/regions/regions-variance-contravariant-use-covariant-in-second-position.base.stderr index 98f7a8136da..23b3dea885d 100644 --- a/src/test/ui/regions/regions-variance-contravariant-use-covariant-in-second-position.stderr +++ b/src/test/ui/regions/regions-variance-contravariant-use-covariant-in-second-position.base.stderr @@ -1,5 +1,5 @@ error[E0623]: lifetime mismatch - --> $DIR/regions-variance-contravariant-use-covariant-in-second-position.rs:25:30 + --> $DIR/regions-variance-contravariant-use-covariant-in-second-position.rs:29:30 | LL | fn use_<'short,'long>(c: S<'long, 'short>, | ---------------- this type is declared with multiple lifetimes... diff --git a/src/test/ui/regions/regions-variance-contravariant-use-covariant-in-second-position.nll.stderr b/src/test/ui/regions/regions-variance-contravariant-use-covariant-in-second-position.nll.stderr index 5352be430fb..f364f423f4e 100644 --- a/src/test/ui/regions/regions-variance-contravariant-use-covariant-in-second-position.nll.stderr +++ b/src/test/ui/regions/regions-variance-contravariant-use-covariant-in-second-position.nll.stderr @@ -1,5 +1,5 @@ error: lifetime may not live long enough - --> $DIR/regions-variance-contravariant-use-covariant-in-second-position.rs:25:12 + --> $DIR/regions-variance-contravariant-use-covariant-in-second-position.rs:29:12 | LL | fn use_<'short,'long>(c: S<'long, 'short>, | ------ ----- lifetime `'long` defined here diff --git a/src/test/ui/regions/regions-variance-contravariant-use-covariant-in-second-position.rs b/src/test/ui/regions/regions-variance-contravariant-use-covariant-in-second-position.rs index 8ddd041d457..4bf32ec3082 100644 --- a/src/test/ui/regions/regions-variance-contravariant-use-covariant-in-second-position.rs +++ b/src/test/ui/regions/regions-variance-contravariant-use-covariant-in-second-position.rs @@ -4,6 +4,10 @@ // Note: see variance-regions-*.rs for the tests that check that the // variance inference works in the first place. +// revisions: base nll +// ignore-compare-mode-nll +//[nll] compile-flags: -Z borrowck=mir + // `S` is contravariant with respect to both parameters. struct S<'a, 'b> { f: &'a isize, @@ -22,7 +26,9 @@ fn use_<'short,'long>(c: S<'long, 'short>, // 'short <= 'long, this would be true if the Contravariant type were // covariant with respect to its parameter 'a. - let _: S<'long, 'long> = c; //~ ERROR E0623 + let _: S<'long, 'long> = c; + //[base]~^ ERROR E0623 + //[nll]~^^ ERROR lifetime may not live long enough } fn main() {} diff --git a/src/test/ui/regions/regions-variance-contravariant-use-covariant.stderr b/src/test/ui/regions/regions-variance-contravariant-use-covariant.base.stderr similarity index 89% rename from src/test/ui/regions/regions-variance-contravariant-use-covariant.stderr rename to src/test/ui/regions/regions-variance-contravariant-use-covariant.base.stderr index e7c106cbbe3..8eca0d4d121 100644 --- a/src/test/ui/regions/regions-variance-contravariant-use-covariant.stderr +++ b/src/test/ui/regions/regions-variance-contravariant-use-covariant.base.stderr @@ -1,5 +1,5 @@ error[E0623]: lifetime mismatch - --> $DIR/regions-variance-contravariant-use-covariant.rs:23:35 + --> $DIR/regions-variance-contravariant-use-covariant.rs:27:35 | LL | fn use_<'short,'long>(c: Contravariant<'short>, | --------------------- these two types are declared with different lifetimes... diff --git a/src/test/ui/regions/regions-variance-contravariant-use-covariant.nll.stderr b/src/test/ui/regions/regions-variance-contravariant-use-covariant.nll.stderr index 22c9b915bb9..bc6dd6e69ed 100644 --- a/src/test/ui/regions/regions-variance-contravariant-use-covariant.nll.stderr +++ b/src/test/ui/regions/regions-variance-contravariant-use-covariant.nll.stderr @@ -1,5 +1,5 @@ error: lifetime may not live long enough - --> $DIR/regions-variance-contravariant-use-covariant.rs:23:12 + --> $DIR/regions-variance-contravariant-use-covariant.rs:27:12 | LL | fn use_<'short,'long>(c: Contravariant<'short>, | ------ ----- lifetime `'long` defined here diff --git a/src/test/ui/regions/regions-variance-contravariant-use-covariant.rs b/src/test/ui/regions/regions-variance-contravariant-use-covariant.rs index cbdf62ecb61..ea08a709230 100644 --- a/src/test/ui/regions/regions-variance-contravariant-use-covariant.rs +++ b/src/test/ui/regions/regions-variance-contravariant-use-covariant.rs @@ -4,6 +4,10 @@ // Note: see variance-regions-*.rs for the tests that check that the // variance inference works in the first place. +// revisions: base nll +// ignore-compare-mode-nll +//[nll] compile-flags: -Z borrowck=mir + // This is contravariant with respect to 'a, meaning that // Contravariant<'long> <: Contravariant<'short> iff // 'short <= 'long @@ -20,7 +24,9 @@ fn use_<'short,'long>(c: Contravariant<'short>, // 'short <= 'long, this would be true if the Contravariant type were // covariant with respect to its parameter 'a. - let _: Contravariant<'long> = c; //~ ERROR E0623 + let _: Contravariant<'long> = c; + //[base]~^ ERROR E0623 + //[nll]~^^ ERROR lifetime may not live long enough } fn main() {} diff --git a/src/test/ui/regions/regions-variance-covariant-use-contravariant.stderr b/src/test/ui/regions/regions-variance-covariant-use-contravariant.base.stderr similarity index 88% rename from src/test/ui/regions/regions-variance-covariant-use-contravariant.stderr rename to src/test/ui/regions/regions-variance-covariant-use-contravariant.base.stderr index e5e5261ba99..565de38ee11 100644 --- a/src/test/ui/regions/regions-variance-covariant-use-contravariant.stderr +++ b/src/test/ui/regions/regions-variance-covariant-use-contravariant.base.stderr @@ -1,5 +1,5 @@ error[E0623]: lifetime mismatch - --> $DIR/regions-variance-covariant-use-contravariant.rs:23:32 + --> $DIR/regions-variance-covariant-use-contravariant.rs:27:32 | LL | fn use_<'short,'long>(c: Covariant<'long>, | ---------------- diff --git a/src/test/ui/regions/regions-variance-covariant-use-contravariant.nll.stderr b/src/test/ui/regions/regions-variance-covariant-use-contravariant.nll.stderr index a07181ad553..9d3cebc9a4d 100644 --- a/src/test/ui/regions/regions-variance-covariant-use-contravariant.nll.stderr +++ b/src/test/ui/regions/regions-variance-covariant-use-contravariant.nll.stderr @@ -1,5 +1,5 @@ error: lifetime may not live long enough - --> $DIR/regions-variance-covariant-use-contravariant.rs:23:12 + --> $DIR/regions-variance-covariant-use-contravariant.rs:27:12 | LL | fn use_<'short,'long>(c: Covariant<'long>, | ------ ----- lifetime `'long` defined here diff --git a/src/test/ui/regions/regions-variance-covariant-use-contravariant.rs b/src/test/ui/regions/regions-variance-covariant-use-contravariant.rs index 9aa0c819271..748ad84840a 100644 --- a/src/test/ui/regions/regions-variance-covariant-use-contravariant.rs +++ b/src/test/ui/regions/regions-variance-covariant-use-contravariant.rs @@ -4,6 +4,10 @@ // Note: see variance-regions-*.rs for the tests that check that the // variance inference works in the first place. +// revisions: base nll +// ignore-compare-mode-nll +//[nll] compile-flags: -Z borrowck=mir + // This is covariant with respect to 'a, meaning that // Covariant<'foo> <: Covariant<'static> because // 'foo <= 'static @@ -20,7 +24,9 @@ fn use_<'short,'long>(c: Covariant<'long>, // 'short <= 'long, this would be true if the Covariant type were // contravariant with respect to its parameter 'a. - let _: Covariant<'short> = c; //~ ERROR E0623 + let _: Covariant<'short> = c; + //[base]~^ ERROR E0623 + //[nll]~^^ ERROR lifetime may not live long enough } fn main() {} diff --git a/src/test/ui/regions/regions-variance-invariant-use-contravariant.stderr b/src/test/ui/regions/regions-variance-invariant-use-contravariant.base.stderr similarity index 88% rename from src/test/ui/regions/regions-variance-invariant-use-contravariant.stderr rename to src/test/ui/regions/regions-variance-invariant-use-contravariant.base.stderr index 2a2d5d019a1..e2e8958f53e 100644 --- a/src/test/ui/regions/regions-variance-invariant-use-contravariant.stderr +++ b/src/test/ui/regions/regions-variance-invariant-use-contravariant.base.stderr @@ -1,5 +1,5 @@ error[E0623]: lifetime mismatch - --> $DIR/regions-variance-invariant-use-contravariant.rs:20:32 + --> $DIR/regions-variance-invariant-use-contravariant.rs:24:32 | LL | fn use_<'short,'long>(c: Invariant<'long>, | ---------------- diff --git a/src/test/ui/regions/regions-variance-invariant-use-contravariant.nll.stderr b/src/test/ui/regions/regions-variance-invariant-use-contravariant.nll.stderr index b35a2cb905d..b4ccb1693a7 100644 --- a/src/test/ui/regions/regions-variance-invariant-use-contravariant.nll.stderr +++ b/src/test/ui/regions/regions-variance-invariant-use-contravariant.nll.stderr @@ -1,5 +1,5 @@ error: lifetime may not live long enough - --> $DIR/regions-variance-invariant-use-contravariant.rs:20:12 + --> $DIR/regions-variance-invariant-use-contravariant.rs:24:12 | LL | fn use_<'short,'long>(c: Invariant<'long>, | ------ ----- lifetime `'long` defined here diff --git a/src/test/ui/regions/regions-variance-invariant-use-contravariant.rs b/src/test/ui/regions/regions-variance-invariant-use-contravariant.rs index 663b23b37d4..788f9b1b4d0 100644 --- a/src/test/ui/regions/regions-variance-invariant-use-contravariant.rs +++ b/src/test/ui/regions/regions-variance-invariant-use-contravariant.rs @@ -4,6 +4,10 @@ // Note: see variance-regions-*.rs for the tests that check that the // variance inference works in the first place. +// revisions: base nll +// ignore-compare-mode-nll +//[nll] compile-flags: -Z borrowck=mir + struct Invariant<'a> { f: &'a mut &'a isize } @@ -17,7 +21,9 @@ fn use_<'short,'long>(c: Invariant<'long>, // 'short <= 'long, this would be true if the Invariant type were // contravariant with respect to its parameter 'a. - let _: Invariant<'short> = c; //~ ERROR E0623 + let _: Invariant<'short> = c; + //[base]~^ ERROR E0623 + //[nll]~^^ ERROR lifetime may not live long enough } fn main() { } diff --git a/src/test/ui/regions/regions-variance-invariant-use-covariant.stderr b/src/test/ui/regions/regions-variance-invariant-use-covariant.base.stderr similarity index 80% rename from src/test/ui/regions/regions-variance-invariant-use-covariant.stderr rename to src/test/ui/regions/regions-variance-invariant-use-covariant.base.stderr index 7801517595d..da91db1b918 100644 --- a/src/test/ui/regions/regions-variance-invariant-use-covariant.stderr +++ b/src/test/ui/regions/regions-variance-invariant-use-covariant.base.stderr @@ -1,5 +1,5 @@ error[E0308]: mismatched types - --> $DIR/regions-variance-invariant-use-covariant.rs:17:33 + --> $DIR/regions-variance-invariant-use-covariant.rs:21:33 | LL | let _: Invariant<'static> = c; | ^ lifetime mismatch @@ -7,7 +7,7 @@ LL | let _: Invariant<'static> = c; = note: expected struct `Invariant<'static>` found struct `Invariant<'b>` note: the lifetime `'b` as defined here... - --> $DIR/regions-variance-invariant-use-covariant.rs:11:9 + --> $DIR/regions-variance-invariant-use-covariant.rs:15:9 | LL | fn use_<'b>(c: Invariant<'b>) { | ^^ diff --git a/src/test/ui/regions/regions-variance-invariant-use-covariant.nll.stderr b/src/test/ui/regions/regions-variance-invariant-use-covariant.nll.stderr index 761e78d179e..7b05c357589 100644 --- a/src/test/ui/regions/regions-variance-invariant-use-covariant.nll.stderr +++ b/src/test/ui/regions/regions-variance-invariant-use-covariant.nll.stderr @@ -1,5 +1,5 @@ error: lifetime may not live long enough - --> $DIR/regions-variance-invariant-use-covariant.rs:17:12 + --> $DIR/regions-variance-invariant-use-covariant.rs:21:12 | LL | fn use_<'b>(c: Invariant<'b>) { | -- lifetime `'b` defined here diff --git a/src/test/ui/regions/regions-variance-invariant-use-covariant.rs b/src/test/ui/regions/regions-variance-invariant-use-covariant.rs index 07482e6fd19..4b7da4493ac 100644 --- a/src/test/ui/regions/regions-variance-invariant-use-covariant.rs +++ b/src/test/ui/regions/regions-variance-invariant-use-covariant.rs @@ -4,6 +4,10 @@ // Note: see variance-regions-*.rs for the tests that check that the // variance inference works in the first place. +// revisions: base nll +// ignore-compare-mode-nll +//[nll] compile-flags: -Z borrowck=mir + struct Invariant<'a> { f: &'a mut &'a isize } @@ -14,7 +18,9 @@ fn use_<'b>(c: Invariant<'b>) { // Since 'b <= 'static, this would be true if Invariant were covariant // with respect to its parameter 'a. - let _: Invariant<'static> = c; //~ ERROR mismatched types + let _: Invariant<'static> = c; + //[base]~^ ERROR mismatched types [E0308] + //[nll]~^^ ERROR lifetime may not live long enough } fn main() { }