From 383fbeec637fcb7c407fffd5e1f3d37bf0dba9df Mon Sep 17 00:00:00 2001 From: Jack Huey <31162821+jackh726@users.noreply.github.com> Date: Sun, 22 May 2022 02:05:15 -0400 Subject: [PATCH] Use revisions for NLL in lifetimes --- ...187-2.stderr => issue-79187-2.base.stderr} | 18 ++++++++--------- .../ui/lifetimes/issue-79187-2.nll.stderr | 20 +++++++++---------- src/test/ui/lifetimes/issue-79187-2.rs | 19 +++++++++++++++--- ...e-79187.stderr => issue-79187.base.stderr} | 2 +- src/test/ui/lifetimes/issue-79187.nll.stderr | 8 ++++---- src/test/ui/lifetimes/issue-79187.rs | 8 +++++++- .../issue-90170-elision-mismatch-nll.fixed | 15 ++++++++++++++ .../issue-90170-elision-mismatch-nll.rs | 15 ++++++++++++++ ...> issue-90170-elision-mismatch-nll.stderr} | 6 +++--- .../issue-90170-elision-mismatch.fixed | 5 +++++ .../lifetimes/issue-90170-elision-mismatch.rs | 5 +++++ .../issue-90170-elision-mismatch.stderr | 6 +++--- ...pected-return-static-indirect.base.stderr} | 2 +- ...expected-return-static-indirect.nll.stderr | 6 +++--- ...e-90600-expected-return-static-indirect.rs | 8 +++++++- ...ime-bound-will-change-warning.base.stderr} | 8 ++++---- ...etime-bound-will-change-warning.nll.stderr | 4 ++-- .../lifetime-bound-will-change-warning.rs | 12 +++++++++-- ...sting-name-if-else-using-impl.base.stderr} | 2 +- ...xisting-name-if-else-using-impl.nll.stderr | 2 +- ...rn-one-existing-name-if-else-using-impl.rs | 8 +++++++- ...ting-name-return-type-is-anon.base.stderr} | 2 +- ...isting-name-return-type-is-anon.nll.stderr | 2 +- ...n-one-existing-name-return-type-is-anon.rs | 8 +++++++- ...ne-existing-name-self-is-anon.base.stderr} | 2 +- ...-one-existing-name-self-is-anon.nll.stderr | 2 +- ...1-return-one-existing-name-self-is-anon.rs | 8 +++++++- ...ex2a-push-one-existing-name-2.base.stderr} | 2 +- .../ex2a-push-one-existing-name-2.nll.stderr | 2 +- .../ex2a-push-one-existing-name-2.rs | 4 ++++ ...one-existing-name-early-bound.base.stderr} | 2 +- ...h-one-existing-name-early-bound.nll.stderr | 2 +- ...ex2a-push-one-existing-name-early-bound.rs | 4 ++++ ...> ex2a-push-one-existing-name.base.stderr} | 2 +- .../ex2a-push-one-existing-name.nll.stderr | 2 +- .../ex2a-push-one-existing-name.rs | 4 ++++ ...> ex2b-push-no-existing-names.base.stderr} | 2 +- .../ex2b-push-no-existing-names.nll.stderr | 2 +- .../ex2b-push-no-existing-names.rs | 8 +++++++- ... ex2c-push-inference-variable.base.stderr} | 2 +- .../ex2c-push-inference-variable.nll.stderr | 2 +- .../ex2c-push-inference-variable.rs | 8 +++++++- ...x2d-push-inference-variable-2.base.stderr} | 2 +- .../ex2d-push-inference-variable-2.nll.stderr | 2 +- .../ex2d-push-inference-variable-2.rs | 8 +++++++- ...x2e-push-inference-variable-3.base.stderr} | 2 +- .../ex2e-push-inference-variable-3.nll.stderr | 2 +- .../ex2e-push-inference-variable-3.rs | 8 +++++++- ...rr => ex3-both-anon-regions-2.base.stderr} | 2 +- .../ex3-both-anon-regions-2.nll.stderr | 2 +- .../ex3-both-anon-regions-2.rs | 8 +++++++- ...rr => ex3-both-anon-regions-3.base.stderr} | 4 ++-- .../ex3-both-anon-regions-3.nll.stderr | 4 ++-- .../ex3-both-anon-regions-3.rs | 11 ++++++++-- ...on-regions-both-are-structs-2.base.stderr} | 2 +- ...anon-regions-both-are-structs-2.nll.stderr | 2 +- ...x3-both-anon-regions-both-are-structs-2.rs | 8 +++++++- ...on-regions-both-are-structs-3.base.stderr} | 2 +- ...anon-regions-both-are-structs-3.nll.stderr | 2 +- ...x3-both-anon-regions-both-are-structs-3.rs | 8 +++++++- ...re-structs-earlybound-regions.base.stderr} | 2 +- ...-are-structs-earlybound-regions.nll.stderr | 2 +- ...ons-both-are-structs-earlybound-regions.rs | 8 +++++++- ...are-structs-latebound-regions.base.stderr} | 2 +- ...h-are-structs-latebound-regions.nll.stderr | 2 +- ...ions-both-are-structs-latebound-regions.rs | 8 +++++++- ...anon-regions-both-are-structs.base.stderr} | 2 +- ...h-anon-regions-both-are-structs.nll.stderr | 2 +- .../ex3-both-anon-regions-both-are-structs.rs | 8 +++++++- ...non-regions-latebound-regions.base.stderr} | 2 +- ...-anon-regions-latebound-regions.nll.stderr | 2 +- ...ex3-both-anon-regions-latebound-regions.rs | 8 +++++++- ...-anon-regions-one-is-struct-2.base.stderr} | 2 +- ...th-anon-regions-one-is-struct-2.nll.stderr | 4 ++-- .../ex3-both-anon-regions-one-is-struct-2.rs | 9 ++++++++- ...-anon-regions-one-is-struct-3.base.stderr} | 2 +- ...th-anon-regions-one-is-struct-3.nll.stderr | 2 +- .../ex3-both-anon-regions-one-is-struct-3.rs | 8 +++++++- ...-anon-regions-one-is-struct-4.base.stderr} | 2 +- ...th-anon-regions-one-is-struct-4.nll.stderr | 2 +- .../ex3-both-anon-regions-one-is-struct-4.rs | 8 +++++++- ...th-anon-regions-one-is-struct.base.stderr} | 2 +- ...both-anon-regions-one-is-struct.nll.stderr | 2 +- .../ex3-both-anon-regions-one-is-struct.rs | 8 +++++++- ...n-regions-return-type-is-anon.base.stderr} | 2 +- ...non-regions-return-type-is-anon.nll.stderr | 2 +- ...3-both-anon-regions-return-type-is-anon.rs | 8 +++++++- ...oth-anon-regions-self-is-anon.base.stderr} | 2 +- ...-both-anon-regions-self-is-anon.nll.stderr | 2 +- .../ex3-both-anon-regions-self-is-anon.rs | 8 +++++++- ...h-anon-regions-using-fn-items.base.stderr} | 2 +- ...oth-anon-regions-using-fn-items.nll.stderr | 4 ++-- .../ex3-both-anon-regions-using-fn-items.rs | 9 ++++++++- ...anon-regions-using-impl-items.base.stderr} | 2 +- ...h-anon-regions-using-impl-items.nll.stderr | 2 +- .../ex3-both-anon-regions-using-impl-items.rs | 8 +++++++- ...n-regions-using-trait-objects.base.stderr} | 2 +- ...non-regions-using-trait-objects.nll.stderr | 4 ++-- ...3-both-anon-regions-using-trait-objects.rs | 9 ++++++++- ...derr => ex3-both-anon-regions.base.stderr} | 2 +- .../ex3-both-anon-regions.nll.stderr | 2 +- .../lifetime-errors/ex3-both-anon-regions.rs | 8 +++++++- ...e_74400.stderr => issue_74400.base.stderr} | 2 +- .../lifetime-errors/issue_74400.nll.stderr | 8 ++++---- .../lifetimes/lifetime-errors/issue_74400.rs | 10 +++++++++- ...r.stderr => re-empty-in-error.base.stderr} | 4 ++-- .../ui/lifetimes/re-empty-in-error.nll.stderr | 2 +- src/test/ui/lifetimes/re-empty-in-error.rs | 10 ++++++++-- 108 files changed, 398 insertions(+), 145 deletions(-) rename src/test/ui/lifetimes/{issue-79187-2.stderr => issue-79187-2.base.stderr} (83%) rename src/test/ui/lifetimes/{issue-79187.stderr => issue-79187.base.stderr} (92%) create mode 100644 src/test/ui/lifetimes/issue-90170-elision-mismatch-nll.fixed create mode 100644 src/test/ui/lifetimes/issue-90170-elision-mismatch-nll.rs rename src/test/ui/lifetimes/{issue-90170-elision-mismatch.nll.stderr => issue-90170-elision-mismatch-nll.stderr} (92%) rename src/test/ui/lifetimes/{issue-90600-expected-return-static-indirect.stderr => issue-90600-expected-return-static-indirect.base.stderr} (89%) rename src/test/ui/lifetimes/{lifetime-bound-will-change-warning.stderr => lifetime-bound-will-change-warning.base.stderr} (80%) rename src/test/ui/lifetimes/lifetime-errors/{ex1-return-one-existing-name-if-else-using-impl.stderr => ex1-return-one-existing-name-if-else-using-impl.base.stderr} (88%) rename src/test/ui/lifetimes/lifetime-errors/{ex1-return-one-existing-name-return-type-is-anon.stderr => ex1-return-one-existing-name-return-type-is-anon.base.stderr} (86%) rename src/test/ui/lifetimes/lifetime-errors/{ex1-return-one-existing-name-self-is-anon.stderr => ex1-return-one-existing-name-self-is-anon.base.stderr} (88%) rename src/test/ui/lifetimes/lifetime-errors/{ex2a-push-one-existing-name-2.stderr => ex2a-push-one-existing-name-2.base.stderr} (88%) rename src/test/ui/lifetimes/lifetime-errors/{ex2a-push-one-existing-name-early-bound.stderr => ex2a-push-one-existing-name-early-bound.base.stderr} (86%) rename src/test/ui/lifetimes/lifetime-errors/{ex2a-push-one-existing-name.stderr => ex2a-push-one-existing-name.base.stderr} (89%) rename src/test/ui/lifetimes/lifetime-errors/{ex2b-push-no-existing-names.stderr => ex2b-push-no-existing-names.base.stderr} (88%) rename src/test/ui/lifetimes/lifetime-errors/{ex2c-push-inference-variable.stderr => ex2c-push-inference-variable.base.stderr} (90%) rename src/test/ui/lifetimes/lifetime-errors/{ex2d-push-inference-variable-2.stderr => ex2d-push-inference-variable-2.base.stderr} (90%) rename src/test/ui/lifetimes/lifetime-errors/{ex2e-push-inference-variable-3.stderr => ex2e-push-inference-variable-3.base.stderr} (90%) rename src/test/ui/lifetimes/lifetime-errors/{ex3-both-anon-regions-2.stderr => ex3-both-anon-regions-2.base.stderr} (93%) rename src/test/ui/lifetimes/lifetime-errors/{ex3-both-anon-regions-3.stderr => ex3-both-anon-regions-3.base.stderr} (93%) rename src/test/ui/lifetimes/lifetime-errors/{ex3-both-anon-regions-both-are-structs-2.stderr => ex3-both-anon-regions-both-are-structs-2.base.stderr} (85%) rename src/test/ui/lifetimes/lifetime-errors/{ex3-both-anon-regions-both-are-structs-3.stderr => ex3-both-anon-regions-both-are-structs-3.base.stderr} (84%) rename src/test/ui/lifetimes/lifetime-errors/{ex3-both-anon-regions-both-are-structs-earlybound-regions.stderr => ex3-both-anon-regions-both-are-structs-earlybound-regions.base.stderr} (97%) rename src/test/ui/lifetimes/lifetime-errors/{ex3-both-anon-regions-both-are-structs-latebound-regions.stderr => ex3-both-anon-regions-both-are-structs-latebound-regions.base.stderr} (97%) rename src/test/ui/lifetimes/lifetime-errors/{ex3-both-anon-regions-both-are-structs.stderr => ex3-both-anon-regions-both-are-structs.base.stderr} (85%) rename src/test/ui/lifetimes/lifetime-errors/{ex3-both-anon-regions-latebound-regions.stderr => ex3-both-anon-regions-latebound-regions.base.stderr} (86%) rename src/test/ui/lifetimes/lifetime-errors/{ex3-both-anon-regions-one-is-struct-2.stderr => ex3-both-anon-regions-one-is-struct-2.base.stderr} (87%) rename src/test/ui/lifetimes/lifetime-errors/{ex3-both-anon-regions-one-is-struct-3.stderr => ex3-both-anon-regions-one-is-struct-3.base.stderr} (85%) rename src/test/ui/lifetimes/lifetime-errors/{ex3-both-anon-regions-one-is-struct-4.stderr => ex3-both-anon-regions-one-is-struct-4.base.stderr} (85%) rename src/test/ui/lifetimes/lifetime-errors/{ex3-both-anon-regions-one-is-struct.stderr => ex3-both-anon-regions-one-is-struct.base.stderr} (86%) rename src/test/ui/lifetimes/lifetime-errors/{ex3-both-anon-regions-return-type-is-anon.stderr => ex3-both-anon-regions-return-type-is-anon.base.stderr} (91%) rename src/test/ui/lifetimes/lifetime-errors/{ex3-both-anon-regions-self-is-anon.stderr => ex3-both-anon-regions-self-is-anon.base.stderr} (93%) rename src/test/ui/lifetimes/lifetime-errors/{ex3-both-anon-regions-using-fn-items.stderr => ex3-both-anon-regions-using-fn-items.base.stderr} (91%) rename src/test/ui/lifetimes/lifetime-errors/{ex3-both-anon-regions-using-impl-items.stderr => ex3-both-anon-regions-using-impl-items.base.stderr} (91%) rename src/test/ui/lifetimes/lifetime-errors/{ex3-both-anon-regions-using-trait-objects.stderr => ex3-both-anon-regions-using-trait-objects.base.stderr} (91%) rename src/test/ui/lifetimes/lifetime-errors/{ex3-both-anon-regions.stderr => ex3-both-anon-regions.base.stderr} (93%) rename src/test/ui/lifetimes/lifetime-errors/{issue_74400.stderr => issue_74400.base.stderr} (92%) rename src/test/ui/lifetimes/{re-empty-in-error.stderr => re-empty-in-error.base.stderr} (84%) diff --git a/src/test/ui/lifetimes/issue-79187-2.stderr b/src/test/ui/lifetimes/issue-79187-2.base.stderr similarity index 83% rename from src/test/ui/lifetimes/issue-79187-2.stderr rename to src/test/ui/lifetimes/issue-79187-2.base.stderr index 2aca8faff9f2c..95591412f7eab 100644 --- a/src/test/ui/lifetimes/issue-79187-2.stderr +++ b/src/test/ui/lifetimes/issue-79187-2.base.stderr @@ -1,5 +1,5 @@ error[E0308]: mismatched types - --> $DIR/issue-79187-2.rs:8:5 + --> $DIR/issue-79187-2.rs:12:5 | LL | take_foo(|a| a); | ^^^^^^^^ lifetime mismatch @@ -7,18 +7,18 @@ LL | take_foo(|a| a); = note: expected type `for<'r> Fn<(&'r i32,)>` found type `Fn<(&i32,)>` note: this closure does not fulfill the lifetime requirements - --> $DIR/issue-79187-2.rs:8:14 + --> $DIR/issue-79187-2.rs:12:14 | LL | take_foo(|a| a); | ^^^^^ note: the lifetime requirement is introduced here - --> $DIR/issue-79187-2.rs:5:21 + --> $DIR/issue-79187-2.rs:9:21 | LL | fn take_foo(_: impl Foo) {} | ^^^ error[E0308]: mismatched types - --> $DIR/issue-79187-2.rs:9:5 + --> $DIR/issue-79187-2.rs:16:5 | LL | take_foo(|a: &i32| a); | ^^^^^^^^ lifetime mismatch @@ -26,18 +26,18 @@ LL | take_foo(|a: &i32| a); = note: expected reference `&i32` found reference `&i32` note: the anonymous lifetime #1 defined here doesn't meet the lifetime requirements - --> $DIR/issue-79187-2.rs:9:14 + --> $DIR/issue-79187-2.rs:16:14 | LL | take_foo(|a: &i32| a); | ^^^^^^^^^^^ note: the lifetime requirement is introduced here - --> $DIR/issue-79187-2.rs:5:21 + --> $DIR/issue-79187-2.rs:9:21 | LL | fn take_foo(_: impl Foo) {} | ^^^ error[E0308]: mismatched types - --> $DIR/issue-79187-2.rs:10:5 + --> $DIR/issue-79187-2.rs:20:5 | LL | take_foo(|a: &i32| -> &i32 { a }); | ^^^^^^^^ lifetime mismatch @@ -45,12 +45,12 @@ LL | take_foo(|a: &i32| -> &i32 { a }); = note: expected reference `&i32` found reference `&i32` note: the anonymous lifetime #1 defined here doesn't meet the lifetime requirements - --> $DIR/issue-79187-2.rs:10:14 + --> $DIR/issue-79187-2.rs:20:14 | LL | take_foo(|a: &i32| -> &i32 { a }); | ^^^^^^^^^^^^^^^^^^^^^^^ note: the lifetime requirement is introduced here - --> $DIR/issue-79187-2.rs:5:21 + --> $DIR/issue-79187-2.rs:9:21 | LL | fn take_foo(_: impl Foo) {} | ^^^ diff --git a/src/test/ui/lifetimes/issue-79187-2.nll.stderr b/src/test/ui/lifetimes/issue-79187-2.nll.stderr index 04d9b64d64fdd..3cbce7600f956 100644 --- a/src/test/ui/lifetimes/issue-79187-2.nll.stderr +++ b/src/test/ui/lifetimes/issue-79187-2.nll.stderr @@ -1,5 +1,5 @@ error: lifetime may not live long enough - --> $DIR/issue-79187-2.rs:9:24 + --> $DIR/issue-79187-2.rs:16:24 | LL | take_foo(|a: &i32| a); | - - ^ returning this value requires that `'1` must outlive `'2` @@ -8,7 +8,7 @@ LL | take_foo(|a: &i32| a); | let's call the lifetime of this reference `'1` error: lifetime may not live long enough - --> $DIR/issue-79187-2.rs:10:34 + --> $DIR/issue-79187-2.rs:20:34 | LL | take_foo(|a: &i32| -> &i32 { a }); | - - ^ returning this value requires that `'1` must outlive `'2` @@ -17,7 +17,7 @@ LL | take_foo(|a: &i32| -> &i32 { a }); | let's call the lifetime of this reference `'1` error: implementation of `FnOnce` is not general enough - --> $DIR/issue-79187-2.rs:8:5 + --> $DIR/issue-79187-2.rs:12:5 | LL | take_foo(|a| a); | ^^^^^^^^^^^^^^^ implementation of `FnOnce` is not general enough @@ -26,7 +26,7 @@ LL | take_foo(|a| a); = note: ...but it actually implements `FnOnce<(&'2 i32,)>`, for some specific lifetime `'2` error[E0308]: mismatched types - --> $DIR/issue-79187-2.rs:8:5 + --> $DIR/issue-79187-2.rs:12:5 | LL | take_foo(|a| a); | ^^^^^^^^^^^^^^^ one type is more general than the other @@ -34,18 +34,18 @@ LL | take_foo(|a| a); = note: expected type `for<'r> Fn<(&'r i32,)>` found type `Fn<(&i32,)>` note: this closure does not fulfill the lifetime requirements - --> $DIR/issue-79187-2.rs:8:14 + --> $DIR/issue-79187-2.rs:12:14 | LL | take_foo(|a| a); | ^^^^^ note: the lifetime requirement is introduced here - --> $DIR/issue-79187-2.rs:5:21 + --> $DIR/issue-79187-2.rs:9:21 | LL | fn take_foo(_: impl Foo) {} | ^^^ error[E0308]: mismatched types - --> $DIR/issue-79187-2.rs:9:5 + --> $DIR/issue-79187-2.rs:16:5 | LL | take_foo(|a: &i32| a); | ^^^^^^^^^^^^^^^^^^^^^ one type is more general than the other @@ -53,13 +53,13 @@ LL | take_foo(|a: &i32| a); = note: expected reference `&i32` found reference `&i32` note: the lifetime requirement is introduced here - --> $DIR/issue-79187-2.rs:5:21 + --> $DIR/issue-79187-2.rs:9:21 | LL | fn take_foo(_: impl Foo) {} | ^^^ error[E0308]: mismatched types - --> $DIR/issue-79187-2.rs:10:5 + --> $DIR/issue-79187-2.rs:20:5 | LL | take_foo(|a: &i32| -> &i32 { a }); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ one type is more general than the other @@ -67,7 +67,7 @@ LL | take_foo(|a: &i32| -> &i32 { a }); = note: expected reference `&i32` found reference `&i32` note: the lifetime requirement is introduced here - --> $DIR/issue-79187-2.rs:5:21 + --> $DIR/issue-79187-2.rs:9:21 | LL | fn take_foo(_: impl Foo) {} | ^^^ diff --git a/src/test/ui/lifetimes/issue-79187-2.rs b/src/test/ui/lifetimes/issue-79187-2.rs index 29d108facab3f..d122b92f74b23 100644 --- a/src/test/ui/lifetimes/issue-79187-2.rs +++ b/src/test/ui/lifetimes/issue-79187-2.rs @@ -1,3 +1,7 @@ +// revisions: base nll +// ignore-compare-mode-nll +//[nll] compile-flags: -Z borrowck=mir + trait Foo {} impl Foo for F where F: Fn(&i32) -> &i32 {} @@ -5,9 +9,18 @@ impl Foo for F where F: Fn(&i32) -> &i32 {} fn take_foo(_: impl Foo) {} fn main() { - take_foo(|a| a); //~ ERROR mismatched types - take_foo(|a: &i32| a); //~ ERROR mismatched types - take_foo(|a: &i32| -> &i32 { a }); //~ ERROR mismatched types + take_foo(|a| a); + //[base]~^ ERROR mismatched types + //[nll]~^^ ERROR implementation of `FnOnce` is not general enough + //[nll]~| ERROR mismatched types + take_foo(|a: &i32| a); + //[base]~^ ERROR mismatched types + //[nll]~^^ ERROR lifetime may not live long enough + //[nll]~| ERROR mismatched types + take_foo(|a: &i32| -> &i32 { a }); + //[base]~^ ERROR mismatched types + //[nll]~^^ ERROR lifetime may not live long enough + //[nll]~| ERROR mismatched types // OK take_foo(identity(|a| a)); diff --git a/src/test/ui/lifetimes/issue-79187.stderr b/src/test/ui/lifetimes/issue-79187.base.stderr similarity index 92% rename from src/test/ui/lifetimes/issue-79187.stderr rename to src/test/ui/lifetimes/issue-79187.base.stderr index 3c0439fb660e5..c4654ca1517ed 100644 --- a/src/test/ui/lifetimes/issue-79187.stderr +++ b/src/test/ui/lifetimes/issue-79187.base.stderr @@ -1,5 +1,5 @@ error: implementation of `FnOnce` is not general enough - --> $DIR/issue-79187.rs:5:5 + --> $DIR/issue-79187.rs:9:5 | LL | thing(f); | ^^^^^ implementation of `FnOnce` is not general enough diff --git a/src/test/ui/lifetimes/issue-79187.nll.stderr b/src/test/ui/lifetimes/issue-79187.nll.stderr index 3a993e88d8a92..54dce9b4bacf0 100644 --- a/src/test/ui/lifetimes/issue-79187.nll.stderr +++ b/src/test/ui/lifetimes/issue-79187.nll.stderr @@ -1,5 +1,5 @@ error[E0308]: mismatched types - --> $DIR/issue-79187.rs:5:5 + --> $DIR/issue-79187.rs:9:5 | LL | thing(f); | ^^^^^^^^ one type is more general than the other @@ -7,18 +7,18 @@ LL | thing(f); = note: expected type `for<'r> FnOnce<(&'r u32,)>` found type `FnOnce<(&u32,)>` note: this closure does not fulfill the lifetime requirements - --> $DIR/issue-79187.rs:4:13 + --> $DIR/issue-79187.rs:8:13 | LL | let f = |_| (); | ^^^^^^ note: the lifetime requirement is introduced here - --> $DIR/issue-79187.rs:1:18 + --> $DIR/issue-79187.rs:5:18 | LL | fn thing(x: impl FnOnce(&u32)) {} | ^^^^^^^^^^^^ error: implementation of `FnOnce` is not general enough - --> $DIR/issue-79187.rs:5:5 + --> $DIR/issue-79187.rs:9:5 | LL | thing(f); | ^^^^^^^^ implementation of `FnOnce` is not general enough diff --git a/src/test/ui/lifetimes/issue-79187.rs b/src/test/ui/lifetimes/issue-79187.rs index 2ee69ee2234ee..b97890d94e97a 100644 --- a/src/test/ui/lifetimes/issue-79187.rs +++ b/src/test/ui/lifetimes/issue-79187.rs @@ -1,6 +1,12 @@ +// revisions: base nll +// ignore-compare-mode-nll +//[nll] compile-flags: -Z borrowck=mir + fn thing(x: impl FnOnce(&u32)) {} fn main() { let f = |_| (); - thing(f); //~ERROR implementation of `FnOnce` is not general enough + thing(f); + //[nll]~^ ERROR mismatched types + //~^^ ERROR implementation of `FnOnce` is not general enough } diff --git a/src/test/ui/lifetimes/issue-90170-elision-mismatch-nll.fixed b/src/test/ui/lifetimes/issue-90170-elision-mismatch-nll.fixed new file mode 100644 index 0000000000000..4b417afb03836 --- /dev/null +++ b/src/test/ui/lifetimes/issue-90170-elision-mismatch-nll.fixed @@ -0,0 +1,15 @@ +// FIXME(nll): On NLL stabilization, this should be replace +// `issue-90170-elision-mismatch.rs`. Compiletest has +// problems with rustfix and revisions. +// ignore-compare-mode-nll +// compile-flags: -Zborrowck=mir + +// run-rustfix + +pub fn foo<'a>(x: &mut Vec<&'a u8>, y: &'a u8) { x.push(y); } //~ ERROR lifetime may not live long enough + +pub fn foo2<'a>(x: &mut Vec<&'a u8>, y: &'a u8) { x.push(y); } //~ ERROR lifetime may not live long enough + +pub fn foo3<'a>(_other: &'a [u8], x: &mut Vec<&'a u8>, y: &'a u8) { x.push(y); } //~ ERROR lifetime may not live long enough + +fn main() {} diff --git a/src/test/ui/lifetimes/issue-90170-elision-mismatch-nll.rs b/src/test/ui/lifetimes/issue-90170-elision-mismatch-nll.rs new file mode 100644 index 0000000000000..ec50e8e1d9ac5 --- /dev/null +++ b/src/test/ui/lifetimes/issue-90170-elision-mismatch-nll.rs @@ -0,0 +1,15 @@ +// FIXME(nll): On NLL stabilization, this should be replace +// `issue-90170-elision-mismatch.rs`. Compiletest has +// problems with rustfix and revisions. +// ignore-compare-mode-nll +// compile-flags: -Zborrowck=mir + +// run-rustfix + +pub fn foo(x: &mut Vec<&u8>, y: &u8) { x.push(y); } //~ ERROR lifetime may not live long enough + +pub fn foo2(x: &mut Vec<&'_ u8>, y: &u8) { x.push(y); } //~ ERROR lifetime may not live long enough + +pub fn foo3<'a>(_other: &'a [u8], x: &mut Vec<&u8>, y: &u8) { x.push(y); } //~ ERROR lifetime may not live long enough + +fn main() {} diff --git a/src/test/ui/lifetimes/issue-90170-elision-mismatch.nll.stderr b/src/test/ui/lifetimes/issue-90170-elision-mismatch-nll.stderr similarity index 92% rename from src/test/ui/lifetimes/issue-90170-elision-mismatch.nll.stderr rename to src/test/ui/lifetimes/issue-90170-elision-mismatch-nll.stderr index 48fb3fb4a2293..144fe3bf9dabf 100644 --- a/src/test/ui/lifetimes/issue-90170-elision-mismatch.nll.stderr +++ b/src/test/ui/lifetimes/issue-90170-elision-mismatch-nll.stderr @@ -1,5 +1,5 @@ error: lifetime may not live long enough - --> $DIR/issue-90170-elision-mismatch.rs:3:40 + --> $DIR/issue-90170-elision-mismatch-nll.rs:9:40 | LL | pub fn foo(x: &mut Vec<&u8>, y: &u8) { x.push(y); } | - - ^^^^^^^^^ argument requires that `'1` must outlive `'2` @@ -13,7 +13,7 @@ LL | pub fn foo<'a>(x: &mut Vec<&'a u8>, y: &'a u8) { x.push(y); } | ++++ ++ ++ error: lifetime may not live long enough - --> $DIR/issue-90170-elision-mismatch.rs:5:44 + --> $DIR/issue-90170-elision-mismatch-nll.rs:11:44 | LL | pub fn foo2(x: &mut Vec<&'_ u8>, y: &u8) { x.push(y); } | - - ^^^^^^^^^ argument requires that `'1` must outlive `'2` @@ -27,7 +27,7 @@ LL | pub fn foo2<'a>(x: &mut Vec<&'a u8>, y: &'a u8) { x.push(y); } | ++++ ~~ ++ error: lifetime may not live long enough - --> $DIR/issue-90170-elision-mismatch.rs:7:63 + --> $DIR/issue-90170-elision-mismatch-nll.rs:13:63 | LL | pub fn foo3<'a>(_other: &'a [u8], x: &mut Vec<&u8>, y: &u8) { x.push(y); } | - - ^^^^^^^^^ argument requires that `'1` must outlive `'2` diff --git a/src/test/ui/lifetimes/issue-90170-elision-mismatch.fixed b/src/test/ui/lifetimes/issue-90170-elision-mismatch.fixed index 0bc889ee721dc..f05943284f7c8 100644 --- a/src/test/ui/lifetimes/issue-90170-elision-mismatch.fixed +++ b/src/test/ui/lifetimes/issue-90170-elision-mismatch.fixed @@ -1,3 +1,8 @@ +// FIXME(nll): On NLL stabilization, this should be replaced by +// `issue-90170-elision-mismatch-nll.rs`. Compiletest has +// problems with rustfix and revisions. +// ignore-compare-mode-nll + // run-rustfix pub fn foo<'a>(x: &mut Vec<&'a u8>, y: &'a u8) { x.push(y); } //~ ERROR lifetime mismatch diff --git a/src/test/ui/lifetimes/issue-90170-elision-mismatch.rs b/src/test/ui/lifetimes/issue-90170-elision-mismatch.rs index 1d6573c00ad4f..fee2b461ef9aa 100644 --- a/src/test/ui/lifetimes/issue-90170-elision-mismatch.rs +++ b/src/test/ui/lifetimes/issue-90170-elision-mismatch.rs @@ -1,3 +1,8 @@ +// FIXME(nll): On NLL stabilization, this should be replaced by +// `issue-90170-elision-mismatch-nll.rs`. Compiletest has +// problems with rustfix and revisions. +// ignore-compare-mode-nll + // run-rustfix pub fn foo(x: &mut Vec<&u8>, y: &u8) { x.push(y); } //~ ERROR lifetime mismatch diff --git a/src/test/ui/lifetimes/issue-90170-elision-mismatch.stderr b/src/test/ui/lifetimes/issue-90170-elision-mismatch.stderr index 7fa092ca220c2..28f3957041c1e 100644 --- a/src/test/ui/lifetimes/issue-90170-elision-mismatch.stderr +++ b/src/test/ui/lifetimes/issue-90170-elision-mismatch.stderr @@ -1,5 +1,5 @@ error[E0623]: lifetime mismatch - --> $DIR/issue-90170-elision-mismatch.rs:3:47 + --> $DIR/issue-90170-elision-mismatch.rs:8:47 | LL | pub fn foo(x: &mut Vec<&u8>, y: &u8) { x.push(y); } | --- --- ^ ...but data from `y` flows into `x` here @@ -13,7 +13,7 @@ LL | pub fn foo<'a>(x: &mut Vec<&'a u8>, y: &'a u8) { x.push(y); } | ++++ ++ ++ error[E0623]: lifetime mismatch - --> $DIR/issue-90170-elision-mismatch.rs:5:51 + --> $DIR/issue-90170-elision-mismatch.rs:10:51 | LL | pub fn foo2(x: &mut Vec<&'_ u8>, y: &u8) { x.push(y); } | ------ --- ^ ...but data from `y` flows into `x` here @@ -27,7 +27,7 @@ LL | pub fn foo2<'a>(x: &mut Vec<&'a u8>, y: &'a u8) { x.push(y); } | ++++ ~~ ++ error[E0623]: lifetime mismatch - --> $DIR/issue-90170-elision-mismatch.rs:7:70 + --> $DIR/issue-90170-elision-mismatch.rs:12:70 | LL | pub fn foo3<'a>(_other: &'a [u8], x: &mut Vec<&u8>, y: &u8) { x.push(y); } | --- --- ^ ...but data from `y` flows into `x` here diff --git a/src/test/ui/lifetimes/issue-90600-expected-return-static-indirect.stderr b/src/test/ui/lifetimes/issue-90600-expected-return-static-indirect.base.stderr similarity index 89% rename from src/test/ui/lifetimes/issue-90600-expected-return-static-indirect.stderr rename to src/test/ui/lifetimes/issue-90600-expected-return-static-indirect.base.stderr index e06255e4ea3ff..b20ce7b07ff32 100644 --- a/src/test/ui/lifetimes/issue-90600-expected-return-static-indirect.stderr +++ b/src/test/ui/lifetimes/issue-90600-expected-return-static-indirect.base.stderr @@ -1,5 +1,5 @@ error[E0759]: `foo` has an anonymous lifetime `'_` but it needs to satisfy a `'static` lifetime requirement - --> $DIR/issue-90600-expected-return-static-indirect.rs:7:32 + --> $DIR/issue-90600-expected-return-static-indirect.rs:11:32 | LL | fn inner(mut foo: &[u8]) { | ----- this data with an anonymous lifetime `'_`... diff --git a/src/test/ui/lifetimes/issue-90600-expected-return-static-indirect.nll.stderr b/src/test/ui/lifetimes/issue-90600-expected-return-static-indirect.nll.stderr index 99e1e7217b45c..b35505ac8c54f 100644 --- a/src/test/ui/lifetimes/issue-90600-expected-return-static-indirect.nll.stderr +++ b/src/test/ui/lifetimes/issue-90600-expected-return-static-indirect.nll.stderr @@ -1,9 +1,9 @@ error[E0597]: `foo` does not live long enough - --> $DIR/issue-90600-expected-return-static-indirect.rs:7:32 + --> $DIR/issue-90600-expected-return-static-indirect.rs:11:32 | LL | let refcell = RefCell::new(&mut foo); | ^^^^^^^^ borrowed value does not live long enough -LL | +... LL | let read = &refcell as &RefCell; | -------- cast requires that `foo` is borrowed for `'static` ... @@ -11,7 +11,7 @@ LL | } | - `foo` dropped here while still borrowed error: lifetime may not live long enough - --> $DIR/issue-90600-expected-return-static-indirect.rs:9:16 + --> $DIR/issue-90600-expected-return-static-indirect.rs:14:16 | LL | fn inner(mut foo: &[u8]) { | - let's call the lifetime of this reference `'1` diff --git a/src/test/ui/lifetimes/issue-90600-expected-return-static-indirect.rs b/src/test/ui/lifetimes/issue-90600-expected-return-static-indirect.rs index 39996bbf43b3c..fa44be9a912ad 100644 --- a/src/test/ui/lifetimes/issue-90600-expected-return-static-indirect.rs +++ b/src/test/ui/lifetimes/issue-90600-expected-return-static-indirect.rs @@ -1,3 +1,7 @@ +// revisions: base nll +// ignore-compare-mode-nll +//[nll] compile-flags: -Z borrowck=mir + use std::cell::RefCell; use std::io::Read; @@ -5,8 +9,10 @@ fn main() {} fn inner(mut foo: &[u8]) { let refcell = RefCell::new(&mut foo); - //~^ ERROR `foo` has an anonymous lifetime `'_` but it needs to satisfy a `'static` lifetime requirement [E0759] + //[base]~^ ERROR `foo` has an anonymous lifetime `'_` but it needs to satisfy a `'static` lifetime requirement [E0759] + //[nll]~^^ ERROR `foo` does not live long enough let read = &refcell as &RefCell; + //[nll]~^ ERROR lifetime may not live long enough read_thing(read); } diff --git a/src/test/ui/lifetimes/lifetime-bound-will-change-warning.stderr b/src/test/ui/lifetimes/lifetime-bound-will-change-warning.base.stderr similarity index 80% rename from src/test/ui/lifetimes/lifetime-bound-will-change-warning.stderr rename to src/test/ui/lifetimes/lifetime-bound-will-change-warning.base.stderr index bb691fc072b5a..54fa49b47f680 100644 --- a/src/test/ui/lifetimes/lifetime-bound-will-change-warning.stderr +++ b/src/test/ui/lifetimes/lifetime-bound-will-change-warning.base.stderr @@ -1,5 +1,5 @@ error[E0308]: mismatched types - --> $DIR/lifetime-bound-will-change-warning.rs:34:13 + --> $DIR/lifetime-bound-will-change-warning.rs:38:13 | LL | ref_obj(x) | ^ lifetime mismatch @@ -7,14 +7,14 @@ LL | ref_obj(x) = note: expected reference `&Box<(dyn Fn() + 'static)>` found reference `&Box<(dyn Fn() + 'a)>` note: the lifetime `'a` as defined here... - --> $DIR/lifetime-bound-will-change-warning.rs:32:10 + --> $DIR/lifetime-bound-will-change-warning.rs:36:10 | LL | fn test2<'a>(x: &'a Box) { | ^^ = note: ...does not necessarily outlive the static lifetime error[E0308]: mismatched types - --> $DIR/lifetime-bound-will-change-warning.rs:39:18 + --> $DIR/lifetime-bound-will-change-warning.rs:45:18 | LL | lib::ref_obj(x) | ^ lifetime mismatch @@ -22,7 +22,7 @@ LL | lib::ref_obj(x) = note: expected reference `&Box<(dyn Fn() + 'static)>` found reference `&Box<(dyn Fn() + 'a)>` note: the lifetime `'a` as defined here... - --> $DIR/lifetime-bound-will-change-warning.rs:37:12 + --> $DIR/lifetime-bound-will-change-warning.rs:43:12 | LL | fn test2cc<'a>(x: &'a Box) { | ^^ diff --git a/src/test/ui/lifetimes/lifetime-bound-will-change-warning.nll.stderr b/src/test/ui/lifetimes/lifetime-bound-will-change-warning.nll.stderr index 6f3f84096e400..10105c5ccecbb 100644 --- a/src/test/ui/lifetimes/lifetime-bound-will-change-warning.nll.stderr +++ b/src/test/ui/lifetimes/lifetime-bound-will-change-warning.nll.stderr @@ -1,5 +1,5 @@ error[E0521]: borrowed data escapes outside of function - --> $DIR/lifetime-bound-will-change-warning.rs:34:5 + --> $DIR/lifetime-bound-will-change-warning.rs:38:5 | LL | fn test2<'a>(x: &'a Box) { | -- - `x` is a reference that is only valid in the function body @@ -13,7 +13,7 @@ LL | ref_obj(x) | argument requires that `'a` must outlive `'static` error[E0521]: borrowed data escapes outside of function - --> $DIR/lifetime-bound-will-change-warning.rs:39:5 + --> $DIR/lifetime-bound-will-change-warning.rs:45:5 | LL | fn test2cc<'a>(x: &'a Box) { | -- - `x` is a reference that is only valid in the function body diff --git a/src/test/ui/lifetimes/lifetime-bound-will-change-warning.rs b/src/test/ui/lifetimes/lifetime-bound-will-change-warning.rs index 3c6d92234c4fa..0a082e1bae8bf 100644 --- a/src/test/ui/lifetimes/lifetime-bound-will-change-warning.rs +++ b/src/test/ui/lifetimes/lifetime-bound-will-change-warning.rs @@ -1,3 +1,7 @@ +// revisions: base nll +// ignore-compare-mode-nll +//[nll] compile-flags: -Z borrowck=mir + // aux-build:lifetime_bound_will_change_warning_lib.rs // Test that various corner cases cause an error. These are tests @@ -31,12 +35,16 @@ fn test1cc<'a>(x: &'a Box) { fn test2<'a>(x: &'a Box) { // but ref_obj will not, so warn. - ref_obj(x) //~ ERROR mismatched types + ref_obj(x) + //[base]~^ ERROR mismatched types + //[nll]~^^ ERROR borrowed data escapes } fn test2cc<'a>(x: &'a Box) { // same as test2, but cross crate - lib::ref_obj(x) //~ ERROR mismatched types + lib::ref_obj(x) + //[base]~^ ERROR mismatched types + //[nll]~^^ ERROR borrowed data escapes } fn test3<'a>(x: &'a Box) { diff --git a/src/test/ui/lifetimes/lifetime-errors/ex1-return-one-existing-name-if-else-using-impl.stderr b/src/test/ui/lifetimes/lifetime-errors/ex1-return-one-existing-name-if-else-using-impl.base.stderr similarity index 88% rename from src/test/ui/lifetimes/lifetime-errors/ex1-return-one-existing-name-if-else-using-impl.stderr rename to src/test/ui/lifetimes/lifetime-errors/ex1-return-one-existing-name-if-else-using-impl.base.stderr index e9f5fc311dfc2..60cd34938750a 100644 --- a/src/test/ui/lifetimes/lifetime-errors/ex1-return-one-existing-name-if-else-using-impl.stderr +++ b/src/test/ui/lifetimes/lifetime-errors/ex1-return-one-existing-name-if-else-using-impl.base.stderr @@ -1,5 +1,5 @@ error[E0623]: lifetime mismatch - --> $DIR/ex1-return-one-existing-name-if-else-using-impl.rs:11:20 + --> $DIR/ex1-return-one-existing-name-if-else-using-impl.rs:15:20 | LL | fn foo<'a>(x: &i32, y: &'a i32) -> &'a i32 { | ---- ------- diff --git a/src/test/ui/lifetimes/lifetime-errors/ex1-return-one-existing-name-if-else-using-impl.nll.stderr b/src/test/ui/lifetimes/lifetime-errors/ex1-return-one-existing-name-if-else-using-impl.nll.stderr index 4c78821157670..f8e275e9b14c8 100644 --- a/src/test/ui/lifetimes/lifetime-errors/ex1-return-one-existing-name-if-else-using-impl.nll.stderr +++ b/src/test/ui/lifetimes/lifetime-errors/ex1-return-one-existing-name-if-else-using-impl.nll.stderr @@ -1,5 +1,5 @@ error: lifetime may not live long enough - --> $DIR/ex1-return-one-existing-name-if-else-using-impl.rs:11:20 + --> $DIR/ex1-return-one-existing-name-if-else-using-impl.rs:15:20 | LL | fn foo<'a>(x: &i32, y: &'a i32) -> &'a i32 { | -- - let's call the lifetime of this reference `'1` diff --git a/src/test/ui/lifetimes/lifetime-errors/ex1-return-one-existing-name-if-else-using-impl.rs b/src/test/ui/lifetimes/lifetime-errors/ex1-return-one-existing-name-if-else-using-impl.rs index 12024bd10800b..fbb523daa1f51 100644 --- a/src/test/ui/lifetimes/lifetime-errors/ex1-return-one-existing-name-if-else-using-impl.rs +++ b/src/test/ui/lifetimes/lifetime-errors/ex1-return-one-existing-name-if-else-using-impl.rs @@ -1,3 +1,7 @@ +// revisions: base nll +// ignore-compare-mode-nll +//[nll] compile-flags: -Z borrowck=mir + trait Foo { fn foo<'a>(x: &i32, y: &'a i32) -> &'a i32; @@ -8,7 +12,9 @@ impl Foo for () { fn foo<'a>(x: &i32, y: &'a i32) -> &'a i32 { - if x > y { x } else { y } //~ ERROR lifetime mismatch + if x > y { x } else { y } + //[base]~^ ERROR lifetime mismatch + //[nll]~^^ ERROR lifetime may not live long enough } diff --git a/src/test/ui/lifetimes/lifetime-errors/ex1-return-one-existing-name-return-type-is-anon.stderr b/src/test/ui/lifetimes/lifetime-errors/ex1-return-one-existing-name-return-type-is-anon.base.stderr similarity index 86% rename from src/test/ui/lifetimes/lifetime-errors/ex1-return-one-existing-name-return-type-is-anon.stderr rename to src/test/ui/lifetimes/lifetime-errors/ex1-return-one-existing-name-return-type-is-anon.base.stderr index 0d506f2b9fcb4..697950a00fb24 100644 --- a/src/test/ui/lifetimes/lifetime-errors/ex1-return-one-existing-name-return-type-is-anon.stderr +++ b/src/test/ui/lifetimes/lifetime-errors/ex1-return-one-existing-name-return-type-is-anon.base.stderr @@ -1,5 +1,5 @@ error[E0623]: lifetime mismatch - --> $DIR/ex1-return-one-existing-name-return-type-is-anon.rs:8:5 + --> $DIR/ex1-return-one-existing-name-return-type-is-anon.rs:12:5 | LL | fn foo<'a>(&self, x: &'a i32) -> &i32 { | ------- ---- diff --git a/src/test/ui/lifetimes/lifetime-errors/ex1-return-one-existing-name-return-type-is-anon.nll.stderr b/src/test/ui/lifetimes/lifetime-errors/ex1-return-one-existing-name-return-type-is-anon.nll.stderr index 11e7fa96d7ee9..97af4b58cbf65 100644 --- a/src/test/ui/lifetimes/lifetime-errors/ex1-return-one-existing-name-return-type-is-anon.nll.stderr +++ b/src/test/ui/lifetimes/lifetime-errors/ex1-return-one-existing-name-return-type-is-anon.nll.stderr @@ -1,5 +1,5 @@ error: lifetime may not live long enough - --> $DIR/ex1-return-one-existing-name-return-type-is-anon.rs:8:5 + --> $DIR/ex1-return-one-existing-name-return-type-is-anon.rs:12:5 | LL | fn foo<'a>(&self, x: &'a i32) -> &i32 { | -- - let's call the lifetime of this reference `'1` diff --git a/src/test/ui/lifetimes/lifetime-errors/ex1-return-one-existing-name-return-type-is-anon.rs b/src/test/ui/lifetimes/lifetime-errors/ex1-return-one-existing-name-return-type-is-anon.rs index ef5dd1160fb34..704db7dc8b405 100644 --- a/src/test/ui/lifetimes/lifetime-errors/ex1-return-one-existing-name-return-type-is-anon.rs +++ b/src/test/ui/lifetimes/lifetime-errors/ex1-return-one-existing-name-return-type-is-anon.rs @@ -1,3 +1,7 @@ +// revisions: base nll +// ignore-compare-mode-nll +//[nll] compile-flags: -Z borrowck=mir + struct Foo { field: i32 } @@ -5,7 +9,9 @@ struct Foo { impl Foo { fn foo<'a>(&self, x: &'a i32) -> &i32 { - x //~ ERROR lifetime mismatch + x + //[base]~^ ERROR lifetime mismatch + //[nll]~^^ ERROR lifetime may not live long enough } diff --git a/src/test/ui/lifetimes/lifetime-errors/ex1-return-one-existing-name-self-is-anon.stderr b/src/test/ui/lifetimes/lifetime-errors/ex1-return-one-existing-name-self-is-anon.base.stderr similarity index 88% rename from src/test/ui/lifetimes/lifetime-errors/ex1-return-one-existing-name-self-is-anon.stderr rename to src/test/ui/lifetimes/lifetime-errors/ex1-return-one-existing-name-self-is-anon.base.stderr index 98a23613c3635..65644d03cdc1b 100644 --- a/src/test/ui/lifetimes/lifetime-errors/ex1-return-one-existing-name-self-is-anon.stderr +++ b/src/test/ui/lifetimes/lifetime-errors/ex1-return-one-existing-name-self-is-anon.base.stderr @@ -1,5 +1,5 @@ error[E0623]: lifetime mismatch - --> $DIR/ex1-return-one-existing-name-self-is-anon.rs:8:30 + --> $DIR/ex1-return-one-existing-name-self-is-anon.rs:12:30 | LL | fn foo<'a>(&self, x: &'a Foo) -> &'a Foo { | ----- ------- diff --git a/src/test/ui/lifetimes/lifetime-errors/ex1-return-one-existing-name-self-is-anon.nll.stderr b/src/test/ui/lifetimes/lifetime-errors/ex1-return-one-existing-name-self-is-anon.nll.stderr index c41f08e691ac2..00a348de4bc30 100644 --- a/src/test/ui/lifetimes/lifetime-errors/ex1-return-one-existing-name-self-is-anon.nll.stderr +++ b/src/test/ui/lifetimes/lifetime-errors/ex1-return-one-existing-name-self-is-anon.nll.stderr @@ -1,5 +1,5 @@ error: lifetime may not live long enough - --> $DIR/ex1-return-one-existing-name-self-is-anon.rs:8:30 + --> $DIR/ex1-return-one-existing-name-self-is-anon.rs:12:30 | LL | fn foo<'a>(&self, x: &'a Foo) -> &'a Foo { | -- - let's call the lifetime of this reference `'1` diff --git a/src/test/ui/lifetimes/lifetime-errors/ex1-return-one-existing-name-self-is-anon.rs b/src/test/ui/lifetimes/lifetime-errors/ex1-return-one-existing-name-self-is-anon.rs index 597d20dbacd43..a846c115c0638 100644 --- a/src/test/ui/lifetimes/lifetime-errors/ex1-return-one-existing-name-self-is-anon.rs +++ b/src/test/ui/lifetimes/lifetime-errors/ex1-return-one-existing-name-self-is-anon.rs @@ -1,3 +1,7 @@ +// revisions: base nll +// ignore-compare-mode-nll +//[nll] compile-flags: -Z borrowck=mir + struct Foo { field: i32, } @@ -5,7 +9,9 @@ struct Foo { impl Foo { fn foo<'a>(&self, x: &'a Foo) -> &'a Foo { - if true { x } else { self } //~ ERROR lifetime mismatch + if true { x } else { self } + //[base]~^ ERROR lifetime mismatch + //[nll]~^^ ERROR lifetime may not live long enough } } diff --git a/src/test/ui/lifetimes/lifetime-errors/ex2a-push-one-existing-name-2.stderr b/src/test/ui/lifetimes/lifetime-errors/ex2a-push-one-existing-name-2.base.stderr similarity index 88% rename from src/test/ui/lifetimes/lifetime-errors/ex2a-push-one-existing-name-2.stderr rename to src/test/ui/lifetimes/lifetime-errors/ex2a-push-one-existing-name-2.base.stderr index 412cac4356368..9203d6603bd7a 100644 --- a/src/test/ui/lifetimes/lifetime-errors/ex2a-push-one-existing-name-2.stderr +++ b/src/test/ui/lifetimes/lifetime-errors/ex2a-push-one-existing-name-2.base.stderr @@ -1,5 +1,5 @@ error[E0621]: explicit lifetime required in the type of `x` - --> $DIR/ex2a-push-one-existing-name-2.rs:6:12 + --> $DIR/ex2a-push-one-existing-name-2.rs:10:12 | LL | fn foo<'a>(x: Ref, y: &mut Vec>) { | -------- help: add explicit lifetime `'a` to the type of `x`: `Ref<'a, i32>` diff --git a/src/test/ui/lifetimes/lifetime-errors/ex2a-push-one-existing-name-2.nll.stderr b/src/test/ui/lifetimes/lifetime-errors/ex2a-push-one-existing-name-2.nll.stderr index 90d4754ebab82..5ab8b449816cc 100644 --- a/src/test/ui/lifetimes/lifetime-errors/ex2a-push-one-existing-name-2.nll.stderr +++ b/src/test/ui/lifetimes/lifetime-errors/ex2a-push-one-existing-name-2.nll.stderr @@ -1,5 +1,5 @@ error[E0621]: explicit lifetime required in the type of `x` - --> $DIR/ex2a-push-one-existing-name-2.rs:6:5 + --> $DIR/ex2a-push-one-existing-name-2.rs:10:5 | LL | fn foo<'a>(x: Ref, y: &mut Vec>) { | -------- help: add explicit lifetime `'a` to the type of `x`: `Ref<'a, i32>` diff --git a/src/test/ui/lifetimes/lifetime-errors/ex2a-push-one-existing-name-2.rs b/src/test/ui/lifetimes/lifetime-errors/ex2a-push-one-existing-name-2.rs index 998a48ce20c26..7e776baa6a91d 100644 --- a/src/test/ui/lifetimes/lifetime-errors/ex2a-push-one-existing-name-2.rs +++ b/src/test/ui/lifetimes/lifetime-errors/ex2a-push-one-existing-name-2.rs @@ -1,3 +1,7 @@ +// revisions: base nll +// ignore-compare-mode-nll +//[nll] compile-flags: -Z borrowck=mir + struct Ref<'a, T: 'a> { data: &'a T } diff --git a/src/test/ui/lifetimes/lifetime-errors/ex2a-push-one-existing-name-early-bound.stderr b/src/test/ui/lifetimes/lifetime-errors/ex2a-push-one-existing-name-early-bound.base.stderr similarity index 86% rename from src/test/ui/lifetimes/lifetime-errors/ex2a-push-one-existing-name-early-bound.stderr rename to src/test/ui/lifetimes/lifetime-errors/ex2a-push-one-existing-name-early-bound.base.stderr index 30826c3613c58..ec1ab19d5a43c 100644 --- a/src/test/ui/lifetimes/lifetime-errors/ex2a-push-one-existing-name-early-bound.stderr +++ b/src/test/ui/lifetimes/lifetime-errors/ex2a-push-one-existing-name-early-bound.base.stderr @@ -1,5 +1,5 @@ error[E0621]: explicit lifetime required in the type of `y` - --> $DIR/ex2a-push-one-existing-name-early-bound.rs:8:12 + --> $DIR/ex2a-push-one-existing-name-early-bound.rs:12:12 | LL | fn baz<'a, 'b, T>(x: &mut Vec<&'a T>, y: &T) | -- help: add explicit lifetime `'a` to the type of `y`: `&'a T` diff --git a/src/test/ui/lifetimes/lifetime-errors/ex2a-push-one-existing-name-early-bound.nll.stderr b/src/test/ui/lifetimes/lifetime-errors/ex2a-push-one-existing-name-early-bound.nll.stderr index a03e16b3b7919..bd5864bae3202 100644 --- a/src/test/ui/lifetimes/lifetime-errors/ex2a-push-one-existing-name-early-bound.nll.stderr +++ b/src/test/ui/lifetimes/lifetime-errors/ex2a-push-one-existing-name-early-bound.nll.stderr @@ -1,5 +1,5 @@ error[E0621]: explicit lifetime required in the type of `y` - --> $DIR/ex2a-push-one-existing-name-early-bound.rs:8:5 + --> $DIR/ex2a-push-one-existing-name-early-bound.rs:12:5 | LL | fn baz<'a, 'b, T>(x: &mut Vec<&'a T>, y: &T) | -- help: add explicit lifetime `'a` to the type of `y`: `&'a T` diff --git a/src/test/ui/lifetimes/lifetime-errors/ex2a-push-one-existing-name-early-bound.rs b/src/test/ui/lifetimes/lifetime-errors/ex2a-push-one-existing-name-early-bound.rs index d18b50d0d0cd7..73613a9bf3507 100644 --- a/src/test/ui/lifetimes/lifetime-errors/ex2a-push-one-existing-name-early-bound.rs +++ b/src/test/ui/lifetimes/lifetime-errors/ex2a-push-one-existing-name-early-bound.rs @@ -1,3 +1,7 @@ +// revisions: base nll +// ignore-compare-mode-nll +//[nll] compile-flags: -Z borrowck=mir + trait Foo<'a> {} impl<'a, T> Foo<'a> for T {} diff --git a/src/test/ui/lifetimes/lifetime-errors/ex2a-push-one-existing-name.stderr b/src/test/ui/lifetimes/lifetime-errors/ex2a-push-one-existing-name.base.stderr similarity index 89% rename from src/test/ui/lifetimes/lifetime-errors/ex2a-push-one-existing-name.stderr rename to src/test/ui/lifetimes/lifetime-errors/ex2a-push-one-existing-name.base.stderr index 13d0835287d04..ab0e202a32eff 100644 --- a/src/test/ui/lifetimes/lifetime-errors/ex2a-push-one-existing-name.stderr +++ b/src/test/ui/lifetimes/lifetime-errors/ex2a-push-one-existing-name.base.stderr @@ -1,5 +1,5 @@ error[E0621]: explicit lifetime required in the type of `y` - --> $DIR/ex2a-push-one-existing-name.rs:6:12 + --> $DIR/ex2a-push-one-existing-name.rs:10:12 | LL | fn foo<'a>(x: &mut Vec>, y: Ref) { | -------- help: add explicit lifetime `'a` to the type of `y`: `Ref<'a, i32>` diff --git a/src/test/ui/lifetimes/lifetime-errors/ex2a-push-one-existing-name.nll.stderr b/src/test/ui/lifetimes/lifetime-errors/ex2a-push-one-existing-name.nll.stderr index 487b34e3d18f4..01b7f45d81b58 100644 --- a/src/test/ui/lifetimes/lifetime-errors/ex2a-push-one-existing-name.nll.stderr +++ b/src/test/ui/lifetimes/lifetime-errors/ex2a-push-one-existing-name.nll.stderr @@ -1,5 +1,5 @@ error[E0621]: explicit lifetime required in the type of `y` - --> $DIR/ex2a-push-one-existing-name.rs:6:5 + --> $DIR/ex2a-push-one-existing-name.rs:10:5 | LL | fn foo<'a>(x: &mut Vec>, y: Ref) { | -------- help: add explicit lifetime `'a` to the type of `y`: `Ref<'a, i32>` diff --git a/src/test/ui/lifetimes/lifetime-errors/ex2a-push-one-existing-name.rs b/src/test/ui/lifetimes/lifetime-errors/ex2a-push-one-existing-name.rs index 5188ea1cc9cb0..5773e13304c15 100644 --- a/src/test/ui/lifetimes/lifetime-errors/ex2a-push-one-existing-name.rs +++ b/src/test/ui/lifetimes/lifetime-errors/ex2a-push-one-existing-name.rs @@ -1,3 +1,7 @@ +// revisions: base nll +// ignore-compare-mode-nll +//[nll] compile-flags: -Z borrowck=mir + struct Ref<'a, T: 'a> { data: &'a T } diff --git a/src/test/ui/lifetimes/lifetime-errors/ex2b-push-no-existing-names.stderr b/src/test/ui/lifetimes/lifetime-errors/ex2b-push-no-existing-names.base.stderr similarity index 88% rename from src/test/ui/lifetimes/lifetime-errors/ex2b-push-no-existing-names.stderr rename to src/test/ui/lifetimes/lifetime-errors/ex2b-push-no-existing-names.base.stderr index e505c9c0dc262..58a2088df5e77 100644 --- a/src/test/ui/lifetimes/lifetime-errors/ex2b-push-no-existing-names.stderr +++ b/src/test/ui/lifetimes/lifetime-errors/ex2b-push-no-existing-names.base.stderr @@ -1,5 +1,5 @@ error[E0623]: lifetime mismatch - --> $DIR/ex2b-push-no-existing-names.rs:6:12 + --> $DIR/ex2b-push-no-existing-names.rs:10:12 | LL | fn foo(x: &mut Vec>, y: Ref) { | -------- -------- these two types are declared with different lifetimes... diff --git a/src/test/ui/lifetimes/lifetime-errors/ex2b-push-no-existing-names.nll.stderr b/src/test/ui/lifetimes/lifetime-errors/ex2b-push-no-existing-names.nll.stderr index 1622ce4229052..afe413bcca5cc 100644 --- a/src/test/ui/lifetimes/lifetime-errors/ex2b-push-no-existing-names.nll.stderr +++ b/src/test/ui/lifetimes/lifetime-errors/ex2b-push-no-existing-names.nll.stderr @@ -1,5 +1,5 @@ error: lifetime may not live long enough - --> $DIR/ex2b-push-no-existing-names.rs:6:5 + --> $DIR/ex2b-push-no-existing-names.rs:10:5 | LL | fn foo(x: &mut Vec>, y: Ref) { | - - has type `Ref<'1, i32>` diff --git a/src/test/ui/lifetimes/lifetime-errors/ex2b-push-no-existing-names.rs b/src/test/ui/lifetimes/lifetime-errors/ex2b-push-no-existing-names.rs index 82e0c9bc26e89..8d830343b08be 100644 --- a/src/test/ui/lifetimes/lifetime-errors/ex2b-push-no-existing-names.rs +++ b/src/test/ui/lifetimes/lifetime-errors/ex2b-push-no-existing-names.rs @@ -1,9 +1,15 @@ +// revisions: base nll +// ignore-compare-mode-nll +//[nll] compile-flags: -Z borrowck=mir + struct Ref<'a, T: 'a> { data: &'a T } fn foo(x: &mut Vec>, y: Ref) { - x.push(y); //~ ERROR lifetime mismatch + x.push(y); + //[base]~^ ERROR lifetime mismatch + //[nll]~^^ ERROR lifetime may not live long enough } fn main() { } diff --git a/src/test/ui/lifetimes/lifetime-errors/ex2c-push-inference-variable.stderr b/src/test/ui/lifetimes/lifetime-errors/ex2c-push-inference-variable.base.stderr similarity index 90% rename from src/test/ui/lifetimes/lifetime-errors/ex2c-push-inference-variable.stderr rename to src/test/ui/lifetimes/lifetime-errors/ex2c-push-inference-variable.base.stderr index 63b1c6db28f14..63033b8d16e8b 100644 --- a/src/test/ui/lifetimes/lifetime-errors/ex2c-push-inference-variable.stderr +++ b/src/test/ui/lifetimes/lifetime-errors/ex2c-push-inference-variable.base.stderr @@ -1,5 +1,5 @@ error[E0623]: lifetime mismatch - --> $DIR/ex2c-push-inference-variable.rs:7:12 + --> $DIR/ex2c-push-inference-variable.rs:11:12 | LL | fn foo<'a, 'b, 'c>(x: &'a mut Vec>, y: Ref<'c, i32>) { | ------------ ------------ these two types are declared with different lifetimes... diff --git a/src/test/ui/lifetimes/lifetime-errors/ex2c-push-inference-variable.nll.stderr b/src/test/ui/lifetimes/lifetime-errors/ex2c-push-inference-variable.nll.stderr index 99fab4631a216..63a0f2409d9b4 100644 --- a/src/test/ui/lifetimes/lifetime-errors/ex2c-push-inference-variable.nll.stderr +++ b/src/test/ui/lifetimes/lifetime-errors/ex2c-push-inference-variable.nll.stderr @@ -1,5 +1,5 @@ error: lifetime may not live long enough - --> $DIR/ex2c-push-inference-variable.rs:7:5 + --> $DIR/ex2c-push-inference-variable.rs:11:5 | LL | fn foo<'a, 'b, 'c>(x: &'a mut Vec>, y: Ref<'c, i32>) { | -- -- lifetime `'c` defined here diff --git a/src/test/ui/lifetimes/lifetime-errors/ex2c-push-inference-variable.rs b/src/test/ui/lifetimes/lifetime-errors/ex2c-push-inference-variable.rs index 7f15aee5f08e4..f676eb403a8aa 100644 --- a/src/test/ui/lifetimes/lifetime-errors/ex2c-push-inference-variable.rs +++ b/src/test/ui/lifetimes/lifetime-errors/ex2c-push-inference-variable.rs @@ -1,10 +1,16 @@ +// revisions: base nll +// ignore-compare-mode-nll +//[nll] compile-flags: -Z borrowck=mir + struct Ref<'a, T: 'a> { data: &'a T } fn foo<'a, 'b, 'c>(x: &'a mut Vec>, y: Ref<'c, i32>) { let z = Ref { data: y.data }; - x.push(z); //~ ERROR lifetime mismatch + x.push(z); + //[base]~^ ERROR lifetime mismatch + //[nll]~^^ ERROR lifetime may not live long enough } fn main() { } diff --git a/src/test/ui/lifetimes/lifetime-errors/ex2d-push-inference-variable-2.stderr b/src/test/ui/lifetimes/lifetime-errors/ex2d-push-inference-variable-2.base.stderr similarity index 90% rename from src/test/ui/lifetimes/lifetime-errors/ex2d-push-inference-variable-2.stderr rename to src/test/ui/lifetimes/lifetime-errors/ex2d-push-inference-variable-2.base.stderr index 2f669efcf1eb4..a50985ca704c7 100644 --- a/src/test/ui/lifetimes/lifetime-errors/ex2d-push-inference-variable-2.stderr +++ b/src/test/ui/lifetimes/lifetime-errors/ex2d-push-inference-variable-2.base.stderr @@ -1,5 +1,5 @@ error[E0623]: lifetime mismatch - --> $DIR/ex2d-push-inference-variable-2.rs:6:33 + --> $DIR/ex2d-push-inference-variable-2.rs:10:33 | LL | fn foo<'a, 'b, 'c>(x: &'a mut Vec>, y: Ref<'c, i32>) { | ------------ ------------ these two types are declared with different lifetimes... diff --git a/src/test/ui/lifetimes/lifetime-errors/ex2d-push-inference-variable-2.nll.stderr b/src/test/ui/lifetimes/lifetime-errors/ex2d-push-inference-variable-2.nll.stderr index 52c5752f6ea1e..0d7461fa68262 100644 --- a/src/test/ui/lifetimes/lifetime-errors/ex2d-push-inference-variable-2.nll.stderr +++ b/src/test/ui/lifetimes/lifetime-errors/ex2d-push-inference-variable-2.nll.stderr @@ -1,5 +1,5 @@ error: lifetime may not live long enough - --> $DIR/ex2d-push-inference-variable-2.rs:8:5 + --> $DIR/ex2d-push-inference-variable-2.rs:13:5 | LL | fn foo<'a, 'b, 'c>(x: &'a mut Vec>, y: Ref<'c, i32>) { | -- -- lifetime `'c` defined here diff --git a/src/test/ui/lifetimes/lifetime-errors/ex2d-push-inference-variable-2.rs b/src/test/ui/lifetimes/lifetime-errors/ex2d-push-inference-variable-2.rs index ee77d9e7fde1a..e65638fb0df13 100644 --- a/src/test/ui/lifetimes/lifetime-errors/ex2d-push-inference-variable-2.rs +++ b/src/test/ui/lifetimes/lifetime-errors/ex2d-push-inference-variable-2.rs @@ -1,11 +1,17 @@ +// revisions: base nll +// ignore-compare-mode-nll +//[nll] compile-flags: -Z borrowck=mir + struct Ref<'a, T: 'a> { data: &'a T } fn foo<'a, 'b, 'c>(x: &'a mut Vec>, y: Ref<'c, i32>) { - let a: &mut Vec> = x; //~ ERROR lifetime mismatch + let a: &mut Vec> = x; + //[base]~^ ERROR lifetime mismatch let b = Ref { data: y.data }; a.push(b); + //[nll]~^ ERROR lifetime may not live long enough } fn main() { } diff --git a/src/test/ui/lifetimes/lifetime-errors/ex2e-push-inference-variable-3.stderr b/src/test/ui/lifetimes/lifetime-errors/ex2e-push-inference-variable-3.base.stderr similarity index 90% rename from src/test/ui/lifetimes/lifetime-errors/ex2e-push-inference-variable-3.stderr rename to src/test/ui/lifetimes/lifetime-errors/ex2e-push-inference-variable-3.base.stderr index 258b6805acd5c..dbe965a340c40 100644 --- a/src/test/ui/lifetimes/lifetime-errors/ex2e-push-inference-variable-3.stderr +++ b/src/test/ui/lifetimes/lifetime-errors/ex2e-push-inference-variable-3.base.stderr @@ -1,5 +1,5 @@ error[E0623]: lifetime mismatch - --> $DIR/ex2e-push-inference-variable-3.rs:6:33 + --> $DIR/ex2e-push-inference-variable-3.rs:10:33 | LL | fn foo<'a, 'b, 'c>(x: &'a mut Vec>, y: Ref<'c, i32>) { | ------------ ------------ these two types are declared with different lifetimes... diff --git a/src/test/ui/lifetimes/lifetime-errors/ex2e-push-inference-variable-3.nll.stderr b/src/test/ui/lifetimes/lifetime-errors/ex2e-push-inference-variable-3.nll.stderr index e90c81ee3e1af..74b2739b2c3fb 100644 --- a/src/test/ui/lifetimes/lifetime-errors/ex2e-push-inference-variable-3.nll.stderr +++ b/src/test/ui/lifetimes/lifetime-errors/ex2e-push-inference-variable-3.nll.stderr @@ -1,5 +1,5 @@ error: lifetime may not live long enough - --> $DIR/ex2e-push-inference-variable-3.rs:8:5 + --> $DIR/ex2e-push-inference-variable-3.rs:13:5 | LL | fn foo<'a, 'b, 'c>(x: &'a mut Vec>, y: Ref<'c, i32>) { | -- -- lifetime `'c` defined here diff --git a/src/test/ui/lifetimes/lifetime-errors/ex2e-push-inference-variable-3.rs b/src/test/ui/lifetimes/lifetime-errors/ex2e-push-inference-variable-3.rs index e2a795a071ced..036afe09be6ef 100644 --- a/src/test/ui/lifetimes/lifetime-errors/ex2e-push-inference-variable-3.rs +++ b/src/test/ui/lifetimes/lifetime-errors/ex2e-push-inference-variable-3.rs @@ -1,11 +1,17 @@ +// revisions: base nll +// ignore-compare-mode-nll +//[nll] compile-flags: -Z borrowck=mir + struct Ref<'a, T: 'a> { data: &'a T } fn foo<'a, 'b, 'c>(x: &'a mut Vec>, y: Ref<'c, i32>) { - let a: &mut Vec> = x; //~ ERROR lifetime mismatch + let a: &mut Vec> = x; + //[base]~^ ERROR lifetime mismatch let b = Ref { data: y.data }; Vec::push(a, b); + //[nll]~^ ERROR lifetime may not live long enough } fn main() { } diff --git a/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-2.stderr b/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-2.base.stderr similarity index 93% rename from src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-2.stderr rename to src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-2.base.stderr index 5c793636778ea..459f18dcc3d77 100644 --- a/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-2.stderr +++ b/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-2.base.stderr @@ -1,5 +1,5 @@ error[E0623]: lifetime mismatch - --> $DIR/ex3-both-anon-regions-2.rs:2:10 + --> $DIR/ex3-both-anon-regions-2.rs:6:10 | LL | fn foo(&mut (ref mut v, w): &mut (&u8, &u8), x: &u8) { | --- --- these two types are declared with different lifetimes... diff --git a/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-2.nll.stderr b/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-2.nll.stderr index 5a23f1e0e9d99..b072c12ea3bcb 100644 --- a/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-2.nll.stderr +++ b/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-2.nll.stderr @@ -1,5 +1,5 @@ error: lifetime may not live long enough - --> $DIR/ex3-both-anon-regions-2.rs:2:5 + --> $DIR/ex3-both-anon-regions-2.rs:6:5 | LL | fn foo(&mut (ref mut v, w): &mut (&u8, &u8), x: &u8) { | - - let's call the lifetime of this reference `'1` diff --git a/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-2.rs b/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-2.rs index 1ff96aadd9387..668cadd614b59 100644 --- a/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-2.rs +++ b/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-2.rs @@ -1,5 +1,11 @@ +// revisions: base nll +// ignore-compare-mode-nll +//[nll] compile-flags: -Z borrowck=mir + fn foo(&mut (ref mut v, w): &mut (&u8, &u8), x: &u8) { - *v = x; //~ ERROR lifetime mismatch + *v = x; + //[base]~^ ERROR lifetime mismatch + //[nll]~^^ ERROR lifetime may not live long enough } fn main() { } diff --git a/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-3.stderr b/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-3.base.stderr similarity index 93% rename from src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-3.stderr rename to src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-3.base.stderr index 1a7b4fca1ba78..28df5f1836955 100644 --- a/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-3.stderr +++ b/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-3.base.stderr @@ -1,5 +1,5 @@ error[E0623]: lifetime mismatch - --> $DIR/ex3-both-anon-regions-3.rs:2:13 + --> $DIR/ex3-both-anon-regions-3.rs:6:13 | LL | fn foo(z: &mut Vec<(&u8,&u8)>, (x, y): (&u8, &u8)) { | --- --- these two types are declared with different lifetimes... @@ -13,7 +13,7 @@ LL | fn foo<'a>(z: &mut Vec<(&'a u8,&u8)>, (x, y): (&'a u8, &u8)) { | ++++ ++ ++ error[E0623]: lifetime mismatch - --> $DIR/ex3-both-anon-regions-3.rs:2:15 + --> $DIR/ex3-both-anon-regions-3.rs:6:15 | LL | fn foo(z: &mut Vec<(&u8,&u8)>, (x, y): (&u8, &u8)) { | --- --- these two types are declared with different lifetimes... diff --git a/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-3.nll.stderr b/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-3.nll.stderr index 6ba130308a33a..c1d809abad5b9 100644 --- a/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-3.nll.stderr +++ b/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-3.nll.stderr @@ -1,5 +1,5 @@ error: lifetime may not live long enough - --> $DIR/ex3-both-anon-regions-3.rs:2:5 + --> $DIR/ex3-both-anon-regions-3.rs:6:5 | LL | fn foo(z: &mut Vec<(&u8,&u8)>, (x, y): (&u8, &u8)) { | - - let's call the lifetime of this reference `'1` @@ -14,7 +14,7 @@ LL | fn foo<'a>(z: &mut Vec<(&'a u8,&u8)>, (x, y): (&'a u8, &u8)) { | ++++ ++ ++ error: lifetime may not live long enough - --> $DIR/ex3-both-anon-regions-3.rs:2:5 + --> $DIR/ex3-both-anon-regions-3.rs:6:5 | LL | fn foo(z: &mut Vec<(&u8,&u8)>, (x, y): (&u8, &u8)) { | - - let's call the lifetime of this reference `'3` diff --git a/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-3.rs b/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-3.rs index c483f59f9d98c..4d7fd63e5b932 100644 --- a/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-3.rs +++ b/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-3.rs @@ -1,6 +1,13 @@ +// revisions: base nll +// ignore-compare-mode-nll +//[nll] compile-flags: -Z borrowck=mir + fn foo(z: &mut Vec<(&u8,&u8)>, (x, y): (&u8, &u8)) { - z.push((x,y)); //~ ERROR lifetime mismatch - //~^ ERROR lifetime mismatch + z.push((x,y)); + //[base]~^ ERROR lifetime mismatch + //[base]~| ERROR lifetime mismatch + //[nll]~^^^ ERROR lifetime may not live long enough + //[nll]~| ERROR lifetime may not live long enough } fn main() { } diff --git a/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-both-are-structs-2.stderr b/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-both-are-structs-2.base.stderr similarity index 85% rename from src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-both-are-structs-2.stderr rename to src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-both-are-structs-2.base.stderr index 8e41d7c54e68d..32263cd56ee72 100644 --- a/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-both-are-structs-2.stderr +++ b/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-both-are-structs-2.base.stderr @@ -1,5 +1,5 @@ error[E0623]: lifetime mismatch - --> $DIR/ex3-both-anon-regions-both-are-structs-2.rs:7:11 + --> $DIR/ex3-both-anon-regions-both-are-structs-2.rs:11:11 | LL | fn foo(mut x: Ref, y: Ref) { | --- --- these two types are declared with different lifetimes... diff --git a/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-both-are-structs-2.nll.stderr b/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-both-are-structs-2.nll.stderr index 4c0ffe5c0901a..bfde4025194ae 100644 --- a/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-both-are-structs-2.nll.stderr +++ b/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-both-are-structs-2.nll.stderr @@ -1,5 +1,5 @@ error: lifetime may not live long enough - --> $DIR/ex3-both-anon-regions-both-are-structs-2.rs:7:5 + --> $DIR/ex3-both-anon-regions-both-are-structs-2.rs:11:5 | LL | fn foo(mut x: Ref, y: Ref) { | ----- - has type `Ref<'_, '1>` diff --git a/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-both-are-structs-2.rs b/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-both-are-structs-2.rs index 94bb80924073b..30764e2ad17c0 100644 --- a/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-both-are-structs-2.rs +++ b/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-both-are-structs-2.rs @@ -1,10 +1,16 @@ +// revisions: base nll +// ignore-compare-mode-nll +//[nll] compile-flags: -Z borrowck=mir + struct Ref<'a, 'b> { a: &'a u32, b: &'b u32, } fn foo(mut x: Ref, y: Ref) { - x.b = y.b; //~ ERROR lifetime mismatch + x.b = y.b; + //[base]~^ ERROR lifetime mismatch + //[nll]~^^ ERROR lifetime may not live long enough } fn main() {} diff --git a/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-both-are-structs-3.stderr b/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-both-are-structs-3.base.stderr similarity index 84% rename from src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-both-are-structs-3.stderr rename to src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-both-are-structs-3.base.stderr index d659c88f69ef7..fb4a2f8f6fe5d 100644 --- a/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-both-are-structs-3.stderr +++ b/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-both-are-structs-3.base.stderr @@ -1,5 +1,5 @@ error[E0623]: lifetime mismatch - --> $DIR/ex3-both-anon-regions-both-are-structs-3.rs:7:11 + --> $DIR/ex3-both-anon-regions-both-are-structs-3.rs:11:11 | LL | fn foo(mut x: Ref) { | --- this type is declared with multiple lifetimes... diff --git a/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-both-are-structs-3.nll.stderr b/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-both-are-structs-3.nll.stderr index 97c665347f6ec..9ba2c38d6fece 100644 --- a/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-both-are-structs-3.nll.stderr +++ b/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-both-are-structs-3.nll.stderr @@ -1,5 +1,5 @@ error: lifetime may not live long enough - --> $DIR/ex3-both-anon-regions-both-are-structs-3.rs:7:5 + --> $DIR/ex3-both-anon-regions-both-are-structs-3.rs:11:5 | LL | fn foo(mut x: Ref) { | ----- diff --git a/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-both-are-structs-3.rs b/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-both-are-structs-3.rs index 3b22aef6f3242..665be2aa2c8d6 100644 --- a/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-both-are-structs-3.rs +++ b/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-both-are-structs-3.rs @@ -1,10 +1,16 @@ +// revisions: base nll +// ignore-compare-mode-nll +//[nll] compile-flags: -Z borrowck=mir + struct Ref<'a, 'b> { a: &'a u32, b: &'b u32, } fn foo(mut x: Ref) { - x.a = x.b; //~ ERROR lifetime mismatch + x.a = x.b; + //[base]~^ ERROR lifetime mismatch + //[nll]~^^ ERROR lifetime may not live long enough } fn main() {} diff --git a/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-both-are-structs-earlybound-regions.stderr b/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-both-are-structs-earlybound-regions.base.stderr similarity index 97% rename from src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-both-are-structs-earlybound-regions.stderr rename to src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-both-are-structs-earlybound-regions.base.stderr index 374bbd93d0874..66a993e034044 100644 --- a/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-both-are-structs-earlybound-regions.stderr +++ b/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-both-are-structs-earlybound-regions.base.stderr @@ -1,5 +1,5 @@ error[E0623]: lifetime mismatch - --> $DIR/ex3-both-anon-regions-both-are-structs-earlybound-regions.rs:9:12 + --> $DIR/ex3-both-anon-regions-both-are-structs-earlybound-regions.rs:13:12 | LL | fn foo<'a, 'b>(mut x: Vec>, y: Ref<'b>) | ------- ------- these two types are declared with different lifetimes... diff --git a/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-both-are-structs-earlybound-regions.nll.stderr b/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-both-are-structs-earlybound-regions.nll.stderr index b3d0bc2b882f9..ddf878ba9f914 100644 --- a/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-both-are-structs-earlybound-regions.nll.stderr +++ b/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-both-are-structs-earlybound-regions.nll.stderr @@ -1,5 +1,5 @@ error: lifetime may not live long enough - --> $DIR/ex3-both-anon-regions-both-are-structs-earlybound-regions.rs:9:5 + --> $DIR/ex3-both-anon-regions-both-are-structs-earlybound-regions.rs:13:5 | LL | fn foo<'a, 'b>(mut x: Vec>, y: Ref<'b>) | -- -- lifetime `'b` defined here diff --git a/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-both-are-structs-earlybound-regions.rs b/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-both-are-structs-earlybound-regions.rs index 87f9cc17726cd..6e151879f4df1 100644 --- a/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-both-are-structs-earlybound-regions.rs +++ b/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-both-are-structs-earlybound-regions.rs @@ -1,3 +1,7 @@ +// revisions: base nll +// ignore-compare-mode-nll +//[nll] compile-flags: -Z borrowck=mir + struct Ref<'a> { x: &'a u32, } @@ -6,7 +10,9 @@ fn foo<'a, 'b>(mut x: Vec>, y: Ref<'b>) where &'a (): Sized, &'b u32: Sized { - x.push(y); //~ ERROR lifetime mismatch + x.push(y); + //[base]~^ ERROR lifetime mismatch + //[nll]~^^ ERROR lifetime may not live long enough } fn main() {} diff --git a/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-both-are-structs-latebound-regions.stderr b/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-both-are-structs-latebound-regions.base.stderr similarity index 97% rename from src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-both-are-structs-latebound-regions.stderr rename to src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-both-are-structs-latebound-regions.base.stderr index 94798d1ce2ab6..5453dbb08f181 100644 --- a/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-both-are-structs-latebound-regions.stderr +++ b/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-both-are-structs-latebound-regions.base.stderr @@ -1,5 +1,5 @@ error[E0623]: lifetime mismatch - --> $DIR/ex3-both-anon-regions-both-are-structs-latebound-regions.rs:6:12 + --> $DIR/ex3-both-anon-regions-both-are-structs-latebound-regions.rs:10:12 | LL | fn foo<'a, 'b>(mut x: Vec>, y: Ref<'b>) { | ------- ------- these two types are declared with different lifetimes... diff --git a/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-both-are-structs-latebound-regions.nll.stderr b/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-both-are-structs-latebound-regions.nll.stderr index fbe98a4263ec1..cfd3186c80982 100644 --- a/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-both-are-structs-latebound-regions.nll.stderr +++ b/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-both-are-structs-latebound-regions.nll.stderr @@ -1,5 +1,5 @@ error: lifetime may not live long enough - --> $DIR/ex3-both-anon-regions-both-are-structs-latebound-regions.rs:6:5 + --> $DIR/ex3-both-anon-regions-both-are-structs-latebound-regions.rs:10:5 | LL | fn foo<'a, 'b>(mut x: Vec>, y: Ref<'b>) { | -- -- lifetime `'b` defined here diff --git a/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-both-are-structs-latebound-regions.rs b/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-both-are-structs-latebound-regions.rs index 4be76c2a0da54..ecc04fbc8adc1 100644 --- a/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-both-are-structs-latebound-regions.rs +++ b/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-both-are-structs-latebound-regions.rs @@ -1,9 +1,15 @@ +// revisions: base nll +// ignore-compare-mode-nll +//[nll] compile-flags: -Z borrowck=mir + struct Ref<'a> { x: &'a u32, } fn foo<'a, 'b>(mut x: Vec>, y: Ref<'b>) { - x.push(y); //~ ERROR lifetime mismatch + x.push(y); + //[base]~^ ERROR lifetime mismatch + //[nll]~^^ ERROR lifetime may not live long enough } fn main() {} diff --git a/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-both-are-structs.stderr b/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-both-are-structs.base.stderr similarity index 85% rename from src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-both-are-structs.stderr rename to src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-both-are-structs.base.stderr index 9f5a79ed333dc..23e752e4a0e9d 100644 --- a/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-both-are-structs.stderr +++ b/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-both-are-structs.base.stderr @@ -1,5 +1,5 @@ error[E0623]: lifetime mismatch - --> $DIR/ex3-both-anon-regions-both-are-structs.rs:6:12 + --> $DIR/ex3-both-anon-regions-both-are-structs.rs:10:12 | LL | fn foo(mut x: Vec, y: Ref) { | --- --- these two types are declared with different lifetimes... diff --git a/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-both-are-structs.nll.stderr b/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-both-are-structs.nll.stderr index 9630729d0ee6a..fa906a90ccc6f 100644 --- a/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-both-are-structs.nll.stderr +++ b/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-both-are-structs.nll.stderr @@ -1,5 +1,5 @@ error: lifetime may not live long enough - --> $DIR/ex3-both-anon-regions-both-are-structs.rs:6:5 + --> $DIR/ex3-both-anon-regions-both-are-structs.rs:10:5 | LL | fn foo(mut x: Vec, y: Ref) { | ----- - has type `Ref<'1>` diff --git a/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-both-are-structs.rs b/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-both-are-structs.rs index 8fbb405a23d95..f002dfc208f11 100644 --- a/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-both-are-structs.rs +++ b/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-both-are-structs.rs @@ -1,9 +1,15 @@ +// revisions: base nll +// ignore-compare-mode-nll +//[nll] compile-flags: -Z borrowck=mir + struct Ref<'a> { x: &'a u32, } fn foo(mut x: Vec, y: Ref) { - x.push(y); //~ ERROR lifetime mismatch + x.push(y); + //[base]~^ ERROR lifetime mismatch + //[nll]~^^ ERROR lifetime may not live long enough } fn main() {} diff --git a/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-latebound-regions.stderr b/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-latebound-regions.base.stderr similarity index 86% rename from src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-latebound-regions.stderr rename to src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-latebound-regions.base.stderr index 2c87f8dbd2c2b..b5fbc091ebc51 100644 --- a/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-latebound-regions.stderr +++ b/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-latebound-regions.base.stderr @@ -1,5 +1,5 @@ error[E0623]: lifetime mismatch - --> $DIR/ex3-both-anon-regions-latebound-regions.rs:2:12 + --> $DIR/ex3-both-anon-regions-latebound-regions.rs:6:12 | LL | fn foo<'a,'b>(x: &mut Vec<&'a u8>, y: &'b u8) { | ------ ------ these two types are declared with different lifetimes... diff --git a/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-latebound-regions.nll.stderr b/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-latebound-regions.nll.stderr index 1e24032fc1ce2..d59bee087489d 100644 --- a/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-latebound-regions.nll.stderr +++ b/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-latebound-regions.nll.stderr @@ -1,5 +1,5 @@ error: lifetime may not live long enough - --> $DIR/ex3-both-anon-regions-latebound-regions.rs:2:5 + --> $DIR/ex3-both-anon-regions-latebound-regions.rs:6:5 | LL | fn foo<'a,'b>(x: &mut Vec<&'a u8>, y: &'b u8) { | -- -- lifetime `'b` defined here diff --git a/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-latebound-regions.rs b/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-latebound-regions.rs index 7938d11a90532..f0a81eba41239 100644 --- a/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-latebound-regions.rs +++ b/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-latebound-regions.rs @@ -1,5 +1,11 @@ +// revisions: base nll +// ignore-compare-mode-nll +//[nll] compile-flags: -Z borrowck=mir + fn foo<'a,'b>(x: &mut Vec<&'a u8>, y: &'b u8) { - x.push(y); //~ ERROR lifetime mismatch + x.push(y); + //[base]~^ ERROR lifetime mismatch + //[nll]~^^ ERROR lifetime may not live long enough } fn main() { } diff --git a/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-one-is-struct-2.stderr b/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-one-is-struct-2.base.stderr similarity index 87% rename from src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-one-is-struct-2.stderr rename to src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-one-is-struct-2.base.stderr index 60b92ed2b3247..3d9138f02c67b 100644 --- a/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-one-is-struct-2.stderr +++ b/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-one-is-struct-2.base.stderr @@ -1,5 +1,5 @@ error[E0623]: lifetime mismatch - --> $DIR/ex3-both-anon-regions-one-is-struct-2.rs:4:9 + --> $DIR/ex3-both-anon-regions-one-is-struct-2.rs:8:9 | LL | fn foo(mut x: Ref, y: &u32) { | --- ---- diff --git a/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-one-is-struct-2.nll.stderr b/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-one-is-struct-2.nll.stderr index bbd62902d9f44..cac2a9470a8be 100644 --- a/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-one-is-struct-2.nll.stderr +++ b/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-one-is-struct-2.nll.stderr @@ -1,5 +1,5 @@ error: lifetime may not live long enough - --> $DIR/ex3-both-anon-regions-one-is-struct-2.rs:4:5 + --> $DIR/ex3-both-anon-regions-one-is-struct-2.rs:8:5 | LL | fn foo(mut x: Ref, y: &u32) { | ----- - let's call the lifetime of this reference `'2` @@ -9,7 +9,7 @@ LL | y = x.b; | ^^^^^^^ assignment requires that `'1` must outlive `'2` error[E0384]: cannot assign to immutable argument `y` - --> $DIR/ex3-both-anon-regions-one-is-struct-2.rs:4:5 + --> $DIR/ex3-both-anon-regions-one-is-struct-2.rs:8:5 | LL | fn foo(mut x: Ref, y: &u32) { | - help: consider making this binding mutable: `mut y` diff --git a/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-one-is-struct-2.rs b/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-one-is-struct-2.rs index 1e6425cf5ca9d..31ef28e726d2c 100644 --- a/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-one-is-struct-2.rs +++ b/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-one-is-struct-2.rs @@ -1,7 +1,14 @@ +// revisions: base nll +// ignore-compare-mode-nll +//[nll] compile-flags: -Z borrowck=mir + struct Ref<'a, 'b> { a: &'a u32, b: &'b u32 } fn foo(mut x: Ref, y: &u32) { - y = x.b; //~ ERROR lifetime mismatch + y = x.b; + //[base]~^ ERROR lifetime mismatch + //[nll]~^^ ERROR lifetime may not live long enough + //[nll]~| ERROR cannot assign to immutable argument } fn main() { } diff --git a/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-one-is-struct-3.stderr b/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-one-is-struct-3.base.stderr similarity index 85% rename from src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-one-is-struct-3.stderr rename to src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-one-is-struct-3.base.stderr index a220c8ddb2be6..77e035562a809 100644 --- a/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-one-is-struct-3.stderr +++ b/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-one-is-struct-3.base.stderr @@ -1,5 +1,5 @@ error[E0623]: lifetime mismatch - --> $DIR/ex3-both-anon-regions-one-is-struct-3.rs:4:11 + --> $DIR/ex3-both-anon-regions-one-is-struct-3.rs:8:11 | LL | fn foo(mut y: Ref, x: &u32) { | --- ---- these two types are declared with different lifetimes... diff --git a/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-one-is-struct-3.nll.stderr b/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-one-is-struct-3.nll.stderr index 79e7e8e157d95..ba41cc3e908c5 100644 --- a/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-one-is-struct-3.nll.stderr +++ b/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-one-is-struct-3.nll.stderr @@ -1,5 +1,5 @@ error: lifetime may not live long enough - --> $DIR/ex3-both-anon-regions-one-is-struct-3.rs:4:5 + --> $DIR/ex3-both-anon-regions-one-is-struct-3.rs:8:5 | LL | fn foo(mut y: Ref, x: &u32) { | ----- - let's call the lifetime of this reference `'1` diff --git a/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-one-is-struct-3.rs b/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-one-is-struct-3.rs index 02838362c80a7..9a5ac0a976946 100644 --- a/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-one-is-struct-3.rs +++ b/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-one-is-struct-3.rs @@ -1,7 +1,13 @@ +// revisions: base nll +// ignore-compare-mode-nll +//[nll] compile-flags: -Z borrowck=mir + struct Ref<'a, 'b> { a: &'a u32, b: &'b u32 } fn foo(mut y: Ref, x: &u32) { - y.b = x; //~ ERROR lifetime mismatch + y.b = x; + //[base]~^ ERROR lifetime mismatch + //[nll]~^^ ERROR lifetime may not live long enough } fn main() { } diff --git a/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-one-is-struct-4.stderr b/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-one-is-struct-4.base.stderr similarity index 85% rename from src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-one-is-struct-4.stderr rename to src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-one-is-struct-4.base.stderr index 73472a8d02252..6cbbabb150a64 100644 --- a/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-one-is-struct-4.stderr +++ b/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-one-is-struct-4.base.stderr @@ -1,5 +1,5 @@ error[E0623]: lifetime mismatch - --> $DIR/ex3-both-anon-regions-one-is-struct-4.rs:4:11 + --> $DIR/ex3-both-anon-regions-one-is-struct-4.rs:8:11 | LL | fn foo(mut y: Ref, x: &u32) { | --- ---- these two types are declared with different lifetimes... diff --git a/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-one-is-struct-4.nll.stderr b/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-one-is-struct-4.nll.stderr index 53615fd1aba69..c9570aa720620 100644 --- a/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-one-is-struct-4.nll.stderr +++ b/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-one-is-struct-4.nll.stderr @@ -1,5 +1,5 @@ error: lifetime may not live long enough - --> $DIR/ex3-both-anon-regions-one-is-struct-4.rs:4:5 + --> $DIR/ex3-both-anon-regions-one-is-struct-4.rs:8:5 | LL | fn foo(mut y: Ref, x: &u32) { | ----- - let's call the lifetime of this reference `'1` diff --git a/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-one-is-struct-4.rs b/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-one-is-struct-4.rs index 02838362c80a7..9a5ac0a976946 100644 --- a/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-one-is-struct-4.rs +++ b/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-one-is-struct-4.rs @@ -1,7 +1,13 @@ +// revisions: base nll +// ignore-compare-mode-nll +//[nll] compile-flags: -Z borrowck=mir + struct Ref<'a, 'b> { a: &'a u32, b: &'b u32 } fn foo(mut y: Ref, x: &u32) { - y.b = x; //~ ERROR lifetime mismatch + y.b = x; + //[base]~^ ERROR lifetime mismatch + //[nll]~^^ ERROR lifetime may not live long enough } fn main() { } diff --git a/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-one-is-struct.stderr b/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-one-is-struct.base.stderr similarity index 86% rename from src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-one-is-struct.stderr rename to src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-one-is-struct.base.stderr index eb6e6f2e95e78..7caf19e89357c 100644 --- a/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-one-is-struct.stderr +++ b/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-one-is-struct.base.stderr @@ -1,5 +1,5 @@ error[E0623]: lifetime mismatch - --> $DIR/ex3-both-anon-regions-one-is-struct.rs:7:11 + --> $DIR/ex3-both-anon-regions-one-is-struct.rs:11:11 | LL | fn foo(mut x: Ref, y: &u32) { | --- ---- these two types are declared with different lifetimes... diff --git a/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-one-is-struct.nll.stderr b/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-one-is-struct.nll.stderr index 6ff4411673756..9b295248fc99e 100644 --- a/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-one-is-struct.nll.stderr +++ b/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-one-is-struct.nll.stderr @@ -1,5 +1,5 @@ error: lifetime may not live long enough - --> $DIR/ex3-both-anon-regions-one-is-struct.rs:7:5 + --> $DIR/ex3-both-anon-regions-one-is-struct.rs:11:5 | LL | fn foo(mut x: Ref, y: &u32) { | ----- - let's call the lifetime of this reference `'1` diff --git a/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-one-is-struct.rs b/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-one-is-struct.rs index 7c827510be8ae..0b4ee5adacc07 100644 --- a/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-one-is-struct.rs +++ b/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-one-is-struct.rs @@ -1,10 +1,16 @@ +// revisions: base nll +// ignore-compare-mode-nll +//[nll] compile-flags: -Z borrowck=mir + struct Ref<'a, 'b> { a: &'a u32, b: &'b u32, } fn foo(mut x: Ref, y: &u32) { - x.b = y; //~ ERROR lifetime mismatch + x.b = y; + //[base]~^ ERROR lifetime mismatch + //[nll]~^^ ERROR lifetime may not live long enough } fn main() {} diff --git a/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-return-type-is-anon.stderr b/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-return-type-is-anon.base.stderr similarity index 91% rename from src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-return-type-is-anon.stderr rename to src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-return-type-is-anon.base.stderr index 636904aefb47e..add05a11193a3 100644 --- a/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-return-type-is-anon.stderr +++ b/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-return-type-is-anon.base.stderr @@ -1,5 +1,5 @@ error[E0623]: lifetime mismatch - --> $DIR/ex3-both-anon-regions-return-type-is-anon.rs:7:5 + --> $DIR/ex3-both-anon-regions-return-type-is-anon.rs:11:5 | LL | fn foo<'a>(&self, x: &i32) -> &i32 { | ---- ---- diff --git a/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-return-type-is-anon.nll.stderr b/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-return-type-is-anon.nll.stderr index 5601335d275c3..188ff4d77e025 100644 --- a/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-return-type-is-anon.nll.stderr +++ b/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-return-type-is-anon.nll.stderr @@ -1,5 +1,5 @@ error: lifetime may not live long enough - --> $DIR/ex3-both-anon-regions-return-type-is-anon.rs:7:5 + --> $DIR/ex3-both-anon-regions-return-type-is-anon.rs:11:5 | LL | fn foo<'a>(&self, x: &i32) -> &i32 { | - - let's call the lifetime of this reference `'1` diff --git a/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-return-type-is-anon.rs b/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-return-type-is-anon.rs index 286cb6dc90e1b..a4f838c074749 100644 --- a/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-return-type-is-anon.rs +++ b/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-return-type-is-anon.rs @@ -1,10 +1,16 @@ +// revisions: base nll +// ignore-compare-mode-nll +//[nll] compile-flags: -Z borrowck=mir + struct Foo { field: i32 } impl Foo { fn foo<'a>(&self, x: &i32) -> &i32 { - x //~ ERROR lifetime mismatch + x + //[base]~^ ERROR lifetime mismatch + //[nll]~^^ ERROR lifetime may not live long enough } } diff --git a/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-self-is-anon.stderr b/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-self-is-anon.base.stderr similarity index 93% rename from src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-self-is-anon.stderr rename to src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-self-is-anon.base.stderr index 474eadb7f9236..365a0ab3b1027 100644 --- a/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-self-is-anon.stderr +++ b/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-self-is-anon.base.stderr @@ -1,5 +1,5 @@ error[E0623]: lifetime mismatch - --> $DIR/ex3-both-anon-regions-self-is-anon.rs:7:19 + --> $DIR/ex3-both-anon-regions-self-is-anon.rs:11:19 | LL | fn foo<'a>(&self, x: &Foo) -> &Foo { | ---- ---- diff --git a/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-self-is-anon.nll.stderr b/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-self-is-anon.nll.stderr index e221902c4a907..ed9b81f7d0199 100644 --- a/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-self-is-anon.nll.stderr +++ b/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-self-is-anon.nll.stderr @@ -1,5 +1,5 @@ error: lifetime may not live long enough - --> $DIR/ex3-both-anon-regions-self-is-anon.rs:7:19 + --> $DIR/ex3-both-anon-regions-self-is-anon.rs:11:19 | LL | fn foo<'a>(&self, x: &Foo) -> &Foo { | - - let's call the lifetime of this reference `'1` diff --git a/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-self-is-anon.rs b/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-self-is-anon.rs index 79d7d63c8bb1e..c5854537a5ff4 100644 --- a/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-self-is-anon.rs +++ b/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-self-is-anon.rs @@ -1,10 +1,16 @@ +// revisions: base nll +// ignore-compare-mode-nll +//[nll] compile-flags: -Z borrowck=mir + struct Foo { field: i32, } impl Foo { fn foo<'a>(&self, x: &Foo) -> &Foo { - if true { x } else { self } //~ ERROR lifetime mismatch + if true { x } else { self } + //[base]~^ ERROR lifetime mismatch + //[nll]~^^ ERROR lifetime may not live long enough } } diff --git a/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-using-fn-items.stderr b/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-using-fn-items.base.stderr similarity index 91% rename from src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-using-fn-items.stderr rename to src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-using-fn-items.base.stderr index 6ed3528bb9faa..755e9798170cc 100644 --- a/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-using-fn-items.stderr +++ b/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-using-fn-items.base.stderr @@ -1,5 +1,5 @@ error[E0623]: lifetime mismatch - --> $DIR/ex3-both-anon-regions-using-fn-items.rs:2:10 + --> $DIR/ex3-both-anon-regions-using-fn-items.rs:6:10 | LL | fn foo(x:fn(&u8, &u8), y: Vec<&u8>, z: &u8) { | --- --- these two types are declared with different lifetimes... diff --git a/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-using-fn-items.nll.stderr b/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-using-fn-items.nll.stderr index a909c5fa82351..904a09610fcec 100644 --- a/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-using-fn-items.nll.stderr +++ b/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-using-fn-items.nll.stderr @@ -1,5 +1,5 @@ error: lifetime may not live long enough - --> $DIR/ex3-both-anon-regions-using-fn-items.rs:2:3 + --> $DIR/ex3-both-anon-regions-using-fn-items.rs:6:3 | LL | fn foo(x:fn(&u8, &u8), y: Vec<&u8>, z: &u8) { | - - let's call the lifetime of this reference `'1` @@ -14,7 +14,7 @@ LL | fn foo<'a>(x:fn(&u8, &u8), y: Vec<&'a u8>, z: &'a u8) { | ++++ ++ ++ error[E0596]: cannot borrow `y` as mutable, as it is not declared as mutable - --> $DIR/ex3-both-anon-regions-using-fn-items.rs:2:3 + --> $DIR/ex3-both-anon-regions-using-fn-items.rs:6:3 | LL | fn foo(x:fn(&u8, &u8), y: Vec<&u8>, z: &u8) { | - help: consider changing this to be mutable: `mut y` diff --git a/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-using-fn-items.rs b/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-using-fn-items.rs index f9f1a75df5863..4b2280b66f288 100644 --- a/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-using-fn-items.rs +++ b/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-using-fn-items.rs @@ -1,5 +1,12 @@ +// revisions: base nll +// ignore-compare-mode-nll +//[nll] compile-flags: -Z borrowck=mir + fn foo(x:fn(&u8, &u8), y: Vec<&u8>, z: &u8) { - y.push(z); //~ ERROR lifetime mismatch + y.push(z); + //[base]~^ ERROR lifetime mismatch + //[nll]~^^ ERROR lifetime may not live long enough + //[nll]~| ERROR cannot borrow } fn main() { } diff --git a/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-using-impl-items.stderr b/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-using-impl-items.base.stderr similarity index 91% rename from src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-using-impl-items.stderr rename to src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-using-impl-items.base.stderr index 68893781dc291..6a8b07dbec873 100644 --- a/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-using-impl-items.stderr +++ b/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-using-impl-items.base.stderr @@ -1,5 +1,5 @@ error[E0623]: lifetime mismatch - --> $DIR/ex3-both-anon-regions-using-impl-items.rs:6:16 + --> $DIR/ex3-both-anon-regions-using-impl-items.rs:10:16 | LL | fn foo(x: &mut Vec<&u8>, y: &u8) { | --- --- these two types are declared with different lifetimes... diff --git a/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-using-impl-items.nll.stderr b/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-using-impl-items.nll.stderr index 9661f1e5144b4..46b9e98907d15 100644 --- a/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-using-impl-items.nll.stderr +++ b/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-using-impl-items.nll.stderr @@ -1,5 +1,5 @@ error: lifetime may not live long enough - --> $DIR/ex3-both-anon-regions-using-impl-items.rs:6:9 + --> $DIR/ex3-both-anon-regions-using-impl-items.rs:10:9 | LL | fn foo(x: &mut Vec<&u8>, y: &u8) { | - - let's call the lifetime of this reference `'1` diff --git a/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-using-impl-items.rs b/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-using-impl-items.rs index 6f95d5a710dfb..242a2d6fd4f69 100644 --- a/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-using-impl-items.rs +++ b/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-using-impl-items.rs @@ -1,9 +1,15 @@ +// revisions: base nll +// ignore-compare-mode-nll +//[nll] compile-flags: -Z borrowck=mir + trait Foo { fn foo<'a>(x: &mut Vec<&u8>, y: &u8); } impl Foo for () { fn foo(x: &mut Vec<&u8>, y: &u8) { - x.push(y); //~ ERROR lifetime mismatch + x.push(y); + //[base]~^ ERROR lifetime mismatch + //[nll]~^^ ERROR lifetime may not live long enough } } fn main() {} diff --git a/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-using-trait-objects.stderr b/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-using-trait-objects.base.stderr similarity index 91% rename from src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-using-trait-objects.stderr rename to src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-using-trait-objects.base.stderr index ede1631db271c..e38dd0fc6eefc 100644 --- a/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-using-trait-objects.stderr +++ b/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-using-trait-objects.base.stderr @@ -1,5 +1,5 @@ error[E0623]: lifetime mismatch - --> $DIR/ex3-both-anon-regions-using-trait-objects.rs:2:10 + --> $DIR/ex3-both-anon-regions-using-trait-objects.rs:6:10 | LL | fn foo(x:Box , y: Vec<&u8>, z: &u8) { | --- --- these two types are declared with different lifetimes... diff --git a/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-using-trait-objects.nll.stderr b/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-using-trait-objects.nll.stderr index cce0a31bfbbf1..54172a845d77e 100644 --- a/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-using-trait-objects.nll.stderr +++ b/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-using-trait-objects.nll.stderr @@ -1,5 +1,5 @@ error: lifetime may not live long enough - --> $DIR/ex3-both-anon-regions-using-trait-objects.rs:2:3 + --> $DIR/ex3-both-anon-regions-using-trait-objects.rs:6:3 | LL | fn foo(x:Box , y: Vec<&u8>, z: &u8) { | - - let's call the lifetime of this reference `'1` @@ -14,7 +14,7 @@ LL | fn foo<'a>(x:Box , y: Vec<&u8>, z: &u8) { | ++++ ++ ++ error[E0596]: cannot borrow `y` as mutable, as it is not declared as mutable - --> $DIR/ex3-both-anon-regions-using-trait-objects.rs:2:3 + --> $DIR/ex3-both-anon-regions-using-trait-objects.rs:6:3 | LL | fn foo(x:Box , y: Vec<&u8>, z: &u8) { | - help: consider changing this to be mutable: `mut y` diff --git a/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-using-trait-objects.rs b/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-using-trait-objects.rs index 6625d41c7de2a..b93d75b156d5a 100644 --- a/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-using-trait-objects.rs +++ b/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-using-trait-objects.rs @@ -1,5 +1,12 @@ +// revisions: base nll +// ignore-compare-mode-nll +//[nll] compile-flags: -Z borrowck=mir + fn foo(x:Box , y: Vec<&u8>, z: &u8) { - y.push(z); //~ ERROR lifetime mismatch + y.push(z); + //[base]~^ ERROR lifetime mismatch + //[nll]~^^ ERROR lifetime may not live long enough + //[nll]~| ERROR cannot borrow } fn main() { } diff --git a/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions.stderr b/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions.base.stderr similarity index 93% rename from src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions.stderr rename to src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions.base.stderr index cf405c0de3f0b..dd96c6eef68e7 100644 --- a/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions.stderr +++ b/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions.base.stderr @@ -1,5 +1,5 @@ error[E0623]: lifetime mismatch - --> $DIR/ex3-both-anon-regions.rs:2:12 + --> $DIR/ex3-both-anon-regions.rs:6:12 | LL | fn foo(x: &mut Vec<&u8>, y: &u8) { | --- --- these two types are declared with different lifetimes... diff --git a/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions.nll.stderr b/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions.nll.stderr index ec9fac0c288e0..48e09e37241da 100644 --- a/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions.nll.stderr +++ b/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions.nll.stderr @@ -1,5 +1,5 @@ error: lifetime may not live long enough - --> $DIR/ex3-both-anon-regions.rs:2:5 + --> $DIR/ex3-both-anon-regions.rs:6:5 | LL | fn foo(x: &mut Vec<&u8>, y: &u8) { | - - let's call the lifetime of this reference `'1` diff --git a/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions.rs b/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions.rs index 44195dadbb9f1..b1d30e83b6213 100644 --- a/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions.rs +++ b/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions.rs @@ -1,5 +1,11 @@ +// revisions: base nll +// ignore-compare-mode-nll +//[nll] compile-flags: -Z borrowck=mir + fn foo(x: &mut Vec<&u8>, y: &u8) { - x.push(y); //~ ERROR lifetime mismatch + x.push(y); + //[base]~^ ERROR lifetime mismatch + //[nll]~^^ ERROR lifetime may not live long enough } fn main() { } diff --git a/src/test/ui/lifetimes/lifetime-errors/issue_74400.stderr b/src/test/ui/lifetimes/lifetime-errors/issue_74400.base.stderr similarity index 92% rename from src/test/ui/lifetimes/lifetime-errors/issue_74400.stderr rename to src/test/ui/lifetimes/lifetime-errors/issue_74400.base.stderr index d972861a2b567..ba672f2971820 100644 --- a/src/test/ui/lifetimes/lifetime-errors/issue_74400.stderr +++ b/src/test/ui/lifetimes/lifetime-errors/issue_74400.base.stderr @@ -1,5 +1,5 @@ error: implementation of `FnOnce` is not general enough - --> $DIR/issue_74400.rs:12:5 + --> $DIR/issue_74400.rs:16:5 | LL | f(data, identity) | ^ implementation of `FnOnce` is not general enough diff --git a/src/test/ui/lifetimes/lifetime-errors/issue_74400.nll.stderr b/src/test/ui/lifetimes/lifetime-errors/issue_74400.nll.stderr index 2906c05864bae..645d14cd54b89 100644 --- a/src/test/ui/lifetimes/lifetime-errors/issue_74400.nll.stderr +++ b/src/test/ui/lifetimes/lifetime-errors/issue_74400.nll.stderr @@ -1,5 +1,5 @@ error[E0310]: the parameter type `T` may not live long enough - --> $DIR/issue_74400.rs:12:5 + --> $DIR/issue_74400.rs:16:5 | LL | f(data, identity) | ^^^^^^^^^^^^^^^^^ ...so that the type `T` will meet its required lifetime bounds @@ -10,7 +10,7 @@ LL | fn g(data: &[T]) { | +++++++++ error[E0308]: mismatched types - --> $DIR/issue_74400.rs:12:5 + --> $DIR/issue_74400.rs:16:5 | LL | f(data, identity) | ^^^^^^^^^^^^^^^^^ one type is more general than the other @@ -18,13 +18,13 @@ LL | f(data, identity) = note: expected type `for<'r> Fn<(&'r T,)>` found type `Fn<(&T,)>` note: the lifetime requirement is introduced here - --> $DIR/issue_74400.rs:8:34 + --> $DIR/issue_74400.rs:12:34 | LL | fn f(data: &[T], key: impl Fn(&T) -> S) { | ^^^^^^^^^^^ error: implementation of `FnOnce` is not general enough - --> $DIR/issue_74400.rs:12:5 + --> $DIR/issue_74400.rs:16:5 | LL | f(data, identity) | ^^^^^^^^^^^^^^^^^ implementation of `FnOnce` is not general enough diff --git a/src/test/ui/lifetimes/lifetime-errors/issue_74400.rs b/src/test/ui/lifetimes/lifetime-errors/issue_74400.rs index f83384524f718..fdaf2f8a591c9 100644 --- a/src/test/ui/lifetimes/lifetime-errors/issue_74400.rs +++ b/src/test/ui/lifetimes/lifetime-errors/issue_74400.rs @@ -1,6 +1,10 @@ //! Regression test for #74400: Type mismatch in function arguments E0631, E0271 are falsely //! recognized as E0308 mismatched types. +// revisions: base nll +// ignore-compare-mode-nll +//[nll] compile-flags: -Z borrowck=mir + use std::convert::identity; fn main() {} @@ -9,5 +13,9 @@ fn f(data: &[T], key: impl Fn(&T) -> S) { } fn g(data: &[T]) { - f(data, identity) //~ ERROR implementation of `FnOnce` is not general + f(data, identity) + //[base]~^ ERROR implementation of `FnOnce` is not general + //[nll]~^^ ERROR the parameter type + //[nll]~| ERROR mismatched types + //[nll]~| ERROR implementation of `FnOnce` is not general } diff --git a/src/test/ui/lifetimes/re-empty-in-error.stderr b/src/test/ui/lifetimes/re-empty-in-error.base.stderr similarity index 84% rename from src/test/ui/lifetimes/re-empty-in-error.stderr rename to src/test/ui/lifetimes/re-empty-in-error.base.stderr index 227e3ca613961..7dfe23f4f01cc 100644 --- a/src/test/ui/lifetimes/re-empty-in-error.stderr +++ b/src/test/ui/lifetimes/re-empty-in-error.base.stderr @@ -1,11 +1,11 @@ error[E0477]: the type `&'b ()` does not fulfill the required lifetime - --> $DIR/re-empty-in-error.rs:8:5 + --> $DIR/re-empty-in-error.rs:12:5 | LL | foo(&10); | ^^^ | note: type must outlive the empty lifetime as required by this binding - --> $DIR/re-empty-in-error.rs:3:47 + --> $DIR/re-empty-in-error.rs:7:47 | LL | fn foo<'a>(_a: &'a u32) where for<'b> &'b (): 'a { | ^^ diff --git a/src/test/ui/lifetimes/re-empty-in-error.nll.stderr b/src/test/ui/lifetimes/re-empty-in-error.nll.stderr index 9becdab918675..cddb5732f9868 100644 --- a/src/test/ui/lifetimes/re-empty-in-error.nll.stderr +++ b/src/test/ui/lifetimes/re-empty-in-error.nll.stderr @@ -1,5 +1,5 @@ error: higher-ranked lifetime error - --> $DIR/re-empty-in-error.rs:8:5 + --> $DIR/re-empty-in-error.rs:12:5 | LL | foo(&10); | ^^^^^^^^ diff --git a/src/test/ui/lifetimes/re-empty-in-error.rs b/src/test/ui/lifetimes/re-empty-in-error.rs index 41c3718592dee..fdb0a3002c4d9 100644 --- a/src/test/ui/lifetimes/re-empty-in-error.rs +++ b/src/test/ui/lifetimes/re-empty-in-error.rs @@ -1,10 +1,16 @@ +// revisions: base nll +// ignore-compare-mode-nll +//[nll] compile-flags: -Z borrowck=mir + // We didn't have a single test mentioning // `ReEmpty` and this test changes that. fn foo<'a>(_a: &'a u32) where for<'b> &'b (): 'a { - //~^ NOTE type must outlive the empty lifetime as required by this binding + //[base]~^ NOTE type must outlive the empty lifetime as required by this binding } fn main() { foo(&10); - //~^ ERROR the type `&'b ()` does not fulfill the required lifetime + //[base]~^ ERROR the type `&'b ()` does not fulfill the required lifetime + //[nll]~^^ ERROR higher-ranked lifetime error + //[nll]~| NOTE could not prove }