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: Use revisions for NLL in lifetimes --- src/test/ui/lifetimes/issue-79187-2.base.stderr | 60 ++++++++++++++++++++++ src/test/ui/lifetimes/issue-79187-2.nll.stderr | 20 ++++---- src/test/ui/lifetimes/issue-79187-2.rs | 19 +++++-- src/test/ui/lifetimes/issue-79187-2.stderr | 60 ---------------------- src/test/ui/lifetimes/issue-79187.base.stderr | 11 ++++ src/test/ui/lifetimes/issue-79187.nll.stderr | 8 +-- src/test/ui/lifetimes/issue-79187.rs | 8 ++- src/test/ui/lifetimes/issue-79187.stderr | 11 ---- .../issue-90170-elision-mismatch-nll.fixed | 15 ++++++ .../lifetimes/issue-90170-elision-mismatch-nll.rs | 15 ++++++ .../issue-90170-elision-mismatch-nll.stderr | 44 ++++++++++++++++ .../lifetimes/issue-90170-elision-mismatch.fixed | 5 ++ .../issue-90170-elision-mismatch.nll.stderr | 44 ---------------- .../ui/lifetimes/issue-90170-elision-mismatch.rs | 5 ++ .../lifetimes/issue-90170-elision-mismatch.stderr | 6 +-- ...600-expected-return-static-indirect.base.stderr | 14 +++++ ...0600-expected-return-static-indirect.nll.stderr | 6 +-- .../issue-90600-expected-return-static-indirect.rs | 8 ++- ...ue-90600-expected-return-static-indirect.stderr | 14 ----- .../lifetime-bound-will-change-warning.base.stderr | 33 ++++++++++++ .../lifetime-bound-will-change-warning.nll.stderr | 4 +- .../lifetime-bound-will-change-warning.rs | 12 ++++- .../lifetime-bound-will-change-warning.stderr | 33 ------------ ...ne-existing-name-if-else-using-impl.base.stderr | 14 +++++ ...one-existing-name-if-else-using-impl.nll.stderr | 2 +- ...-return-one-existing-name-if-else-using-impl.rs | 8 ++- ...urn-one-existing-name-if-else-using-impl.stderr | 14 ----- ...e-existing-name-return-type-is-anon.base.stderr | 14 +++++ ...ne-existing-name-return-type-is-anon.nll.stderr | 2 +- ...return-one-existing-name-return-type-is-anon.rs | 8 ++- ...rn-one-existing-name-return-type-is-anon.stderr | 14 ----- ...turn-one-existing-name-self-is-anon.base.stderr | 14 +++++ ...eturn-one-existing-name-self-is-anon.nll.stderr | 2 +- .../ex1-return-one-existing-name-self-is-anon.rs | 8 ++- ...x1-return-one-existing-name-self-is-anon.stderr | 14 ----- .../ex2a-push-one-existing-name-2.base.stderr | 11 ++++ .../ex2a-push-one-existing-name-2.nll.stderr | 2 +- .../ex2a-push-one-existing-name-2.rs | 4 ++ .../ex2a-push-one-existing-name-2.stderr | 11 ---- ...-push-one-existing-name-early-bound.base.stderr | 12 +++++ ...a-push-one-existing-name-early-bound.nll.stderr | 2 +- .../ex2a-push-one-existing-name-early-bound.rs | 4 ++ .../ex2a-push-one-existing-name-early-bound.stderr | 12 ----- .../ex2a-push-one-existing-name.base.stderr | 11 ++++ .../ex2a-push-one-existing-name.nll.stderr | 2 +- .../lifetime-errors/ex2a-push-one-existing-name.rs | 4 ++ .../ex2a-push-one-existing-name.stderr | 11 ---- .../ex2b-push-no-existing-names.base.stderr | 11 ++++ .../ex2b-push-no-existing-names.nll.stderr | 2 +- .../lifetime-errors/ex2b-push-no-existing-names.rs | 8 ++- .../ex2b-push-no-existing-names.stderr | 11 ---- .../ex2c-push-inference-variable.base.stderr | 12 +++++ .../ex2c-push-inference-variable.nll.stderr | 2 +- .../ex2c-push-inference-variable.rs | 8 ++- .../ex2c-push-inference-variable.stderr | 12 ----- .../ex2d-push-inference-variable-2.base.stderr | 11 ++++ .../ex2d-push-inference-variable-2.nll.stderr | 2 +- .../ex2d-push-inference-variable-2.rs | 8 ++- .../ex2d-push-inference-variable-2.stderr | 11 ---- .../ex2e-push-inference-variable-3.base.stderr | 11 ++++ .../ex2e-push-inference-variable-3.nll.stderr | 2 +- .../ex2e-push-inference-variable-3.rs | 8 ++- .../ex2e-push-inference-variable-3.stderr | 11 ---- .../ex3-both-anon-regions-2.base.stderr | 17 ++++++ .../ex3-both-anon-regions-2.nll.stderr | 2 +- .../lifetime-errors/ex3-both-anon-regions-2.rs | 8 ++- .../lifetime-errors/ex3-both-anon-regions-2.stderr | 17 ------ .../ex3-both-anon-regions-3.base.stderr | 31 +++++++++++ .../ex3-both-anon-regions-3.nll.stderr | 4 +- .../lifetime-errors/ex3-both-anon-regions-3.rs | 11 +++- .../lifetime-errors/ex3-both-anon-regions-3.stderr | 31 ----------- ...oth-anon-regions-both-are-structs-2.base.stderr | 11 ++++ ...both-anon-regions-both-are-structs-2.nll.stderr | 2 +- .../ex3-both-anon-regions-both-are-structs-2.rs | 8 ++- ...ex3-both-anon-regions-both-are-structs-2.stderr | 11 ---- ...oth-anon-regions-both-are-structs-3.base.stderr | 11 ++++ ...both-anon-regions-both-are-structs-3.nll.stderr | 2 +- .../ex3-both-anon-regions-both-are-structs-3.rs | 8 ++- ...ex3-both-anon-regions-both-are-structs-3.stderr | 11 ---- ...both-are-structs-earlybound-regions.base.stderr | 12 +++++ ...-both-are-structs-earlybound-regions.nll.stderr | 2 +- ...-regions-both-are-structs-earlybound-regions.rs | 8 ++- ...ions-both-are-structs-earlybound-regions.stderr | 12 ----- ...-both-are-structs-latebound-regions.base.stderr | 11 ++++ ...s-both-are-structs-latebound-regions.nll.stderr | 2 +- ...n-regions-both-are-structs-latebound-regions.rs | 8 ++- ...gions-both-are-structs-latebound-regions.stderr | 11 ---- ...-both-anon-regions-both-are-structs.base.stderr | 11 ++++ ...3-both-anon-regions-both-are-structs.nll.stderr | 2 +- .../ex3-both-anon-regions-both-are-structs.rs | 8 ++- .../ex3-both-anon-regions-both-are-structs.stderr | 11 ---- ...both-anon-regions-latebound-regions.base.stderr | 11 ++++ ...-both-anon-regions-latebound-regions.nll.stderr | 2 +- .../ex3-both-anon-regions-latebound-regions.rs | 8 ++- .../ex3-both-anon-regions-latebound-regions.stderr | 11 ---- ...3-both-anon-regions-one-is-struct-2.base.stderr | 13 +++++ ...x3-both-anon-regions-one-is-struct-2.nll.stderr | 4 +- .../ex3-both-anon-regions-one-is-struct-2.rs | 9 +++- .../ex3-both-anon-regions-one-is-struct-2.stderr | 13 ----- ...3-both-anon-regions-one-is-struct-3.base.stderr | 11 ++++ ...x3-both-anon-regions-one-is-struct-3.nll.stderr | 2 +- .../ex3-both-anon-regions-one-is-struct-3.rs | 8 ++- .../ex3-both-anon-regions-one-is-struct-3.stderr | 11 ---- ...3-both-anon-regions-one-is-struct-4.base.stderr | 11 ++++ ...x3-both-anon-regions-one-is-struct-4.nll.stderr | 2 +- .../ex3-both-anon-regions-one-is-struct-4.rs | 8 ++- .../ex3-both-anon-regions-one-is-struct-4.stderr | 11 ---- ...ex3-both-anon-regions-one-is-struct.base.stderr | 11 ++++ .../ex3-both-anon-regions-one-is-struct.nll.stderr | 2 +- .../ex3-both-anon-regions-one-is-struct.rs | 8 ++- .../ex3-both-anon-regions-one-is-struct.stderr | 11 ---- ...th-anon-regions-return-type-is-anon.base.stderr | 19 +++++++ ...oth-anon-regions-return-type-is-anon.nll.stderr | 2 +- .../ex3-both-anon-regions-return-type-is-anon.rs | 8 ++- ...x3-both-anon-regions-return-type-is-anon.stderr | 19 ------- .../ex3-both-anon-regions-self-is-anon.base.stderr | 19 +++++++ .../ex3-both-anon-regions-self-is-anon.nll.stderr | 2 +- .../ex3-both-anon-regions-self-is-anon.rs | 8 ++- .../ex3-both-anon-regions-self-is-anon.stderr | 19 ------- ...x3-both-anon-regions-using-fn-items.base.stderr | 17 ++++++ ...ex3-both-anon-regions-using-fn-items.nll.stderr | 4 +- .../ex3-both-anon-regions-using-fn-items.rs | 9 +++- .../ex3-both-anon-regions-using-fn-items.stderr | 17 ------ ...-both-anon-regions-using-impl-items.base.stderr | 17 ++++++ ...3-both-anon-regions-using-impl-items.nll.stderr | 2 +- .../ex3-both-anon-regions-using-impl-items.rs | 8 ++- .../ex3-both-anon-regions-using-impl-items.stderr | 17 ------ ...th-anon-regions-using-trait-objects.base.stderr | 17 ++++++ ...oth-anon-regions-using-trait-objects.nll.stderr | 4 +- .../ex3-both-anon-regions-using-trait-objects.rs | 9 +++- ...x3-both-anon-regions-using-trait-objects.stderr | 17 ------ .../ex3-both-anon-regions.base.stderr | 17 ++++++ .../ex3-both-anon-regions.nll.stderr | 2 +- .../lifetime-errors/ex3-both-anon-regions.rs | 8 ++- .../lifetime-errors/ex3-both-anon-regions.stderr | 17 ------ .../lifetime-errors/issue_74400.base.stderr | 11 ++++ .../lifetime-errors/issue_74400.nll.stderr | 8 +-- .../ui/lifetimes/lifetime-errors/issue_74400.rs | 10 +++- .../lifetimes/lifetime-errors/issue_74400.stderr | 11 ---- .../ui/lifetimes/re-empty-in-error.base.stderr | 15 ++++++ src/test/ui/lifetimes/re-empty-in-error.nll.stderr | 2 +- src/test/ui/lifetimes/re-empty-in-error.rs | 10 +++- src/test/ui/lifetimes/re-empty-in-error.stderr | 15 ------ 143 files changed, 924 insertions(+), 671 deletions(-) create mode 100644 src/test/ui/lifetimes/issue-79187-2.base.stderr delete mode 100644 src/test/ui/lifetimes/issue-79187-2.stderr create mode 100644 src/test/ui/lifetimes/issue-79187.base.stderr delete mode 100644 src/test/ui/lifetimes/issue-79187.stderr 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 create mode 100644 src/test/ui/lifetimes/issue-90170-elision-mismatch-nll.stderr delete mode 100644 src/test/ui/lifetimes/issue-90170-elision-mismatch.nll.stderr create mode 100644 src/test/ui/lifetimes/issue-90600-expected-return-static-indirect.base.stderr delete mode 100644 src/test/ui/lifetimes/issue-90600-expected-return-static-indirect.stderr create mode 100644 src/test/ui/lifetimes/lifetime-bound-will-change-warning.base.stderr delete mode 100644 src/test/ui/lifetimes/lifetime-bound-will-change-warning.stderr create mode 100644 src/test/ui/lifetimes/lifetime-errors/ex1-return-one-existing-name-if-else-using-impl.base.stderr delete mode 100644 src/test/ui/lifetimes/lifetime-errors/ex1-return-one-existing-name-if-else-using-impl.stderr create mode 100644 src/test/ui/lifetimes/lifetime-errors/ex1-return-one-existing-name-return-type-is-anon.base.stderr delete mode 100644 src/test/ui/lifetimes/lifetime-errors/ex1-return-one-existing-name-return-type-is-anon.stderr create mode 100644 src/test/ui/lifetimes/lifetime-errors/ex1-return-one-existing-name-self-is-anon.base.stderr delete mode 100644 src/test/ui/lifetimes/lifetime-errors/ex1-return-one-existing-name-self-is-anon.stderr create mode 100644 src/test/ui/lifetimes/lifetime-errors/ex2a-push-one-existing-name-2.base.stderr delete mode 100644 src/test/ui/lifetimes/lifetime-errors/ex2a-push-one-existing-name-2.stderr create mode 100644 src/test/ui/lifetimes/lifetime-errors/ex2a-push-one-existing-name-early-bound.base.stderr delete mode 100644 src/test/ui/lifetimes/lifetime-errors/ex2a-push-one-existing-name-early-bound.stderr create mode 100644 src/test/ui/lifetimes/lifetime-errors/ex2a-push-one-existing-name.base.stderr delete mode 100644 src/test/ui/lifetimes/lifetime-errors/ex2a-push-one-existing-name.stderr create mode 100644 src/test/ui/lifetimes/lifetime-errors/ex2b-push-no-existing-names.base.stderr delete mode 100644 src/test/ui/lifetimes/lifetime-errors/ex2b-push-no-existing-names.stderr create mode 100644 src/test/ui/lifetimes/lifetime-errors/ex2c-push-inference-variable.base.stderr delete mode 100644 src/test/ui/lifetimes/lifetime-errors/ex2c-push-inference-variable.stderr create mode 100644 src/test/ui/lifetimes/lifetime-errors/ex2d-push-inference-variable-2.base.stderr delete mode 100644 src/test/ui/lifetimes/lifetime-errors/ex2d-push-inference-variable-2.stderr create mode 100644 src/test/ui/lifetimes/lifetime-errors/ex2e-push-inference-variable-3.base.stderr delete mode 100644 src/test/ui/lifetimes/lifetime-errors/ex2e-push-inference-variable-3.stderr create mode 100644 src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-2.base.stderr delete mode 100644 src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-2.stderr create mode 100644 src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-3.base.stderr delete mode 100644 src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-3.stderr create mode 100644 src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-both-are-structs-2.base.stderr delete mode 100644 src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-both-are-structs-2.stderr create mode 100644 src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-both-are-structs-3.base.stderr delete mode 100644 src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-both-are-structs-3.stderr create mode 100644 src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-both-are-structs-earlybound-regions.base.stderr delete mode 100644 src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-both-are-structs-earlybound-regions.stderr create mode 100644 src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-both-are-structs-latebound-regions.base.stderr delete mode 100644 src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-both-are-structs-latebound-regions.stderr create mode 100644 src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-both-are-structs.base.stderr delete mode 100644 src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-both-are-structs.stderr create mode 100644 src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-latebound-regions.base.stderr delete mode 100644 src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-latebound-regions.stderr create mode 100644 src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-one-is-struct-2.base.stderr delete mode 100644 src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-one-is-struct-2.stderr create mode 100644 src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-one-is-struct-3.base.stderr delete mode 100644 src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-one-is-struct-3.stderr create mode 100644 src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-one-is-struct-4.base.stderr delete mode 100644 src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-one-is-struct-4.stderr create mode 100644 src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-one-is-struct.base.stderr delete mode 100644 src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-one-is-struct.stderr create mode 100644 src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-return-type-is-anon.base.stderr delete mode 100644 src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-return-type-is-anon.stderr create mode 100644 src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-self-is-anon.base.stderr delete mode 100644 src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-self-is-anon.stderr create mode 100644 src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-using-fn-items.base.stderr delete mode 100644 src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-using-fn-items.stderr create mode 100644 src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-using-impl-items.base.stderr delete mode 100644 src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-using-impl-items.stderr create mode 100644 src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-using-trait-objects.base.stderr delete mode 100644 src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-using-trait-objects.stderr create mode 100644 src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions.base.stderr delete mode 100644 src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions.stderr create mode 100644 src/test/ui/lifetimes/lifetime-errors/issue_74400.base.stderr delete mode 100644 src/test/ui/lifetimes/lifetime-errors/issue_74400.stderr create mode 100644 src/test/ui/lifetimes/re-empty-in-error.base.stderr delete mode 100644 src/test/ui/lifetimes/re-empty-in-error.stderr (limited to 'src/test') diff --git a/src/test/ui/lifetimes/issue-79187-2.base.stderr b/src/test/ui/lifetimes/issue-79187-2.base.stderr new file mode 100644 index 00000000000..95591412f7e --- /dev/null +++ b/src/test/ui/lifetimes/issue-79187-2.base.stderr @@ -0,0 +1,60 @@ +error[E0308]: mismatched types + --> $DIR/issue-79187-2.rs:12:5 + | +LL | take_foo(|a| a); + | ^^^^^^^^ lifetime mismatch + | + = 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:12:14 + | +LL | take_foo(|a| a); + | ^^^^^ +note: the lifetime requirement is introduced here + --> $DIR/issue-79187-2.rs:9:21 + | +LL | fn take_foo(_: impl Foo) {} + | ^^^ + +error[E0308]: mismatched types + --> $DIR/issue-79187-2.rs:16:5 + | +LL | take_foo(|a: &i32| a); + | ^^^^^^^^ lifetime mismatch + | + = 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:16:14 + | +LL | take_foo(|a: &i32| a); + | ^^^^^^^^^^^ +note: the lifetime requirement is introduced here + --> $DIR/issue-79187-2.rs:9:21 + | +LL | fn take_foo(_: impl Foo) {} + | ^^^ + +error[E0308]: mismatched types + --> $DIR/issue-79187-2.rs:20:5 + | +LL | take_foo(|a: &i32| -> &i32 { a }); + | ^^^^^^^^ lifetime mismatch + | + = 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:20:14 + | +LL | take_foo(|a: &i32| -> &i32 { a }); + | ^^^^^^^^^^^^^^^^^^^^^^^ +note: the lifetime requirement is introduced here + --> $DIR/issue-79187-2.rs:9:21 + | +LL | fn take_foo(_: impl Foo) {} + | ^^^ + +error: aborting due to 3 previous errors + +For more information about this error, try `rustc --explain E0308`. diff --git a/src/test/ui/lifetimes/issue-79187-2.nll.stderr b/src/test/ui/lifetimes/issue-79187-2.nll.stderr index 04d9b64d64f..3cbce7600f9 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 29d108facab..d122b92f74b 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-2.stderr b/src/test/ui/lifetimes/issue-79187-2.stderr deleted file mode 100644 index 2aca8faff9f..00000000000 --- a/src/test/ui/lifetimes/issue-79187-2.stderr +++ /dev/null @@ -1,60 +0,0 @@ -error[E0308]: mismatched types - --> $DIR/issue-79187-2.rs:8:5 - | -LL | take_foo(|a| a); - | ^^^^^^^^ lifetime mismatch - | - = 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 - | -LL | take_foo(|a| a); - | ^^^^^ -note: the lifetime requirement is introduced here - --> $DIR/issue-79187-2.rs:5:21 - | -LL | fn take_foo(_: impl Foo) {} - | ^^^ - -error[E0308]: mismatched types - --> $DIR/issue-79187-2.rs:9:5 - | -LL | take_foo(|a: &i32| a); - | ^^^^^^^^ lifetime mismatch - | - = 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 - | -LL | take_foo(|a: &i32| a); - | ^^^^^^^^^^^ -note: the lifetime requirement is introduced here - --> $DIR/issue-79187-2.rs:5:21 - | -LL | fn take_foo(_: impl Foo) {} - | ^^^ - -error[E0308]: mismatched types - --> $DIR/issue-79187-2.rs:10:5 - | -LL | take_foo(|a: &i32| -> &i32 { a }); - | ^^^^^^^^ lifetime mismatch - | - = 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 - | -LL | take_foo(|a: &i32| -> &i32 { a }); - | ^^^^^^^^^^^^^^^^^^^^^^^ -note: the lifetime requirement is introduced here - --> $DIR/issue-79187-2.rs:5:21 - | -LL | fn take_foo(_: impl Foo) {} - | ^^^ - -error: aborting due to 3 previous errors - -For more information about this error, try `rustc --explain E0308`. diff --git a/src/test/ui/lifetimes/issue-79187.base.stderr b/src/test/ui/lifetimes/issue-79187.base.stderr new file mode 100644 index 00000000000..c4654ca1517 --- /dev/null +++ b/src/test/ui/lifetimes/issue-79187.base.stderr @@ -0,0 +1,11 @@ +error: implementation of `FnOnce` is not general enough + --> $DIR/issue-79187.rs:9:5 + | +LL | thing(f); + | ^^^^^ implementation of `FnOnce` is not general enough + | + = note: closure with signature `fn(&'2 u32)` must implement `FnOnce<(&'1 u32,)>`, for any lifetime `'1`... + = note: ...but it actually implements `FnOnce<(&'2 u32,)>`, for some specific lifetime `'2` + +error: aborting due to previous error + diff --git a/src/test/ui/lifetimes/issue-79187.nll.stderr b/src/test/ui/lifetimes/issue-79187.nll.stderr index 3a993e88d8a..54dce9b4bac 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 2ee69ee2234..b97890d94e9 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-79187.stderr b/src/test/ui/lifetimes/issue-79187.stderr deleted file mode 100644 index 3c0439fb660..00000000000 --- a/src/test/ui/lifetimes/issue-79187.stderr +++ /dev/null @@ -1,11 +0,0 @@ -error: implementation of `FnOnce` is not general enough - --> $DIR/issue-79187.rs:5:5 - | -LL | thing(f); - | ^^^^^ implementation of `FnOnce` is not general enough - | - = note: closure with signature `fn(&'2 u32)` must implement `FnOnce<(&'1 u32,)>`, for any lifetime `'1`... - = note: ...but it actually implements `FnOnce<(&'2 u32,)>`, for some specific lifetime `'2` - -error: aborting due to previous error - 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 00000000000..4b417afb038 --- /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 00000000000..ec50e8e1d9a --- /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 new file mode 100644 index 00000000000..144fe3bf9da --- /dev/null +++ b/src/test/ui/lifetimes/issue-90170-elision-mismatch-nll.stderr @@ -0,0 +1,44 @@ +error: lifetime may not live long enough + --> $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` + | | | + | | let's call the lifetime of this reference `'1` + | let's call the lifetime of this reference `'2` + | +help: consider introducing a named lifetime parameter + | +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-nll.rs:11:44 + | +LL | pub fn foo2(x: &mut Vec<&'_ u8>, y: &u8) { x.push(y); } + | - - ^^^^^^^^^ argument requires that `'1` must outlive `'2` + | | | + | | let's call the lifetime of this reference `'1` + | let's call the lifetime of this reference `'2` + | +help: consider introducing a named lifetime parameter + | +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-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` + | | | + | | let's call the lifetime of this reference `'1` + | let's call the lifetime of this reference `'2` + | +help: consider introducing a named lifetime parameter + | +LL | pub fn foo3<'a>(_other: &'a [u8], x: &mut Vec<&'a u8>, y: &'a u8) { x.push(y); } + | ++ ++ + +error: aborting due to 3 previous errors + diff --git a/src/test/ui/lifetimes/issue-90170-elision-mismatch.fixed b/src/test/ui/lifetimes/issue-90170-elision-mismatch.fixed index 0bc889ee721..f05943284f7 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.nll.stderr b/src/test/ui/lifetimes/issue-90170-elision-mismatch.nll.stderr deleted file mode 100644 index 48fb3fb4a22..00000000000 --- a/src/test/ui/lifetimes/issue-90170-elision-mismatch.nll.stderr +++ /dev/null @@ -1,44 +0,0 @@ -error: lifetime may not live long enough - --> $DIR/issue-90170-elision-mismatch.rs:3:40 - | -LL | pub fn foo(x: &mut Vec<&u8>, y: &u8) { x.push(y); } - | - - ^^^^^^^^^ argument requires that `'1` must outlive `'2` - | | | - | | let's call the lifetime of this reference `'1` - | let's call the lifetime of this reference `'2` - | -help: consider introducing a named lifetime parameter - | -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 - | -LL | pub fn foo2(x: &mut Vec<&'_ u8>, y: &u8) { x.push(y); } - | - - ^^^^^^^^^ argument requires that `'1` must outlive `'2` - | | | - | | let's call the lifetime of this reference `'1` - | let's call the lifetime of this reference `'2` - | -help: consider introducing a named lifetime parameter - | -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 - | -LL | pub fn foo3<'a>(_other: &'a [u8], x: &mut Vec<&u8>, y: &u8) { x.push(y); } - | - - ^^^^^^^^^ argument requires that `'1` must outlive `'2` - | | | - | | let's call the lifetime of this reference `'1` - | let's call the lifetime of this reference `'2` - | -help: consider introducing a named lifetime parameter - | -LL | pub fn foo3<'a>(_other: &'a [u8], x: &mut Vec<&'a u8>, y: &'a u8) { x.push(y); } - | ++ ++ - -error: aborting due to 3 previous errors - diff --git a/src/test/ui/lifetimes/issue-90170-elision-mismatch.rs b/src/test/ui/lifetimes/issue-90170-elision-mismatch.rs index 1d6573c00ad..fee2b461ef9 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 7fa092ca220..28f3957041c 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.base.stderr b/src/test/ui/lifetimes/issue-90600-expected-return-static-indirect.base.stderr new file mode 100644 index 00000000000..b20ce7b07ff --- /dev/null +++ b/src/test/ui/lifetimes/issue-90600-expected-return-static-indirect.base.stderr @@ -0,0 +1,14 @@ +error[E0759]: `foo` has an anonymous lifetime `'_` but it needs to satisfy a `'static` lifetime requirement + --> $DIR/issue-90600-expected-return-static-indirect.rs:11:32 + | +LL | fn inner(mut foo: &[u8]) { + | ----- this data with an anonymous lifetime `'_`... +LL | let refcell = RefCell::new(&mut foo); + | ^^^^^^^^ ...is used here... +... +LL | read_thing(read); + | ---- ...and is required to live as long as `'static` here + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0759`. 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 99e1e7217b4..b35505ac8c5 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 39996bbf43b..fa44be9a912 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/issue-90600-expected-return-static-indirect.stderr b/src/test/ui/lifetimes/issue-90600-expected-return-static-indirect.stderr deleted file mode 100644 index e06255e4ea3..00000000000 --- a/src/test/ui/lifetimes/issue-90600-expected-return-static-indirect.stderr +++ /dev/null @@ -1,14 +0,0 @@ -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 - | -LL | fn inner(mut foo: &[u8]) { - | ----- this data with an anonymous lifetime `'_`... -LL | let refcell = RefCell::new(&mut foo); - | ^^^^^^^^ ...is used here... -... -LL | read_thing(read); - | ---- ...and is required to live as long as `'static` here - -error: aborting due to previous error - -For more information about this error, try `rustc --explain E0759`. diff --git a/src/test/ui/lifetimes/lifetime-bound-will-change-warning.base.stderr b/src/test/ui/lifetimes/lifetime-bound-will-change-warning.base.stderr new file mode 100644 index 00000000000..54fa49b47f6 --- /dev/null +++ b/src/test/ui/lifetimes/lifetime-bound-will-change-warning.base.stderr @@ -0,0 +1,33 @@ +error[E0308]: mismatched types + --> $DIR/lifetime-bound-will-change-warning.rs:38:13 + | +LL | ref_obj(x) + | ^ lifetime mismatch + | + = 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: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:45:18 + | +LL | lib::ref_obj(x) + | ^ lifetime mismatch + | + = 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:43:12 + | +LL | fn test2cc<'a>(x: &'a Box) { + | ^^ + = note: ...does not necessarily outlive the static lifetime + +error: aborting due to 2 previous errors + +For more information about this error, try `rustc --explain E0308`. 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 6f3f84096e4..10105c5ccec 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 3c6d92234c4..0a082e1bae8 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-bound-will-change-warning.stderr b/src/test/ui/lifetimes/lifetime-bound-will-change-warning.stderr deleted file mode 100644 index bb691fc072b..00000000000 --- a/src/test/ui/lifetimes/lifetime-bound-will-change-warning.stderr +++ /dev/null @@ -1,33 +0,0 @@ -error[E0308]: mismatched types - --> $DIR/lifetime-bound-will-change-warning.rs:34:13 - | -LL | ref_obj(x) - | ^ lifetime mismatch - | - = 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 - | -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 - | -LL | lib::ref_obj(x) - | ^ lifetime mismatch - | - = 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 - | -LL | fn test2cc<'a>(x: &'a Box) { - | ^^ - = note: ...does not necessarily outlive the static lifetime - -error: aborting due to 2 previous errors - -For more information about this error, try `rustc --explain E0308`. diff --git a/src/test/ui/lifetimes/lifetime-errors/ex1-return-one-existing-name-if-else-using-impl.base.stderr b/src/test/ui/lifetimes/lifetime-errors/ex1-return-one-existing-name-if-else-using-impl.base.stderr new file mode 100644 index 00000000000..60cd3493875 --- /dev/null +++ b/src/test/ui/lifetimes/lifetime-errors/ex1-return-one-existing-name-if-else-using-impl.base.stderr @@ -0,0 +1,14 @@ +error[E0623]: lifetime mismatch + --> $DIR/ex1-return-one-existing-name-if-else-using-impl.rs:15:20 + | +LL | fn foo<'a>(x: &i32, y: &'a i32) -> &'a i32 { + | ---- ------- + | | + | this parameter and the return type are declared with different lifetimes... +LL | +LL | if x > y { x } else { y } + | ^ ...but data from `x` is returned here + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0623`. 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 4c788211576..f8e275e9b14 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 12024bd1080..fbb523daa1f 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-if-else-using-impl.stderr b/src/test/ui/lifetimes/lifetime-errors/ex1-return-one-existing-name-if-else-using-impl.stderr deleted file mode 100644 index e9f5fc311df..00000000000 --- a/src/test/ui/lifetimes/lifetime-errors/ex1-return-one-existing-name-if-else-using-impl.stderr +++ /dev/null @@ -1,14 +0,0 @@ -error[E0623]: lifetime mismatch - --> $DIR/ex1-return-one-existing-name-if-else-using-impl.rs:11:20 - | -LL | fn foo<'a>(x: &i32, y: &'a i32) -> &'a i32 { - | ---- ------- - | | - | this parameter and the return type are declared with different lifetimes... -LL | -LL | if x > y { x } else { y } - | ^ ...but data from `x` is returned here - -error: aborting due to previous error - -For more information about this error, try `rustc --explain E0623`. diff --git a/src/test/ui/lifetimes/lifetime-errors/ex1-return-one-existing-name-return-type-is-anon.base.stderr b/src/test/ui/lifetimes/lifetime-errors/ex1-return-one-existing-name-return-type-is-anon.base.stderr new file mode 100644 index 00000000000..697950a00fb --- /dev/null +++ b/src/test/ui/lifetimes/lifetime-errors/ex1-return-one-existing-name-return-type-is-anon.base.stderr @@ -0,0 +1,14 @@ +error[E0623]: lifetime mismatch + --> $DIR/ex1-return-one-existing-name-return-type-is-anon.rs:12:5 + | +LL | fn foo<'a>(&self, x: &'a i32) -> &i32 { + | ------- ---- + | | + | this parameter and the return type are declared with different lifetimes... +LL | +LL | x + | ^ ...but data from `x` is returned here + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0623`. 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 11e7fa96d7e..97af4b58cbf 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 ef5dd1160fb..704db7dc8b4 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-return-type-is-anon.stderr b/src/test/ui/lifetimes/lifetime-errors/ex1-return-one-existing-name-return-type-is-anon.stderr deleted file mode 100644 index 0d506f2b9fc..00000000000 --- a/src/test/ui/lifetimes/lifetime-errors/ex1-return-one-existing-name-return-type-is-anon.stderr +++ /dev/null @@ -1,14 +0,0 @@ -error[E0623]: lifetime mismatch - --> $DIR/ex1-return-one-existing-name-return-type-is-anon.rs:8:5 - | -LL | fn foo<'a>(&self, x: &'a i32) -> &i32 { - | ------- ---- - | | - | this parameter and the return type are declared with different lifetimes... -LL | -LL | x - | ^ ...but data from `x` is returned here - -error: aborting due to previous error - -For more information about this error, try `rustc --explain E0623`. diff --git a/src/test/ui/lifetimes/lifetime-errors/ex1-return-one-existing-name-self-is-anon.base.stderr b/src/test/ui/lifetimes/lifetime-errors/ex1-return-one-existing-name-self-is-anon.base.stderr new file mode 100644 index 00000000000..65644d03cdc --- /dev/null +++ b/src/test/ui/lifetimes/lifetime-errors/ex1-return-one-existing-name-self-is-anon.base.stderr @@ -0,0 +1,14 @@ +error[E0623]: lifetime mismatch + --> $DIR/ex1-return-one-existing-name-self-is-anon.rs:12:30 + | +LL | fn foo<'a>(&self, x: &'a Foo) -> &'a Foo { + | ----- ------- + | | + | this parameter and the return type are declared with different lifetimes... +LL | +LL | if true { x } else { self } + | ^^^^ ...but data from `self` is returned here + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0623`. 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 c41f08e691a..00a348de4bc 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 597d20dbacd..a846c115c06 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/ex1-return-one-existing-name-self-is-anon.stderr b/src/test/ui/lifetimes/lifetime-errors/ex1-return-one-existing-name-self-is-anon.stderr deleted file mode 100644 index 98a23613c36..00000000000 --- a/src/test/ui/lifetimes/lifetime-errors/ex1-return-one-existing-name-self-is-anon.stderr +++ /dev/null @@ -1,14 +0,0 @@ -error[E0623]: lifetime mismatch - --> $DIR/ex1-return-one-existing-name-self-is-anon.rs:8:30 - | -LL | fn foo<'a>(&self, x: &'a Foo) -> &'a Foo { - | ----- ------- - | | - | this parameter and the return type are declared with different lifetimes... -LL | -LL | if true { x } else { self } - | ^^^^ ...but data from `self` is returned here - -error: aborting due to previous error - -For more information about this error, try `rustc --explain E0623`. diff --git a/src/test/ui/lifetimes/lifetime-errors/ex2a-push-one-existing-name-2.base.stderr b/src/test/ui/lifetimes/lifetime-errors/ex2a-push-one-existing-name-2.base.stderr new file mode 100644 index 00000000000..9203d6603bd --- /dev/null +++ b/src/test/ui/lifetimes/lifetime-errors/ex2a-push-one-existing-name-2.base.stderr @@ -0,0 +1,11 @@ +error[E0621]: explicit lifetime required in the type of `x` + --> $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>` +LL | y.push(x); + | ^ lifetime `'a` required + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0621`. 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 90d4754ebab..5ab8b449816 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 998a48ce20c..7e776baa6a9 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-2.stderr b/src/test/ui/lifetimes/lifetime-errors/ex2a-push-one-existing-name-2.stderr deleted file mode 100644 index 412cac43563..00000000000 --- a/src/test/ui/lifetimes/lifetime-errors/ex2a-push-one-existing-name-2.stderr +++ /dev/null @@ -1,11 +0,0 @@ -error[E0621]: explicit lifetime required in the type of `x` - --> $DIR/ex2a-push-one-existing-name-2.rs:6:12 - | -LL | fn foo<'a>(x: Ref, y: &mut Vec>) { - | -------- help: add explicit lifetime `'a` to the type of `x`: `Ref<'a, i32>` -LL | y.push(x); - | ^ lifetime `'a` required - -error: aborting due to previous error - -For more information about this error, try `rustc --explain E0621`. diff --git a/src/test/ui/lifetimes/lifetime-errors/ex2a-push-one-existing-name-early-bound.base.stderr b/src/test/ui/lifetimes/lifetime-errors/ex2a-push-one-existing-name-early-bound.base.stderr new file mode 100644 index 00000000000..ec1ab19d5a4 --- /dev/null +++ b/src/test/ui/lifetimes/lifetime-errors/ex2a-push-one-existing-name-early-bound.base.stderr @@ -0,0 +1,12 @@ +error[E0621]: explicit lifetime required in the type of `y` + --> $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` +... +LL | x.push(y); + | ^ lifetime `'a` required + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0621`. 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 a03e16b3b79..bd5864bae32 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 d18b50d0d0c..73613a9bf35 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-early-bound.stderr b/src/test/ui/lifetimes/lifetime-errors/ex2a-push-one-existing-name-early-bound.stderr deleted file mode 100644 index 30826c3613c..00000000000 --- a/src/test/ui/lifetimes/lifetime-errors/ex2a-push-one-existing-name-early-bound.stderr +++ /dev/null @@ -1,12 +0,0 @@ -error[E0621]: explicit lifetime required in the type of `y` - --> $DIR/ex2a-push-one-existing-name-early-bound.rs:8: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` -... -LL | x.push(y); - | ^ lifetime `'a` required - -error: aborting due to previous error - -For more information about this error, try `rustc --explain E0621`. diff --git a/src/test/ui/lifetimes/lifetime-errors/ex2a-push-one-existing-name.base.stderr b/src/test/ui/lifetimes/lifetime-errors/ex2a-push-one-existing-name.base.stderr new file mode 100644 index 00000000000..ab0e202a32e --- /dev/null +++ b/src/test/ui/lifetimes/lifetime-errors/ex2a-push-one-existing-name.base.stderr @@ -0,0 +1,11 @@ +error[E0621]: explicit lifetime required in the type of `y` + --> $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>` +LL | x.push(y); + | ^ lifetime `'a` required + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0621`. 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 487b34e3d18..01b7f45d81b 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 5188ea1cc9c..5773e13304c 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/ex2a-push-one-existing-name.stderr b/src/test/ui/lifetimes/lifetime-errors/ex2a-push-one-existing-name.stderr deleted file mode 100644 index 13d0835287d..00000000000 --- a/src/test/ui/lifetimes/lifetime-errors/ex2a-push-one-existing-name.stderr +++ /dev/null @@ -1,11 +0,0 @@ -error[E0621]: explicit lifetime required in the type of `y` - --> $DIR/ex2a-push-one-existing-name.rs:6:12 - | -LL | fn foo<'a>(x: &mut Vec>, y: Ref) { - | -------- help: add explicit lifetime `'a` to the type of `y`: `Ref<'a, i32>` -LL | x.push(y); - | ^ lifetime `'a` required - -error: aborting due to previous error - -For more information about this error, try `rustc --explain E0621`. diff --git a/src/test/ui/lifetimes/lifetime-errors/ex2b-push-no-existing-names.base.stderr b/src/test/ui/lifetimes/lifetime-errors/ex2b-push-no-existing-names.base.stderr new file mode 100644 index 00000000000..58a2088df5e --- /dev/null +++ b/src/test/ui/lifetimes/lifetime-errors/ex2b-push-no-existing-names.base.stderr @@ -0,0 +1,11 @@ +error[E0623]: lifetime mismatch + --> $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... +LL | x.push(y); + | ^ ...but data from `y` flows into `x` here + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0623`. 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 1622ce42290..afe413bcca5 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 82e0c9bc26e..8d830343b08 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/ex2b-push-no-existing-names.stderr b/src/test/ui/lifetimes/lifetime-errors/ex2b-push-no-existing-names.stderr deleted file mode 100644 index e505c9c0dc2..00000000000 --- a/src/test/ui/lifetimes/lifetime-errors/ex2b-push-no-existing-names.stderr +++ /dev/null @@ -1,11 +0,0 @@ -error[E0623]: lifetime mismatch - --> $DIR/ex2b-push-no-existing-names.rs:6:12 - | -LL | fn foo(x: &mut Vec>, y: Ref) { - | -------- -------- these two types are declared with different lifetimes... -LL | x.push(y); - | ^ ...but data from `y` flows into `x` here - -error: aborting due to previous error - -For more information about this error, try `rustc --explain E0623`. diff --git a/src/test/ui/lifetimes/lifetime-errors/ex2c-push-inference-variable.base.stderr b/src/test/ui/lifetimes/lifetime-errors/ex2c-push-inference-variable.base.stderr new file mode 100644 index 00000000000..63033b8d16e --- /dev/null +++ b/src/test/ui/lifetimes/lifetime-errors/ex2c-push-inference-variable.base.stderr @@ -0,0 +1,12 @@ +error[E0623]: lifetime mismatch + --> $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... +LL | let z = Ref { data: y.data }; +LL | x.push(z); + | ^ ...but data from `y` flows into `x` here + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0623`. 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 99fab4631a2..63a0f2409d9 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 7f15aee5f08..f676eb403a8 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/ex2c-push-inference-variable.stderr b/src/test/ui/lifetimes/lifetime-errors/ex2c-push-inference-variable.stderr deleted file mode 100644 index 63b1c6db28f..00000000000 --- a/src/test/ui/lifetimes/lifetime-errors/ex2c-push-inference-variable.stderr +++ /dev/null @@ -1,12 +0,0 @@ -error[E0623]: lifetime mismatch - --> $DIR/ex2c-push-inference-variable.rs:7:12 - | -LL | fn foo<'a, 'b, 'c>(x: &'a mut Vec>, y: Ref<'c, i32>) { - | ------------ ------------ these two types are declared with different lifetimes... -LL | let z = Ref { data: y.data }; -LL | x.push(z); - | ^ ...but data from `y` flows into `x` here - -error: aborting due to previous error - -For more information about this error, try `rustc --explain E0623`. diff --git a/src/test/ui/lifetimes/lifetime-errors/ex2d-push-inference-variable-2.base.stderr b/src/test/ui/lifetimes/lifetime-errors/ex2d-push-inference-variable-2.base.stderr new file mode 100644 index 00000000000..a50985ca704 --- /dev/null +++ b/src/test/ui/lifetimes/lifetime-errors/ex2d-push-inference-variable-2.base.stderr @@ -0,0 +1,11 @@ +error[E0623]: lifetime mismatch + --> $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... +LL | let a: &mut Vec> = x; + | ^ ...but data from `y` flows into `x` here + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0623`. 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 52c5752f6ea..0d7461fa682 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 ee77d9e7fde..e65638fb0df 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/ex2d-push-inference-variable-2.stderr b/src/test/ui/lifetimes/lifetime-errors/ex2d-push-inference-variable-2.stderr deleted file mode 100644 index 2f669efcf1e..00000000000 --- a/src/test/ui/lifetimes/lifetime-errors/ex2d-push-inference-variable-2.stderr +++ /dev/null @@ -1,11 +0,0 @@ -error[E0623]: lifetime mismatch - --> $DIR/ex2d-push-inference-variable-2.rs:6:33 - | -LL | fn foo<'a, 'b, 'c>(x: &'a mut Vec>, y: Ref<'c, i32>) { - | ------------ ------------ these two types are declared with different lifetimes... -LL | let a: &mut Vec> = x; - | ^ ...but data from `y` flows into `x` here - -error: aborting due to previous error - -For more information about this error, try `rustc --explain E0623`. diff --git a/src/test/ui/lifetimes/lifetime-errors/ex2e-push-inference-variable-3.base.stderr b/src/test/ui/lifetimes/lifetime-errors/ex2e-push-inference-variable-3.base.stderr new file mode 100644 index 00000000000..dbe965a340c --- /dev/null +++ b/src/test/ui/lifetimes/lifetime-errors/ex2e-push-inference-variable-3.base.stderr @@ -0,0 +1,11 @@ +error[E0623]: lifetime mismatch + --> $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... +LL | let a: &mut Vec> = x; + | ^ ...but data from `y` flows into `x` here + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0623`. 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 e90c81ee3e1..74b2739b2c3 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 e2a795a071c..036afe09be6 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/ex2e-push-inference-variable-3.stderr b/src/test/ui/lifetimes/lifetime-errors/ex2e-push-inference-variable-3.stderr deleted file mode 100644 index 258b6805acd..00000000000 --- a/src/test/ui/lifetimes/lifetime-errors/ex2e-push-inference-variable-3.stderr +++ /dev/null @@ -1,11 +0,0 @@ -error[E0623]: lifetime mismatch - --> $DIR/ex2e-push-inference-variable-3.rs:6:33 - | -LL | fn foo<'a, 'b, 'c>(x: &'a mut Vec>, y: Ref<'c, i32>) { - | ------------ ------------ these two types are declared with different lifetimes... -LL | let a: &mut Vec> = x; - | ^ ...but data from `y` flows into `x` here - -error: aborting due to previous error - -For more information about this error, try `rustc --explain E0623`. diff --git a/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-2.base.stderr b/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-2.base.stderr new file mode 100644 index 00000000000..459f18dcc3d --- /dev/null +++ b/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-2.base.stderr @@ -0,0 +1,17 @@ +error[E0623]: lifetime mismatch + --> $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... +LL | *v = x; + | ^ ...but data from `x` flows here + | + = note: each elided lifetime in input position becomes a distinct lifetime +help: consider introducing a named lifetime parameter + | +LL | fn foo<'a>(&mut (ref mut v, w): &mut (&'a u8, &u8), x: &'a u8) { + | ++++ ++ ++ + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0623`. 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 5a23f1e0e9d..b072c12ea3b 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 1ff96aadd93..668cadd614b 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-2.stderr b/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-2.stderr deleted file mode 100644 index 5c793636778..00000000000 --- a/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-2.stderr +++ /dev/null @@ -1,17 +0,0 @@ -error[E0623]: lifetime mismatch - --> $DIR/ex3-both-anon-regions-2.rs:2:10 - | -LL | fn foo(&mut (ref mut v, w): &mut (&u8, &u8), x: &u8) { - | --- --- these two types are declared with different lifetimes... -LL | *v = x; - | ^ ...but data from `x` flows here - | - = note: each elided lifetime in input position becomes a distinct lifetime -help: consider introducing a named lifetime parameter - | -LL | fn foo<'a>(&mut (ref mut v, w): &mut (&'a u8, &u8), x: &'a u8) { - | ++++ ++ ++ - -error: aborting due to previous error - -For more information about this error, try `rustc --explain E0623`. diff --git a/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-3.base.stderr b/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-3.base.stderr new file mode 100644 index 00000000000..28df5f18369 --- /dev/null +++ b/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-3.base.stderr @@ -0,0 +1,31 @@ +error[E0623]: lifetime mismatch + --> $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... +LL | z.push((x,y)); + | ^ ...but data flows into `z` here + | + = note: each elided lifetime in input position becomes a distinct lifetime +help: consider introducing a named lifetime parameter + | +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:6:15 + | +LL | fn foo(z: &mut Vec<(&u8,&u8)>, (x, y): (&u8, &u8)) { + | --- --- these two types are declared with different lifetimes... +LL | z.push((x,y)); + | ^ ...but data flows into `z` here + | + = note: each elided lifetime in input position becomes a distinct lifetime +help: consider introducing a named lifetime parameter + | +LL | fn foo<'a>(z: &mut Vec<(&u8,&'a u8)>, (x, y): (&u8, &'a u8)) { + | ++++ ++ ++ + +error: aborting due to 2 previous errors + +For more information about this error, try `rustc --explain E0623`. 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 6ba130308a3..c1d809abad5 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 c483f59f9d9..4d7fd63e5b9 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-3.stderr b/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-3.stderr deleted file mode 100644 index 1a7b4fca1ba..00000000000 --- a/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-3.stderr +++ /dev/null @@ -1,31 +0,0 @@ -error[E0623]: lifetime mismatch - --> $DIR/ex3-both-anon-regions-3.rs:2:13 - | -LL | fn foo(z: &mut Vec<(&u8,&u8)>, (x, y): (&u8, &u8)) { - | --- --- these two types are declared with different lifetimes... -LL | z.push((x,y)); - | ^ ...but data flows into `z` here - | - = note: each elided lifetime in input position becomes a distinct lifetime -help: consider introducing a named lifetime parameter - | -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 - | -LL | fn foo(z: &mut Vec<(&u8,&u8)>, (x, y): (&u8, &u8)) { - | --- --- these two types are declared with different lifetimes... -LL | z.push((x,y)); - | ^ ...but data flows into `z` here - | - = note: each elided lifetime in input position becomes a distinct lifetime -help: consider introducing a named lifetime parameter - | -LL | fn foo<'a>(z: &mut Vec<(&u8,&'a u8)>, (x, y): (&u8, &'a u8)) { - | ++++ ++ ++ - -error: aborting due to 2 previous errors - -For more information about this error, try `rustc --explain E0623`. diff --git a/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-both-are-structs-2.base.stderr b/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-both-are-structs-2.base.stderr new file mode 100644 index 00000000000..32263cd56ee --- /dev/null +++ b/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-both-are-structs-2.base.stderr @@ -0,0 +1,11 @@ +error[E0623]: lifetime mismatch + --> $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... +LL | x.b = y.b; + | ^^^ ...but data from `y` flows into `x` here + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0623`. 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 4c0ffe5c090..bfde4025194 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 94bb8092407..30764e2ad17 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-2.stderr b/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-both-are-structs-2.stderr deleted file mode 100644 index 8e41d7c54e6..00000000000 --- a/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-both-are-structs-2.stderr +++ /dev/null @@ -1,11 +0,0 @@ -error[E0623]: lifetime mismatch - --> $DIR/ex3-both-anon-regions-both-are-structs-2.rs:7:11 - | -LL | fn foo(mut x: Ref, y: Ref) { - | --- --- these two types are declared with different lifetimes... -LL | x.b = y.b; - | ^^^ ...but data from `y` flows into `x` here - -error: aborting due to previous error - -For more information about this error, try `rustc --explain E0623`. diff --git a/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-both-are-structs-3.base.stderr b/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-both-are-structs-3.base.stderr new file mode 100644 index 00000000000..fb4a2f8f6fe --- /dev/null +++ b/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-both-are-structs-3.base.stderr @@ -0,0 +1,11 @@ +error[E0623]: lifetime mismatch + --> $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... +LL | x.a = x.b; + | ^^^ ...but data with one lifetime flows into the other here + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0623`. 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 97c665347f6..9ba2c38d6fe 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 3b22aef6f32..665be2aa2c8 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-3.stderr b/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-both-are-structs-3.stderr deleted file mode 100644 index d659c88f69e..00000000000 --- a/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-both-are-structs-3.stderr +++ /dev/null @@ -1,11 +0,0 @@ -error[E0623]: lifetime mismatch - --> $DIR/ex3-both-anon-regions-both-are-structs-3.rs:7:11 - | -LL | fn foo(mut x: Ref) { - | --- this type is declared with multiple lifetimes... -LL | x.a = x.b; - | ^^^ ...but data with one lifetime flows into the other here - -error: aborting due to previous error - -For more information about this error, try `rustc --explain E0623`. diff --git a/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-both-are-structs-earlybound-regions.base.stderr b/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-both-are-structs-earlybound-regions.base.stderr new file mode 100644 index 00000000000..66a993e0340 --- /dev/null +++ b/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-both-are-structs-earlybound-regions.base.stderr @@ -0,0 +1,12 @@ +error[E0623]: lifetime mismatch + --> $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... +... +LL | x.push(y); + | ^ ...but data from `y` flows into `x` here + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0623`. 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 b3d0bc2b882..ddf878ba9f9 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 87f9cc17726..6e151879f4d 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-earlybound-regions.stderr b/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-both-are-structs-earlybound-regions.stderr deleted file mode 100644 index 374bbd93d08..00000000000 --- a/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-both-are-structs-earlybound-regions.stderr +++ /dev/null @@ -1,12 +0,0 @@ -error[E0623]: lifetime mismatch - --> $DIR/ex3-both-anon-regions-both-are-structs-earlybound-regions.rs:9:12 - | -LL | fn foo<'a, 'b>(mut x: Vec>, y: Ref<'b>) - | ------- ------- these two types are declared with different lifetimes... -... -LL | x.push(y); - | ^ ...but data from `y` flows into `x` here - -error: aborting due to previous error - -For more information about this error, try `rustc --explain E0623`. diff --git a/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-both-are-structs-latebound-regions.base.stderr b/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-both-are-structs-latebound-regions.base.stderr new file mode 100644 index 00000000000..5453dbb08f1 --- /dev/null +++ b/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-both-are-structs-latebound-regions.base.stderr @@ -0,0 +1,11 @@ +error[E0623]: lifetime mismatch + --> $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... +LL | x.push(y); + | ^ ...but data from `y` flows into `x` here + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0623`. 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 fbe98a4263e..cfd3186c809 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 4be76c2a0da..ecc04fbc8ad 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-latebound-regions.stderr b/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-both-are-structs-latebound-regions.stderr deleted file mode 100644 index 94798d1ce2a..00000000000 --- a/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-both-are-structs-latebound-regions.stderr +++ /dev/null @@ -1,11 +0,0 @@ -error[E0623]: lifetime mismatch - --> $DIR/ex3-both-anon-regions-both-are-structs-latebound-regions.rs:6:12 - | -LL | fn foo<'a, 'b>(mut x: Vec>, y: Ref<'b>) { - | ------- ------- these two types are declared with different lifetimes... -LL | x.push(y); - | ^ ...but data from `y` flows into `x` here - -error: aborting due to previous error - -For more information about this error, try `rustc --explain E0623`. diff --git a/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-both-are-structs.base.stderr b/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-both-are-structs.base.stderr new file mode 100644 index 00000000000..23e752e4a0e --- /dev/null +++ b/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-both-are-structs.base.stderr @@ -0,0 +1,11 @@ +error[E0623]: lifetime mismatch + --> $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... +LL | x.push(y); + | ^ ...but data from `y` flows into `x` here + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0623`. 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 9630729d0ee..fa906a90ccc 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 8fbb405a23d..f002dfc208f 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-both-are-structs.stderr b/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-both-are-structs.stderr deleted file mode 100644 index 9f5a79ed333..00000000000 --- a/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-both-are-structs.stderr +++ /dev/null @@ -1,11 +0,0 @@ -error[E0623]: lifetime mismatch - --> $DIR/ex3-both-anon-regions-both-are-structs.rs:6:12 - | -LL | fn foo(mut x: Vec, y: Ref) { - | --- --- these two types are declared with different lifetimes... -LL | x.push(y); - | ^ ...but data from `y` flows into `x` here - -error: aborting due to previous error - -For more information about this error, try `rustc --explain E0623`. diff --git a/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-latebound-regions.base.stderr b/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-latebound-regions.base.stderr new file mode 100644 index 00000000000..b5fbc091ebc --- /dev/null +++ b/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-latebound-regions.base.stderr @@ -0,0 +1,11 @@ +error[E0623]: lifetime mismatch + --> $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... +LL | x.push(y); + | ^ ...but data from `y` flows into `x` here + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0623`. 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 1e24032fc1c..d59bee08748 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 7938d11a905..f0a81eba412 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-latebound-regions.stderr b/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-latebound-regions.stderr deleted file mode 100644 index 2c87f8dbd2c..00000000000 --- a/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-latebound-regions.stderr +++ /dev/null @@ -1,11 +0,0 @@ -error[E0623]: lifetime mismatch - --> $DIR/ex3-both-anon-regions-latebound-regions.rs:2:12 - | -LL | fn foo<'a,'b>(x: &mut Vec<&'a u8>, y: &'b u8) { - | ------ ------ these two types are declared with different lifetimes... -LL | x.push(y); - | ^ ...but data from `y` flows into `x` here - -error: aborting due to previous error - -For more information about this error, try `rustc --explain E0623`. diff --git a/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-one-is-struct-2.base.stderr b/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-one-is-struct-2.base.stderr new file mode 100644 index 00000000000..3d9138f02c6 --- /dev/null +++ b/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-one-is-struct-2.base.stderr @@ -0,0 +1,13 @@ +error[E0623]: lifetime mismatch + --> $DIR/ex3-both-anon-regions-one-is-struct-2.rs:8:9 + | +LL | fn foo(mut x: Ref, y: &u32) { + | --- ---- + | | + | these two types are declared with different lifetimes... +LL | y = x.b; + | ^^^ ...but data from `x` flows into `y` here + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0623`. 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 bbd62902d9f..cac2a9470a8 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 1e6425cf5ca..31ef28e726d 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-2.stderr b/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-one-is-struct-2.stderr deleted file mode 100644 index 60b92ed2b32..00000000000 --- a/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-one-is-struct-2.stderr +++ /dev/null @@ -1,13 +0,0 @@ -error[E0623]: lifetime mismatch - --> $DIR/ex3-both-anon-regions-one-is-struct-2.rs:4:9 - | -LL | fn foo(mut x: Ref, y: &u32) { - | --- ---- - | | - | these two types are declared with different lifetimes... -LL | y = x.b; - | ^^^ ...but data from `x` flows into `y` here - -error: aborting due to previous error - -For more information about this error, try `rustc --explain E0623`. diff --git a/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-one-is-struct-3.base.stderr b/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-one-is-struct-3.base.stderr new file mode 100644 index 00000000000..77e035562a8 --- /dev/null +++ b/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-one-is-struct-3.base.stderr @@ -0,0 +1,11 @@ +error[E0623]: lifetime mismatch + --> $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... +LL | y.b = x; + | ^ ...but data from `x` flows into `y` here + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0623`. 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 79e7e8e157d..ba41cc3e908 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 02838362c80..9a5ac0a9769 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-3.stderr b/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-one-is-struct-3.stderr deleted file mode 100644 index a220c8ddb2b..00000000000 --- a/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-one-is-struct-3.stderr +++ /dev/null @@ -1,11 +0,0 @@ -error[E0623]: lifetime mismatch - --> $DIR/ex3-both-anon-regions-one-is-struct-3.rs:4:11 - | -LL | fn foo(mut y: Ref, x: &u32) { - | --- ---- these two types are declared with different lifetimes... -LL | y.b = x; - | ^ ...but data from `x` flows into `y` here - -error: aborting due to previous error - -For more information about this error, try `rustc --explain E0623`. diff --git a/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-one-is-struct-4.base.stderr b/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-one-is-struct-4.base.stderr new file mode 100644 index 00000000000..6cbbabb150a --- /dev/null +++ b/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-one-is-struct-4.base.stderr @@ -0,0 +1,11 @@ +error[E0623]: lifetime mismatch + --> $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... +LL | y.b = x; + | ^ ...but data from `x` flows into `y` here + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0623`. 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 53615fd1aba..c9570aa7206 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 02838362c80..9a5ac0a9769 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-4.stderr b/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-one-is-struct-4.stderr deleted file mode 100644 index 73472a8d022..00000000000 --- a/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-one-is-struct-4.stderr +++ /dev/null @@ -1,11 +0,0 @@ -error[E0623]: lifetime mismatch - --> $DIR/ex3-both-anon-regions-one-is-struct-4.rs:4:11 - | -LL | fn foo(mut y: Ref, x: &u32) { - | --- ---- these two types are declared with different lifetimes... -LL | y.b = x; - | ^ ...but data from `x` flows into `y` here - -error: aborting due to previous error - -For more information about this error, try `rustc --explain E0623`. diff --git a/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-one-is-struct.base.stderr b/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-one-is-struct.base.stderr new file mode 100644 index 00000000000..7caf19e8935 --- /dev/null +++ b/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-one-is-struct.base.stderr @@ -0,0 +1,11 @@ +error[E0623]: lifetime mismatch + --> $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... +LL | x.b = y; + | ^ ...but data from `y` flows into `x` here + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0623`. 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 6ff44116737..9b295248fc9 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 7c827510be8..0b4ee5adacc 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-one-is-struct.stderr b/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-one-is-struct.stderr deleted file mode 100644 index eb6e6f2e95e..00000000000 --- a/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-one-is-struct.stderr +++ /dev/null @@ -1,11 +0,0 @@ -error[E0623]: lifetime mismatch - --> $DIR/ex3-both-anon-regions-one-is-struct.rs:7:11 - | -LL | fn foo(mut x: Ref, y: &u32) { - | --- ---- these two types are declared with different lifetimes... -LL | x.b = y; - | ^ ...but data from `y` flows into `x` here - -error: aborting due to previous error - -For more information about this error, try `rustc --explain E0623`. diff --git a/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-return-type-is-anon.base.stderr b/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-return-type-is-anon.base.stderr new file mode 100644 index 00000000000..add05a11193 --- /dev/null +++ b/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-return-type-is-anon.base.stderr @@ -0,0 +1,19 @@ +error[E0623]: lifetime mismatch + --> $DIR/ex3-both-anon-regions-return-type-is-anon.rs:11:5 + | +LL | fn foo<'a>(&self, x: &i32) -> &i32 { + | ---- ---- + | | + | this parameter and the return type are declared with different lifetimes... +LL | x + | ^ ...but data from `x` is returned here + | + = note: each elided lifetime in input position becomes a distinct lifetime +help: consider introducing a named lifetime parameter and update trait if needed + | +LL | fn foo<'a>(&'a self, x: &'a i32) -> &i32 { + | ++ ++ + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0623`. 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 5601335d275..188ff4d77e0 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 286cb6dc90e..a4f838c0747 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-return-type-is-anon.stderr b/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-return-type-is-anon.stderr deleted file mode 100644 index 636904aefb4..00000000000 --- a/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-return-type-is-anon.stderr +++ /dev/null @@ -1,19 +0,0 @@ -error[E0623]: lifetime mismatch - --> $DIR/ex3-both-anon-regions-return-type-is-anon.rs:7:5 - | -LL | fn foo<'a>(&self, x: &i32) -> &i32 { - | ---- ---- - | | - | this parameter and the return type are declared with different lifetimes... -LL | x - | ^ ...but data from `x` is returned here - | - = note: each elided lifetime in input position becomes a distinct lifetime -help: consider introducing a named lifetime parameter and update trait if needed - | -LL | fn foo<'a>(&'a self, x: &'a i32) -> &i32 { - | ++ ++ - -error: aborting due to previous error - -For more information about this error, try `rustc --explain E0623`. diff --git a/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-self-is-anon.base.stderr b/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-self-is-anon.base.stderr new file mode 100644 index 00000000000..365a0ab3b10 --- /dev/null +++ b/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-self-is-anon.base.stderr @@ -0,0 +1,19 @@ +error[E0623]: lifetime mismatch + --> $DIR/ex3-both-anon-regions-self-is-anon.rs:11:19 + | +LL | fn foo<'a>(&self, x: &Foo) -> &Foo { + | ---- ---- + | | + | this parameter and the return type are declared with different lifetimes... +LL | if true { x } else { self } + | ^ ...but data from `x` is returned here + | + = note: each elided lifetime in input position becomes a distinct lifetime +help: consider introducing a named lifetime parameter and update trait if needed + | +LL | fn foo<'a>(&'a self, x: &'a Foo) -> &Foo { + | ++ ++ + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0623`. 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 e221902c4a9..ed9b81f7d01 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 79d7d63c8bb..c5854537a5f 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-self-is-anon.stderr b/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-self-is-anon.stderr deleted file mode 100644 index 474eadb7f92..00000000000 --- a/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-self-is-anon.stderr +++ /dev/null @@ -1,19 +0,0 @@ -error[E0623]: lifetime mismatch - --> $DIR/ex3-both-anon-regions-self-is-anon.rs:7:19 - | -LL | fn foo<'a>(&self, x: &Foo) -> &Foo { - | ---- ---- - | | - | this parameter and the return type are declared with different lifetimes... -LL | if true { x } else { self } - | ^ ...but data from `x` is returned here - | - = note: each elided lifetime in input position becomes a distinct lifetime -help: consider introducing a named lifetime parameter and update trait if needed - | -LL | fn foo<'a>(&'a self, x: &'a Foo) -> &Foo { - | ++ ++ - -error: aborting due to previous error - -For more information about this error, try `rustc --explain E0623`. diff --git a/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-using-fn-items.base.stderr b/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-using-fn-items.base.stderr new file mode 100644 index 00000000000..755e9798170 --- /dev/null +++ b/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-using-fn-items.base.stderr @@ -0,0 +1,17 @@ +error[E0623]: lifetime mismatch + --> $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... +LL | y.push(z); + | ^ ...but data from `z` flows into `y` here + | + = note: each elided lifetime in input position becomes a distinct lifetime +help: consider introducing a named lifetime parameter + | +LL | fn foo<'a>(x:fn(&u8, &u8), y: Vec<&'a u8>, z: &'a u8) { + | ++++ ++ ++ + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0623`. 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 a909c5fa823..904a09610fc 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 f9f1a75df58..4b2280b66f2 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-fn-items.stderr b/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-using-fn-items.stderr deleted file mode 100644 index 6ed3528bb9f..00000000000 --- a/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-using-fn-items.stderr +++ /dev/null @@ -1,17 +0,0 @@ -error[E0623]: lifetime mismatch - --> $DIR/ex3-both-anon-regions-using-fn-items.rs:2:10 - | -LL | fn foo(x:fn(&u8, &u8), y: Vec<&u8>, z: &u8) { - | --- --- these two types are declared with different lifetimes... -LL | y.push(z); - | ^ ...but data from `z` flows into `y` here - | - = note: each elided lifetime in input position becomes a distinct lifetime -help: consider introducing a named lifetime parameter - | -LL | fn foo<'a>(x:fn(&u8, &u8), y: Vec<&'a u8>, z: &'a u8) { - | ++++ ++ ++ - -error: aborting due to previous error - -For more information about this error, try `rustc --explain E0623`. diff --git a/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-using-impl-items.base.stderr b/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-using-impl-items.base.stderr new file mode 100644 index 00000000000..6a8b07dbec8 --- /dev/null +++ b/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-using-impl-items.base.stderr @@ -0,0 +1,17 @@ +error[E0623]: lifetime mismatch + --> $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... +LL | x.push(y); + | ^ ...but data from `y` flows into `x` here + | + = note: each elided lifetime in input position becomes a distinct lifetime +help: consider introducing a named lifetime parameter and update trait if needed + | +LL | fn foo<'a>(x: &mut Vec<&'a u8>, y: &'a u8) { + | ++++ ++ ++ + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0623`. 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 9661f1e5144..46b9e98907d 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 6f95d5a710d..242a2d6fd4f 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-impl-items.stderr b/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-using-impl-items.stderr deleted file mode 100644 index 68893781dc2..00000000000 --- a/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-using-impl-items.stderr +++ /dev/null @@ -1,17 +0,0 @@ -error[E0623]: lifetime mismatch - --> $DIR/ex3-both-anon-regions-using-impl-items.rs:6:16 - | -LL | fn foo(x: &mut Vec<&u8>, y: &u8) { - | --- --- these two types are declared with different lifetimes... -LL | x.push(y); - | ^ ...but data from `y` flows into `x` here - | - = note: each elided lifetime in input position becomes a distinct lifetime -help: consider introducing a named lifetime parameter and update trait if needed - | -LL | fn foo<'a>(x: &mut Vec<&'a u8>, y: &'a u8) { - | ++++ ++ ++ - -error: aborting due to previous error - -For more information about this error, try `rustc --explain E0623`. diff --git a/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-using-trait-objects.base.stderr b/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-using-trait-objects.base.stderr new file mode 100644 index 00000000000..e38dd0fc6ee --- /dev/null +++ b/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-using-trait-objects.base.stderr @@ -0,0 +1,17 @@ +error[E0623]: lifetime mismatch + --> $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... +LL | y.push(z); + | ^ ...but data from `z` flows into `y` here + | + = note: each elided lifetime in input position becomes a distinct lifetime +help: consider introducing a named lifetime parameter + | +LL | fn foo<'a>(x:Box , y: Vec<&u8>, z: &u8) { + | ++++ ++ ++ + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0623`. 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 cce0a31bfbb..54172a845d7 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 6625d41c7de..b93d75b156d 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-using-trait-objects.stderr b/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-using-trait-objects.stderr deleted file mode 100644 index ede1631db27..00000000000 --- a/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-using-trait-objects.stderr +++ /dev/null @@ -1,17 +0,0 @@ -error[E0623]: lifetime mismatch - --> $DIR/ex3-both-anon-regions-using-trait-objects.rs:2:10 - | -LL | fn foo(x:Box , y: Vec<&u8>, z: &u8) { - | --- --- these two types are declared with different lifetimes... -LL | y.push(z); - | ^ ...but data from `z` flows into `y` here - | - = note: each elided lifetime in input position becomes a distinct lifetime -help: consider introducing a named lifetime parameter - | -LL | fn foo<'a>(x:Box , y: Vec<&u8>, z: &u8) { - | ++++ ++ ++ - -error: aborting due to previous error - -For more information about this error, try `rustc --explain E0623`. diff --git a/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions.base.stderr b/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions.base.stderr new file mode 100644 index 00000000000..dd96c6eef68 --- /dev/null +++ b/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions.base.stderr @@ -0,0 +1,17 @@ +error[E0623]: lifetime mismatch + --> $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... +LL | x.push(y); + | ^ ...but data from `y` flows into `x` here + | + = note: each elided lifetime in input position becomes a distinct lifetime +help: consider introducing a named lifetime parameter + | +LL | fn foo<'a>(x: &mut Vec<&'a u8>, y: &'a u8) { + | ++++ ++ ++ + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0623`. 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 ec9fac0c288..48e09e37241 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 44195dadbb9..b1d30e83b62 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/ex3-both-anon-regions.stderr b/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions.stderr deleted file mode 100644 index cf405c0de3f..00000000000 --- a/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions.stderr +++ /dev/null @@ -1,17 +0,0 @@ -error[E0623]: lifetime mismatch - --> $DIR/ex3-both-anon-regions.rs:2:12 - | -LL | fn foo(x: &mut Vec<&u8>, y: &u8) { - | --- --- these two types are declared with different lifetimes... -LL | x.push(y); - | ^ ...but data from `y` flows into `x` here - | - = note: each elided lifetime in input position becomes a distinct lifetime -help: consider introducing a named lifetime parameter - | -LL | fn foo<'a>(x: &mut Vec<&'a u8>, y: &'a u8) { - | ++++ ++ ++ - -error: aborting due to previous error - -For more information about this error, try `rustc --explain E0623`. diff --git a/src/test/ui/lifetimes/lifetime-errors/issue_74400.base.stderr b/src/test/ui/lifetimes/lifetime-errors/issue_74400.base.stderr new file mode 100644 index 00000000000..ba672f29718 --- /dev/null +++ b/src/test/ui/lifetimes/lifetime-errors/issue_74400.base.stderr @@ -0,0 +1,11 @@ +error: implementation of `FnOnce` is not general enough + --> $DIR/issue_74400.rs:16:5 + | +LL | f(data, identity) + | ^ implementation of `FnOnce` is not general enough + | + = note: `fn(&'2 T) -> &'2 T {identity::<&'2 T>}` must implement `FnOnce<(&'1 T,)>`, for any lifetime `'1`... + = note: ...but it actually implements `FnOnce<(&'2 T,)>`, for some specific lifetime `'2` + +error: aborting due to previous error + 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 2906c05864b..645d14cd54b 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 f83384524f7..fdaf2f8a591 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/lifetime-errors/issue_74400.stderr b/src/test/ui/lifetimes/lifetime-errors/issue_74400.stderr deleted file mode 100644 index d972861a2b5..00000000000 --- a/src/test/ui/lifetimes/lifetime-errors/issue_74400.stderr +++ /dev/null @@ -1,11 +0,0 @@ -error: implementation of `FnOnce` is not general enough - --> $DIR/issue_74400.rs:12:5 - | -LL | f(data, identity) - | ^ implementation of `FnOnce` is not general enough - | - = note: `fn(&'2 T) -> &'2 T {identity::<&'2 T>}` must implement `FnOnce<(&'1 T,)>`, for any lifetime `'1`... - = note: ...but it actually implements `FnOnce<(&'2 T,)>`, for some specific lifetime `'2` - -error: aborting due to previous error - diff --git a/src/test/ui/lifetimes/re-empty-in-error.base.stderr b/src/test/ui/lifetimes/re-empty-in-error.base.stderr new file mode 100644 index 00000000000..7dfe23f4f01 --- /dev/null +++ b/src/test/ui/lifetimes/re-empty-in-error.base.stderr @@ -0,0 +1,15 @@ +error[E0477]: the type `&'b ()` does not fulfill the required lifetime + --> $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:7:47 + | +LL | fn foo<'a>(_a: &'a u32) where for<'b> &'b (): 'a { + | ^^ + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0477`. 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 9becdab9186..cddb5732f98 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 41c3718592d..fdb0a3002c4 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 } diff --git a/src/test/ui/lifetimes/re-empty-in-error.stderr b/src/test/ui/lifetimes/re-empty-in-error.stderr deleted file mode 100644 index 227e3ca6139..00000000000 --- a/src/test/ui/lifetimes/re-empty-in-error.stderr +++ /dev/null @@ -1,15 +0,0 @@ -error[E0477]: the type `&'b ()` does not fulfill the required lifetime - --> $DIR/re-empty-in-error.rs:8:5 - | -LL | foo(&10); - | ^^^ - | -note: type must outlive the empty lifetime as required by this binding - --> $DIR/re-empty-in-error.rs:3:47 - | -LL | fn foo<'a>(_a: &'a u32) where for<'b> &'b (): 'a { - | ^^ - -error: aborting due to previous error - -For more information about this error, try `rustc --explain E0477`. -- cgit 1.4.1-3-g733a5