From cc97875d26c21230a75f9537e379501a2145911d Mon Sep 17 00:00:00 2001 From: Jack Huey <31162821+jackh726@users.noreply.github.com> Date: Sat, 21 May 2022 13:42:16 -0400 Subject: [PATCH] Use revisions for NLL in nll --- src/test/ui/hrtb/hrtb-exists-forall-fn.nll.stderr | 12 ------------ ...tderr => continue-after-missing-main.base.stderr} | 4 ++-- .../ui/nll/continue-after-missing-main.nll.stderr | 2 +- src/test/ui/nll/continue-after-missing-main.rs | 6 +++++- .../{issue-52213.stderr => issue-52213.base.stderr} | 10 +++++----- src/test/ui/nll/issue-52213.nll.stderr | 4 ++-- src/test/ui/nll/issue-52213.rs | 8 +++++++- ...ssue-52533-1.stderr => issue-52533-1.base.stderr} | 6 +++--- src/test/ui/nll/issue-52533-1.nll.stderr | 2 +- src/test/ui/nll/issue-52533-1.rs | 7 ++++++- src/test/ui/nll/lint-no-err.rs | 5 ----- ...jection-where-clause-env-wrong-bound.base.stderr} | 4 ++-- ...rojection-where-clause-env-wrong-bound.nll.stderr | 2 +- .../projection-where-clause-env-wrong-bound.rs | 4 ++++ ...tion-where-clause-env-wrong-lifetime.base.stderr} | 4 ++-- ...ection-where-clause-env-wrong-lifetime.nll.stderr | 2 +- .../projection-where-clause-env-wrong-lifetime.rs | 7 ++++++- 17 files changed, 48 insertions(+), 41 deletions(-) delete mode 100644 src/test/ui/hrtb/hrtb-exists-forall-fn.nll.stderr rename src/test/ui/nll/{continue-after-missing-main.stderr => continue-after-missing-main.base.stderr} (90%) rename src/test/ui/nll/{issue-52213.stderr => issue-52213.base.stderr} (84%) rename src/test/ui/nll/{issue-52533-1.stderr => issue-52533-1.base.stderr} (84%) rename src/test/ui/nll/ty-outlives/{projection-where-clause-env-wrong-bound.stderr => projection-where-clause-env-wrong-bound.base.stderr} (81%) rename src/test/ui/nll/ty-outlives/{projection-where-clause-env-wrong-lifetime.stderr => projection-where-clause-env-wrong-lifetime.base.stderr} (81%) diff --git a/src/test/ui/hrtb/hrtb-exists-forall-fn.nll.stderr b/src/test/ui/hrtb/hrtb-exists-forall-fn.nll.stderr deleted file mode 100644 index 9914783d976..00000000000 --- a/src/test/ui/hrtb/hrtb-exists-forall-fn.nll.stderr +++ /dev/null @@ -1,12 +0,0 @@ -error[E0308]: mismatched types - --> $DIR/hrtb-exists-forall-fn.rs:17:34 - | -LL | let _: for<'b> fn(&'b u32) = foo(); - | ^^^^^ one type is more general than the other - | - = note: expected fn pointer `for<'b> fn(&'b u32)` - found fn pointer `fn(&u32)` - -error: aborting due to previous error - -For more information about this error, try `rustc --explain E0308`. diff --git a/src/test/ui/nll/continue-after-missing-main.stderr b/src/test/ui/nll/continue-after-missing-main.base.stderr similarity index 90% rename from src/test/ui/nll/continue-after-missing-main.stderr rename to src/test/ui/nll/continue-after-missing-main.base.stderr index 29e7dc1e56c..9d1fa66813d 100644 --- a/src/test/ui/nll/continue-after-missing-main.stderr +++ b/src/test/ui/nll/continue-after-missing-main.base.stderr @@ -1,11 +1,11 @@ error[E0601]: `main` function not found in crate `continue_after_missing_main` - --> $DIR/continue-after-missing-main.rs:30:2 + --> $DIR/continue-after-missing-main.rs:34:2 | LL | } | ^ consider adding a `main` function to `$DIR/continue-after-missing-main.rs` error[E0623]: lifetime mismatch - --> $DIR/continue-after-missing-main.rs:28:56 + --> $DIR/continue-after-missing-main.rs:32:56 | LL | tableau: Tableau<'data_provider, AdaptedMatrixProvider<'original_data, MP>>, | ------------------------------------------------------------------ these two types are declared with different lifetimes... diff --git a/src/test/ui/nll/continue-after-missing-main.nll.stderr b/src/test/ui/nll/continue-after-missing-main.nll.stderr index ebebabe349b..2bad3be8b4e 100644 --- a/src/test/ui/nll/continue-after-missing-main.nll.stderr +++ b/src/test/ui/nll/continue-after-missing-main.nll.stderr @@ -1,5 +1,5 @@ error[E0601]: `main` function not found in crate `continue_after_missing_main` - --> $DIR/continue-after-missing-main.rs:30:2 + --> $DIR/continue-after-missing-main.rs:34:2 | LL | } | ^ consider adding a `main` function to `$DIR/continue-after-missing-main.rs` diff --git a/src/test/ui/nll/continue-after-missing-main.rs b/src/test/ui/nll/continue-after-missing-main.rs index 1019cacce64..ddead7dc233 100644 --- a/src/test/ui/nll/continue-after-missing-main.rs +++ b/src/test/ui/nll/continue-after-missing-main.rs @@ -1,3 +1,7 @@ +// ignore-compare-mode-nll +// revisions: base nll +// [nll]compile-flags: -Zborrowck=mir + #![allow(dead_code)] struct Tableau<'a, MP> { @@ -26,5 +30,5 @@ fn create_and_solve_subproblems<'data_provider, 'original_data, MP>( tableau: Tableau<'data_provider, AdaptedMatrixProvider<'original_data, MP>>, ) { let _: AdaptedMatrixProvider<'original_data, MP> = tableau.provider().clone_with_extra_bound(); - //~^ ERROR lifetime mismatch + //[base]~^ ERROR lifetime mismatch } //~ ERROR `main` function not found in crate diff --git a/src/test/ui/nll/issue-52213.stderr b/src/test/ui/nll/issue-52213.base.stderr similarity index 84% rename from src/test/ui/nll/issue-52213.stderr rename to src/test/ui/nll/issue-52213.base.stderr index aef5e258a1b..fb758ca17a8 100644 --- a/src/test/ui/nll/issue-52213.stderr +++ b/src/test/ui/nll/issue-52213.base.stderr @@ -1,28 +1,28 @@ error[E0495]: cannot infer an appropriate lifetime due to conflicting requirements - --> $DIR/issue-52213.rs:2:11 + --> $DIR/issue-52213.rs:6:11 | LL | match (&t,) { | ^^^^^ | note: first, the lifetime cannot outlive the lifetime `'a` as defined here... - --> $DIR/issue-52213.rs:1:23 + --> $DIR/issue-52213.rs:5:23 | LL | fn transmute_lifetime<'a, 'b, T>(t: &'a (T,)) -> &'b T { | ^^ note: ...so that the types are compatible - --> $DIR/issue-52213.rs:2:11 + --> $DIR/issue-52213.rs:6:11 | LL | match (&t,) { | ^^^^^ = note: expected `(&&(T,),)` found `(&&'a (T,),)` note: but, the lifetime must be valid for the lifetime `'b` as defined here... - --> $DIR/issue-52213.rs:1:27 + --> $DIR/issue-52213.rs:5:27 | LL | fn transmute_lifetime<'a, 'b, T>(t: &'a (T,)) -> &'b T { | ^^ note: ...so that reference does not outlive borrowed content - --> $DIR/issue-52213.rs:3:20 + --> $DIR/issue-52213.rs:8:20 | LL | ((u,),) => u, | ^ diff --git a/src/test/ui/nll/issue-52213.nll.stderr b/src/test/ui/nll/issue-52213.nll.stderr index da31bcd5475..a7553de6910 100644 --- a/src/test/ui/nll/issue-52213.nll.stderr +++ b/src/test/ui/nll/issue-52213.nll.stderr @@ -1,11 +1,11 @@ error: lifetime may not live long enough - --> $DIR/issue-52213.rs:3:20 + --> $DIR/issue-52213.rs:8:20 | LL | fn transmute_lifetime<'a, 'b, T>(t: &'a (T,)) -> &'b T { | -- -- lifetime `'b` defined here | | | lifetime `'a` defined here -LL | match (&t,) { +... LL | ((u,),) => u, | ^ function was supposed to return data with lifetime `'b` but it is returning data with lifetime `'a` | diff --git a/src/test/ui/nll/issue-52213.rs b/src/test/ui/nll/issue-52213.rs index c4ce4946b2e..c5918b47f57 100644 --- a/src/test/ui/nll/issue-52213.rs +++ b/src/test/ui/nll/issue-52213.rs @@ -1,6 +1,12 @@ +// ignore-compare-mode-nll +// revisions: base nll +// [nll]compile-flags: -Zborrowck=mir + fn transmute_lifetime<'a, 'b, T>(t: &'a (T,)) -> &'b T { - match (&t,) { //~ ERROR cannot infer an appropriate lifetime + match (&t,) { + //[base]~^ ERROR cannot infer an appropriate lifetime ((u,),) => u, + //[nll]~^ ERROR lifetime may not live long enough } } diff --git a/src/test/ui/nll/issue-52533-1.stderr b/src/test/ui/nll/issue-52533-1.base.stderr similarity index 84% rename from src/test/ui/nll/issue-52533-1.stderr rename to src/test/ui/nll/issue-52533-1.base.stderr index 475c7d0b48b..ddcb01b8f46 100644 --- a/src/test/ui/nll/issue-52533-1.stderr +++ b/src/test/ui/nll/issue-52533-1.base.stderr @@ -1,5 +1,5 @@ error[E0308]: mismatched types - --> $DIR/issue-52533-1.rs:9:18 + --> $DIR/issue-52533-1.rs:13:18 | LL | gimme(|x, y| y) | ^ lifetime mismatch @@ -7,12 +7,12 @@ LL | gimme(|x, y| y) = note: expected reference `&Foo<'_, '_, u32>` found reference `&Foo<'_, '_, u32>` note: the anonymous lifetime #3 defined here... - --> $DIR/issue-52533-1.rs:9:11 + --> $DIR/issue-52533-1.rs:13:11 | LL | gimme(|x, y| y) | ^^^^^^^^ note: ...does not necessarily outlive the anonymous lifetime #2 defined here - --> $DIR/issue-52533-1.rs:9:11 + --> $DIR/issue-52533-1.rs:13:11 | LL | gimme(|x, y| y) | ^^^^^^^^ diff --git a/src/test/ui/nll/issue-52533-1.nll.stderr b/src/test/ui/nll/issue-52533-1.nll.stderr index 20f19b25967..5554339eb7c 100644 --- a/src/test/ui/nll/issue-52533-1.nll.stderr +++ b/src/test/ui/nll/issue-52533-1.nll.stderr @@ -1,5 +1,5 @@ error: lifetime may not live long enough - --> $DIR/issue-52533-1.rs:9:18 + --> $DIR/issue-52533-1.rs:13:18 | LL | gimme(|x, y| y) | - - ^ closure was supposed to return data with lifetime `'2` but it is returning data with lifetime `'1` diff --git a/src/test/ui/nll/issue-52533-1.rs b/src/test/ui/nll/issue-52533-1.rs index c80f43237fc..3ee7dd556a5 100644 --- a/src/test/ui/nll/issue-52533-1.rs +++ b/src/test/ui/nll/issue-52533-1.rs @@ -1,3 +1,7 @@ +// ignore-compare-mode-nll +// revisions: base nll +// [nll]compile-flags: -Zborrowck=mir + #![allow(warnings)] struct Foo<'a, 'b, T: 'a + 'b> { x: &'a T, y: &'b T } @@ -7,5 +11,6 @@ fn gimme(_: impl for<'a, 'b, 'c> FnOnce(&'a Foo<'a, 'b, u32>, fn main() { gimme(|x, y| y) - //~^ ERROR mismatched types [E0308] + //[base]~^ ERROR mismatched types [E0308] + //[nll]~^^ ERROR lifetime may not live long enough } diff --git a/src/test/ui/nll/lint-no-err.rs b/src/test/ui/nll/lint-no-err.rs index f5f7bf0a758..2d1d5cb26d3 100644 --- a/src/test/ui/nll/lint-no-err.rs +++ b/src/test/ui/nll/lint-no-err.rs @@ -4,11 +4,6 @@ // when buffering lints, which resulted in ICE later on, // see #94502. -// Errors with `nll` which is already tested in enough other tests, -// so we ignore it here. -// -// ignore-compare-mode-nll - struct Repro; impl Repro { fn get(&self) -> &i32 { diff --git a/src/test/ui/nll/ty-outlives/projection-where-clause-env-wrong-bound.stderr b/src/test/ui/nll/ty-outlives/projection-where-clause-env-wrong-bound.base.stderr similarity index 81% rename from src/test/ui/nll/ty-outlives/projection-where-clause-env-wrong-bound.stderr rename to src/test/ui/nll/ty-outlives/projection-where-clause-env-wrong-bound.base.stderr index 88253bad194..c7710146ea4 100644 --- a/src/test/ui/nll/ty-outlives/projection-where-clause-env-wrong-bound.stderr +++ b/src/test/ui/nll/ty-outlives/projection-where-clause-env-wrong-bound.base.stderr @@ -1,5 +1,5 @@ error[E0309]: the associated type `>::Output` may not live long enough - --> $DIR/projection-where-clause-env-wrong-bound.rs:15:5 + --> $DIR/projection-where-clause-env-wrong-bound.rs:19:5 | LL | bar::() | ^^^^^^^^^^^^^^^^ @@ -7,7 +7,7 @@ LL | bar::() = help: consider adding an explicit lifetime bound `>::Output: 'a`... = note: ...so that the type `>::Output` will meet its required lifetime bounds... note: ...that is required by this bound - --> $DIR/projection-where-clause-env-wrong-bound.rs:29:8 + --> $DIR/projection-where-clause-env-wrong-bound.rs:33:8 | LL | T: 'a, | ^^ diff --git a/src/test/ui/nll/ty-outlives/projection-where-clause-env-wrong-bound.nll.stderr b/src/test/ui/nll/ty-outlives/projection-where-clause-env-wrong-bound.nll.stderr index b4435fe06bc..d235dee6444 100644 --- a/src/test/ui/nll/ty-outlives/projection-where-clause-env-wrong-bound.nll.stderr +++ b/src/test/ui/nll/ty-outlives/projection-where-clause-env-wrong-bound.nll.stderr @@ -1,5 +1,5 @@ error[E0309]: the associated type `>::Output` may not live long enough - --> $DIR/projection-where-clause-env-wrong-bound.rs:15:5 + --> $DIR/projection-where-clause-env-wrong-bound.rs:19:5 | LL | bar::() | ^^^^^^^^^^^^^^^^ diff --git a/src/test/ui/nll/ty-outlives/projection-where-clause-env-wrong-bound.rs b/src/test/ui/nll/ty-outlives/projection-where-clause-env-wrong-bound.rs index dce88b88c75..22edb22a536 100644 --- a/src/test/ui/nll/ty-outlives/projection-where-clause-env-wrong-bound.rs +++ b/src/test/ui/nll/ty-outlives/projection-where-clause-env-wrong-bound.rs @@ -1,3 +1,7 @@ +// revisions: base nll +// ignore-compare-mode-nll +//[nll] compile-flags: -Z borrowck=mir + // Test that we are able to establish that `>::Output` outlives `'b` here. We need to prove however // that `>::Output` outlives `'a`, so we also have to diff --git a/src/test/ui/nll/ty-outlives/projection-where-clause-env-wrong-lifetime.stderr b/src/test/ui/nll/ty-outlives/projection-where-clause-env-wrong-lifetime.base.stderr similarity index 81% rename from src/test/ui/nll/ty-outlives/projection-where-clause-env-wrong-lifetime.stderr rename to src/test/ui/nll/ty-outlives/projection-where-clause-env-wrong-lifetime.base.stderr index 9f7fc030aa9..c3e2301bd66 100644 --- a/src/test/ui/nll/ty-outlives/projection-where-clause-env-wrong-lifetime.stderr +++ b/src/test/ui/nll/ty-outlives/projection-where-clause-env-wrong-lifetime.base.stderr @@ -1,5 +1,5 @@ error[E0309]: the associated type `>::Output` may not live long enough - --> $DIR/projection-where-clause-env-wrong-lifetime.rs:14:5 + --> $DIR/projection-where-clause-env-wrong-lifetime.rs:18:5 | LL | bar::<>::Output>() | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -7,7 +7,7 @@ LL | bar::<>::Output>() = help: consider adding an explicit lifetime bound `>::Output: 'a`... = note: ...so that the type `>::Output` will meet its required lifetime bounds... note: ...that is required by this bound - --> $DIR/projection-where-clause-env-wrong-lifetime.rs:20:8 + --> $DIR/projection-where-clause-env-wrong-lifetime.rs:25:8 | LL | T: 'a, | ^^ diff --git a/src/test/ui/nll/ty-outlives/projection-where-clause-env-wrong-lifetime.nll.stderr b/src/test/ui/nll/ty-outlives/projection-where-clause-env-wrong-lifetime.nll.stderr index ddeaf3c1f9e..82fe2fad9f7 100644 --- a/src/test/ui/nll/ty-outlives/projection-where-clause-env-wrong-lifetime.nll.stderr +++ b/src/test/ui/nll/ty-outlives/projection-where-clause-env-wrong-lifetime.nll.stderr @@ -1,5 +1,5 @@ error[E0309]: the associated type `>::Output` may not live long enough - --> $DIR/projection-where-clause-env-wrong-lifetime.rs:14:5 + --> $DIR/projection-where-clause-env-wrong-lifetime.rs:18:5 | LL | bar::<>::Output>() | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/src/test/ui/nll/ty-outlives/projection-where-clause-env-wrong-lifetime.rs b/src/test/ui/nll/ty-outlives/projection-where-clause-env-wrong-lifetime.rs index 9e3590ca715..d89b065673b 100644 --- a/src/test/ui/nll/ty-outlives/projection-where-clause-env-wrong-lifetime.rs +++ b/src/test/ui/nll/ty-outlives/projection-where-clause-env-wrong-lifetime.rs @@ -1,3 +1,7 @@ +// revisions: base nll +// ignore-compare-mode-nll +//[nll] compile-flags: -Z borrowck=mir + // Test that if we need to prove that `>::Output: // 'a`, but we only know that `>::Output: 'a`, that // doesn't suffice. @@ -12,7 +16,8 @@ where >::Output: 'a, { bar::<>::Output>() - //~^ ERROR the associated type `>::Output` may not live long enough + //[base]~^ ERROR the associated type `>::Output` may not live long enough + //[nll]~^^ ERROR the associated type `>::Output` may not live long enough } fn bar<'a, T>() -> &'a ()