From 0fbb315be70aaaa19bd38801ad894657332f9fc3 Mon Sep 17 00:00:00 2001 From: Jack Huey <31162821+jackh726@users.noreply.github.com> Date: Sat, 21 May 2022 15:33:42 -0400 Subject: [PATCH] Use revisions or ignore-compare-mode-nll for NLL in generic-associated-types --- .../extended/lending_iterator.base.nll.stderr | 12 ------------ .../extended/lending_iterator.base.stderr | 6 +++--- .../extended/lending_iterator.rs | 2 ++ ...ojection-type-lifetime-mismatch.base.stderr} | 6 +++--- ...projection-type-lifetime-mismatch.nll.stderr | 6 +++--- .../projection-type-lifetime-mismatch.rs | 13 ++++++++++--- .../trait-objects.base.stderr | 4 ++-- .../trait-objects.extended.nll.stderr | 17 ----------------- .../trait-objects.extended.stderr | 2 +- .../generic-associated-types/trait-objects.rs | 2 ++ 10 files changed, 26 insertions(+), 44 deletions(-) delete mode 100644 src/test/ui/generic-associated-types/extended/lending_iterator.base.nll.stderr rename src/test/ui/generic-associated-types/{projection-type-lifetime-mismatch.stderr => projection-type-lifetime-mismatch.base.stderr} (92%) delete mode 100644 src/test/ui/generic-associated-types/trait-objects.extended.nll.stderr diff --git a/src/test/ui/generic-associated-types/extended/lending_iterator.base.nll.stderr b/src/test/ui/generic-associated-types/extended/lending_iterator.base.nll.stderr deleted file mode 100644 index 3da7794b3d2..00000000000 --- a/src/test/ui/generic-associated-types/extended/lending_iterator.base.nll.stderr +++ /dev/null @@ -1,12 +0,0 @@ -error[E0276]: impl has stricter requirements than trait - --> $DIR/lending_iterator.rs:14:45 - | -LL | fn from_iter LendingIterator = A>>(iter: T) -> Self; - | ------------------------------------------------------------------------ definition of `from_iter` from trait -... -LL | fn from_iter LendingIterator = A>>(mut iter: I) -> Self { - | ^^^^^^^^^^^^ impl has extra requirement `I: 'x` - -error: aborting due to previous error - -For more information about this error, try `rustc --explain E0276`. diff --git a/src/test/ui/generic-associated-types/extended/lending_iterator.base.stderr b/src/test/ui/generic-associated-types/extended/lending_iterator.base.stderr index c5588b0912b..aa1e50014fe 100644 --- a/src/test/ui/generic-associated-types/extended/lending_iterator.base.stderr +++ b/src/test/ui/generic-associated-types/extended/lending_iterator.base.stderr @@ -1,5 +1,5 @@ error[E0276]: impl has stricter requirements than trait - --> $DIR/lending_iterator.rs:14:45 + --> $DIR/lending_iterator.rs:16:45 | LL | fn from_iter LendingIterator = A>>(iter: T) -> Self; | ------------------------------------------------------------------------ definition of `from_iter` from trait @@ -8,7 +8,7 @@ LL | fn from_iter LendingIterator = A>>(mut iter: I) -> | ^^^^^^^^^^^^ impl has extra requirement `I: 'x` error[E0311]: the parameter type `Self` may not live long enough - --> $DIR/lending_iterator.rs:35:9 + --> $DIR/lending_iterator.rs:37:9 | LL | >::from_iter(self) | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -16,7 +16,7 @@ LL | >::from_iter(self) = help: consider adding an explicit lifetime bound `Self: 'a`... = note: ...so that the type `Self` will meet its required lifetime bounds... note: ...that is required by this bound - --> $DIR/lending_iterator.rs:10:45 + --> $DIR/lending_iterator.rs:12:45 | LL | fn from_iter LendingIterator = A>>(iter: T) -> Self; | ^^^^^^^^^^^^ diff --git a/src/test/ui/generic-associated-types/extended/lending_iterator.rs b/src/test/ui/generic-associated-types/extended/lending_iterator.rs index df11ab21249..6048e6e87c0 100644 --- a/src/test/ui/generic-associated-types/extended/lending_iterator.rs +++ b/src/test/ui/generic-associated-types/extended/lending_iterator.rs @@ -1,3 +1,5 @@ +// FIXME(nll): this is experimental anyways, don't really care about the output +// ignore-compare-mode-nll // revisions: base extended //[base] check-fail //[extended] check-pass diff --git a/src/test/ui/generic-associated-types/projection-type-lifetime-mismatch.stderr b/src/test/ui/generic-associated-types/projection-type-lifetime-mismatch.base.stderr similarity index 92% rename from src/test/ui/generic-associated-types/projection-type-lifetime-mismatch.stderr rename to src/test/ui/generic-associated-types/projection-type-lifetime-mismatch.base.stderr index 32c5ccf1648..341e2e05d1c 100644 --- a/src/test/ui/generic-associated-types/projection-type-lifetime-mismatch.stderr +++ b/src/test/ui/generic-associated-types/projection-type-lifetime-mismatch.base.stderr @@ -1,5 +1,5 @@ error[E0759]: `x` has an anonymous lifetime `'_` but it needs to satisfy a `'static` lifetime requirement - --> $DIR/projection-type-lifetime-mismatch.rs:17:7 + --> $DIR/projection-type-lifetime-mismatch.rs:21:7 | LL | fn f(x: &impl for<'a> X = &'a ()>) -> &'static () { | ------------------------------- this data with an anonymous lifetime `'_`... @@ -9,7 +9,7 @@ LL | x.m() | ...is used and required to live as long as `'static` here error[E0759]: `x` has an anonymous lifetime `'_` but it needs to satisfy a `'static` lifetime requirement - --> $DIR/projection-type-lifetime-mismatch.rs:22:7 + --> $DIR/projection-type-lifetime-mismatch.rs:27:7 | LL | fn g X = &'a ()>>(x: &T) -> &'static () { | -- this data with an anonymous lifetime `'_`... @@ -19,7 +19,7 @@ LL | x.m() | ...is used and required to live as long as `'static` here error[E0759]: `x` has an anonymous lifetime `'_` but it needs to satisfy a `'static` lifetime requirement - --> $DIR/projection-type-lifetime-mismatch.rs:27:7 + --> $DIR/projection-type-lifetime-mismatch.rs:33:7 | LL | fn h(x: &()) -> &'static () { | --- this data with an anonymous lifetime `'_`... diff --git a/src/test/ui/generic-associated-types/projection-type-lifetime-mismatch.nll.stderr b/src/test/ui/generic-associated-types/projection-type-lifetime-mismatch.nll.stderr index 4620aa34e84..00395af4889 100644 --- a/src/test/ui/generic-associated-types/projection-type-lifetime-mismatch.nll.stderr +++ b/src/test/ui/generic-associated-types/projection-type-lifetime-mismatch.nll.stderr @@ -1,5 +1,5 @@ error: lifetime may not live long enough - --> $DIR/projection-type-lifetime-mismatch.rs:17:5 + --> $DIR/projection-type-lifetime-mismatch.rs:21:5 | LL | fn f(x: &impl for<'a> X = &'a ()>) -> &'static () { | - let's call the lifetime of this reference `'1` @@ -7,7 +7,7 @@ LL | x.m() | ^^^^^ returning this value requires that `'1` must outlive `'static` error: lifetime may not live long enough - --> $DIR/projection-type-lifetime-mismatch.rs:22:5 + --> $DIR/projection-type-lifetime-mismatch.rs:27:5 | LL | fn g X = &'a ()>>(x: &T) -> &'static () { | - let's call the lifetime of this reference `'1` @@ -15,7 +15,7 @@ LL | x.m() | ^^^^^ returning this value requires that `'1` must outlive `'static` error: lifetime may not live long enough - --> $DIR/projection-type-lifetime-mismatch.rs:27:5 + --> $DIR/projection-type-lifetime-mismatch.rs:33:5 | LL | fn h(x: &()) -> &'static () { | - let's call the lifetime of this reference `'1` diff --git a/src/test/ui/generic-associated-types/projection-type-lifetime-mismatch.rs b/src/test/ui/generic-associated-types/projection-type-lifetime-mismatch.rs index 9b04fe23320..9f14c6f3dc0 100644 --- a/src/test/ui/generic-associated-types/projection-type-lifetime-mismatch.rs +++ b/src/test/ui/generic-associated-types/projection-type-lifetime-mismatch.rs @@ -1,3 +1,7 @@ +// ignore-compare-mode-nll +// revisions: base nll +// [nll]compile-flags: -Zborrowck=mir + #![feature(generic_associated_types)] pub trait X { @@ -15,17 +19,20 @@ impl X for () { fn f(x: &impl for<'a> X = &'a ()>) -> &'static () { x.m() - //~^ ERROR `x` has an anonymous lifetime `'_` but it needs to satisfy a `'static` lifetime requirement [E0759] + //[base]~^ ERROR `x` has an anonymous lifetime `'_` but it needs to satisfy a `'static` lifetime requirement [E0759] + //[nll]~^^ ERROR lifetime may not live long enough } fn g X = &'a ()>>(x: &T) -> &'static () { x.m() - //~^ ERROR `x` has an anonymous lifetime `'_` but it needs to satisfy a `'static` lifetime requirement [E0759] + //[base]~^ ERROR `x` has an anonymous lifetime `'_` but it needs to satisfy a `'static` lifetime requirement [E0759] + //[nll]~^^ ERROR lifetime may not live long enough } fn h(x: &()) -> &'static () { x.m() - //~^ ERROR `x` has an anonymous lifetime `'_` but it needs to satisfy a `'static` lifetime requirement [E0759] + //[base]~^ ERROR `x` has an anonymous lifetime `'_` but it needs to satisfy a `'static` lifetime requirement [E0759] + //[nll]~^^ ERROR lifetime may not live long enough } fn main() { diff --git a/src/test/ui/generic-associated-types/trait-objects.base.stderr b/src/test/ui/generic-associated-types/trait-objects.base.stderr index 1df76a21bf9..eed12f56be2 100644 --- a/src/test/ui/generic-associated-types/trait-objects.base.stderr +++ b/src/test/ui/generic-associated-types/trait-objects.base.stderr @@ -1,11 +1,11 @@ error[E0038]: the trait `StreamingIterator` cannot be made into an object - --> $DIR/trait-objects.rs:14:21 + --> $DIR/trait-objects.rs:16:21 | LL | fn min_size(x: &mut dyn for<'a> StreamingIterator = &'a i32>) -> usize { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `StreamingIterator` cannot be made into an object | note: for a trait to be "object safe" it needs to allow building a vtable to allow the call to be resolvable dynamically; for more information visit - --> $DIR/trait-objects.rs:8:10 + --> $DIR/trait-objects.rs:10:10 | LL | trait StreamingIterator { | ----------------- this trait cannot be made into an object... diff --git a/src/test/ui/generic-associated-types/trait-objects.extended.nll.stderr b/src/test/ui/generic-associated-types/trait-objects.extended.nll.stderr deleted file mode 100644 index 52d48d57859..00000000000 --- a/src/test/ui/generic-associated-types/trait-objects.extended.nll.stderr +++ /dev/null @@ -1,17 +0,0 @@ -error[E0521]: borrowed data escapes outside of function - --> $DIR/trait-objects.rs:16:5 - | -LL | fn min_size(x: &mut dyn for<'a> StreamingIterator = &'a i32>) -> usize { - | - - let's call the lifetime of this reference `'1` - | | - | `x` is a reference that is only valid in the function body -LL | -LL | x.size_hint().0 - | ^^^^^^^^^^^^^ - | | - | `x` escapes the function body here - | argument requires that `'1` must outlive `'static` - -error: aborting due to previous error - -For more information about this error, try `rustc --explain E0521`. diff --git a/src/test/ui/generic-associated-types/trait-objects.extended.stderr b/src/test/ui/generic-associated-types/trait-objects.extended.stderr index 7cc3dad9921..c7b072256ad 100644 --- a/src/test/ui/generic-associated-types/trait-objects.extended.stderr +++ b/src/test/ui/generic-associated-types/trait-objects.extended.stderr @@ -1,5 +1,5 @@ error[E0621]: explicit lifetime required in the type of `x` - --> $DIR/trait-objects.rs:16:7 + --> $DIR/trait-objects.rs:18:7 | LL | fn min_size(x: &mut dyn for<'a> StreamingIterator = &'a i32>) -> usize { | ------------------------------------------------------ help: add explicit lifetime `'a` to the type of `x`: `&'a mut (dyn StreamingIterator Item = &'a i32> + 'a)` diff --git a/src/test/ui/generic-associated-types/trait-objects.rs b/src/test/ui/generic-associated-types/trait-objects.rs index 644e56ce21f..d742d2051be 100644 --- a/src/test/ui/generic-associated-types/trait-objects.rs +++ b/src/test/ui/generic-associated-types/trait-objects.rs @@ -1,3 +1,5 @@ +// FIXME(nll): this is experimental anyways, don't really care about the output +// ignore-compare-mode-nll // revisions: base extended #![feature(generic_associated_types)]