From 1e435e332efcd9230255c6fba960c7db23d641d2 Mon Sep 17 00:00:00 2001 From: Jack Huey <31162821+jackh726@users.noreply.github.com> Date: Sat, 21 May 2022 14:27:58 -0400 Subject: Use revisions for NLL in const-generics and match --- src/test/ui/const-generics/invariant.base.stderr | 26 ++++++++++++++++++++++ src/test/ui/const-generics/invariant.nll.stderr | 4 ++-- src/test/ui/const-generics/invariant.rs | 4 ++++ src/test/ui/const-generics/invariant.stderr | 26 ---------------------- .../ui/match/match-ref-mut-invariance.base.stderr | 22 ++++++++++++++++++ .../ui/match/match-ref-mut-invariance.nll.stderr | 2 +- src/test/ui/match/match-ref-mut-invariance.rs | 8 ++++++- src/test/ui/match/match-ref-mut-invariance.stderr | 22 ------------------ .../match/match-ref-mut-let-invariance.base.stderr | 22 ++++++++++++++++++ .../match/match-ref-mut-let-invariance.nll.stderr | 2 +- src/test/ui/match/match-ref-mut-let-invariance.rs | 8 ++++++- .../ui/match/match-ref-mut-let-invariance.stderr | 22 ------------------ 12 files changed, 92 insertions(+), 76 deletions(-) create mode 100644 src/test/ui/const-generics/invariant.base.stderr delete mode 100644 src/test/ui/const-generics/invariant.stderr create mode 100644 src/test/ui/match/match-ref-mut-invariance.base.stderr delete mode 100644 src/test/ui/match/match-ref-mut-invariance.stderr create mode 100644 src/test/ui/match/match-ref-mut-let-invariance.base.stderr delete mode 100644 src/test/ui/match/match-ref-mut-let-invariance.stderr (limited to 'src') diff --git a/src/test/ui/const-generics/invariant.base.stderr b/src/test/ui/const-generics/invariant.base.stderr new file mode 100644 index 00000000000..255900e19bb --- /dev/null +++ b/src/test/ui/const-generics/invariant.base.stderr @@ -0,0 +1,26 @@ +warning: conflicting implementations of trait `SadBee` for type `for<'a> fn(&'a ())` + --> $DIR/invariant.rs:18:1 + | +LL | impl SadBee for for<'a> fn(&'a ()) { + | ---------------------------------- first implementation here +... +LL | impl SadBee for fn(&'static ()) { + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `for<'a> fn(&'a ())` + | + = note: `#[warn(coherence_leak_check)]` on by default + = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! + = note: for more information, see issue #56105 + = note: this behavior recently changed as a result of a bug fix; see rust-lang/rust#56105 for details + +error[E0308]: mismatched types + --> $DIR/invariant.rs:31:5 + | +LL | v + | ^ one type is more general than the other + | + = note: expected reference `&'static Foo` + found reference `&'static Foo fn(&'a ())>` + +error: aborting due to previous error; 1 warning emitted + +For more information about this error, try `rustc --explain E0308`. diff --git a/src/test/ui/const-generics/invariant.nll.stderr b/src/test/ui/const-generics/invariant.nll.stderr index ce0fad10471..f684f7fddc8 100644 --- a/src/test/ui/const-generics/invariant.nll.stderr +++ b/src/test/ui/const-generics/invariant.nll.stderr @@ -1,5 +1,5 @@ warning: conflicting implementations of trait `SadBee` for type `for<'a> fn(&'a ())` - --> $DIR/invariant.rs:14:1 + --> $DIR/invariant.rs:18:1 | LL | impl SadBee for for<'a> fn(&'a ()) { | ---------------------------------- first implementation here @@ -13,7 +13,7 @@ LL | impl SadBee for fn(&'static ()) { = note: this behavior recently changed as a result of a bug fix; see rust-lang/rust#56105 for details error[E0308]: mismatched types - --> $DIR/invariant.rs:27:5 + --> $DIR/invariant.rs:31:5 | LL | v | ^ one type is more general than the other diff --git a/src/test/ui/const-generics/invariant.rs b/src/test/ui/const-generics/invariant.rs index ee191b65c2c..65d1ee9420c 100644 --- a/src/test/ui/const-generics/invariant.rs +++ b/src/test/ui/const-generics/invariant.rs @@ -1,3 +1,7 @@ +// ignore-compare-mode-nll +// revisions: base nll +// [nll]compile-flags: -Zborrowck=mir + #![feature(generic_const_exprs)] #![allow(incomplete_features)] use std::marker::PhantomData; diff --git a/src/test/ui/const-generics/invariant.stderr b/src/test/ui/const-generics/invariant.stderr deleted file mode 100644 index 318c885e6a6..00000000000 --- a/src/test/ui/const-generics/invariant.stderr +++ /dev/null @@ -1,26 +0,0 @@ -warning: conflicting implementations of trait `SadBee` for type `for<'a> fn(&'a ())` - --> $DIR/invariant.rs:14:1 - | -LL | impl SadBee for for<'a> fn(&'a ()) { - | ---------------------------------- first implementation here -... -LL | impl SadBee for fn(&'static ()) { - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `for<'a> fn(&'a ())` - | - = note: `#[warn(coherence_leak_check)]` on by default - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! - = note: for more information, see issue #56105 - = note: this behavior recently changed as a result of a bug fix; see rust-lang/rust#56105 for details - -error[E0308]: mismatched types - --> $DIR/invariant.rs:27:5 - | -LL | v - | ^ one type is more general than the other - | - = note: expected reference `&'static Foo` - found reference `&'static Foo fn(&'a ())>` - -error: aborting due to previous error; 1 warning emitted - -For more information about this error, try `rustc --explain E0308`. diff --git a/src/test/ui/match/match-ref-mut-invariance.base.stderr b/src/test/ui/match/match-ref-mut-invariance.base.stderr new file mode 100644 index 00000000000..060c8237974 --- /dev/null +++ b/src/test/ui/match/match-ref-mut-invariance.base.stderr @@ -0,0 +1,22 @@ +error[E0308]: mismatched types + --> $DIR/match-ref-mut-invariance.rs:14:37 + | +LL | match self.0 { ref mut x => x } + | ^ lifetime mismatch + | + = note: expected mutable reference `&'a mut &'a i32` + found mutable reference `&'a mut &'b i32` +note: the lifetime `'a` as defined here... + --> $DIR/match-ref-mut-invariance.rs:13:12 + | +LL | fn bar<'a>(&'a mut self) -> &'a mut &'a i32 { + | ^^ +note: ...does not necessarily outlive the lifetime `'b` as defined here + --> $DIR/match-ref-mut-invariance.rs:12:6 + | +LL | impl<'b> S<'b> { + | ^^ + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0308`. diff --git a/src/test/ui/match/match-ref-mut-invariance.nll.stderr b/src/test/ui/match/match-ref-mut-invariance.nll.stderr index 3b7e53cd527..b98539d91b6 100644 --- a/src/test/ui/match/match-ref-mut-invariance.nll.stderr +++ b/src/test/ui/match/match-ref-mut-invariance.nll.stderr @@ -1,5 +1,5 @@ error: lifetime may not live long enough - --> $DIR/match-ref-mut-invariance.rs:10:9 + --> $DIR/match-ref-mut-invariance.rs:14:9 | LL | impl<'b> S<'b> { | -- lifetime `'b` defined here diff --git a/src/test/ui/match/match-ref-mut-invariance.rs b/src/test/ui/match/match-ref-mut-invariance.rs index 50b0ede09c2..f876a4e2498 100644 --- a/src/test/ui/match/match-ref-mut-invariance.rs +++ b/src/test/ui/match/match-ref-mut-invariance.rs @@ -1,3 +1,7 @@ +// ignore-compare-mode-nll +// revisions: base nll +// [nll]compile-flags: -Zborrowck=mir + // Check that when making a ref mut binding with type `&mut T`, the // type `T` must match precisely the type `U` of the value being // matched, and in particular cannot be some supertype of `U`. Issue @@ -7,7 +11,9 @@ struct S<'b>(&'b i32); impl<'b> S<'b> { fn bar<'a>(&'a mut self) -> &'a mut &'a i32 { - match self.0 { ref mut x => x } //~ ERROR mismatched types + match self.0 { ref mut x => x } + //[base]~^ ERROR mismatched types + //[nll]~^^ ERROR lifetime may not live long enough } } diff --git a/src/test/ui/match/match-ref-mut-invariance.stderr b/src/test/ui/match/match-ref-mut-invariance.stderr deleted file mode 100644 index f9271cb3d06..00000000000 --- a/src/test/ui/match/match-ref-mut-invariance.stderr +++ /dev/null @@ -1,22 +0,0 @@ -error[E0308]: mismatched types - --> $DIR/match-ref-mut-invariance.rs:10:37 - | -LL | match self.0 { ref mut x => x } - | ^ lifetime mismatch - | - = note: expected mutable reference `&'a mut &'a i32` - found mutable reference `&'a mut &'b i32` -note: the lifetime `'a` as defined here... - --> $DIR/match-ref-mut-invariance.rs:9:12 - | -LL | fn bar<'a>(&'a mut self) -> &'a mut &'a i32 { - | ^^ -note: ...does not necessarily outlive the lifetime `'b` as defined here - --> $DIR/match-ref-mut-invariance.rs:8:6 - | -LL | impl<'b> S<'b> { - | ^^ - -error: aborting due to previous error - -For more information about this error, try `rustc --explain E0308`. diff --git a/src/test/ui/match/match-ref-mut-let-invariance.base.stderr b/src/test/ui/match/match-ref-mut-let-invariance.base.stderr new file mode 100644 index 00000000000..7b6dd5af539 --- /dev/null +++ b/src/test/ui/match/match-ref-mut-let-invariance.base.stderr @@ -0,0 +1,22 @@ +error[E0308]: mismatched types + --> $DIR/match-ref-mut-let-invariance.rs:15:9 + | +LL | x + | ^ lifetime mismatch + | + = note: expected mutable reference `&'a mut &'a i32` + found mutable reference `&'a mut &'b i32` +note: the lifetime `'a` as defined here... + --> $DIR/match-ref-mut-let-invariance.rs:13:12 + | +LL | fn bar<'a>(&'a mut self) -> &'a mut &'a i32 { + | ^^ +note: ...does not necessarily outlive the lifetime `'b` as defined here + --> $DIR/match-ref-mut-let-invariance.rs:12:6 + | +LL | impl<'b> S<'b> { + | ^^ + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0308`. diff --git a/src/test/ui/match/match-ref-mut-let-invariance.nll.stderr b/src/test/ui/match/match-ref-mut-let-invariance.nll.stderr index f4d1cea670b..4b8bdd157c2 100644 --- a/src/test/ui/match/match-ref-mut-let-invariance.nll.stderr +++ b/src/test/ui/match/match-ref-mut-let-invariance.nll.stderr @@ -1,5 +1,5 @@ error: lifetime may not live long enough - --> $DIR/match-ref-mut-let-invariance.rs:11:9 + --> $DIR/match-ref-mut-let-invariance.rs:15:9 | LL | impl<'b> S<'b> { | -- lifetime `'b` defined here diff --git a/src/test/ui/match/match-ref-mut-let-invariance.rs b/src/test/ui/match/match-ref-mut-let-invariance.rs index a62eb714a4d..0a8daed569f 100644 --- a/src/test/ui/match/match-ref-mut-let-invariance.rs +++ b/src/test/ui/match/match-ref-mut-let-invariance.rs @@ -1,3 +1,7 @@ +// ignore-compare-mode-nll +// revisions: base nll +// [nll]compile-flags: -Zborrowck=mir + // Check that when making a ref mut binding with type `&mut T`, the // type `T` must match precisely the type `U` of the value being // matched, and in particular cannot be some supertype of `U`. Issue @@ -8,7 +12,9 @@ struct S<'b>(&'b i32); impl<'b> S<'b> { fn bar<'a>(&'a mut self) -> &'a mut &'a i32 { let ref mut x = self.0; - x //~ ERROR mismatched types + x + //[base]~^ ERROR mismatched types + //[nll]~^^ ERROR lifetime may not live long enough } } diff --git a/src/test/ui/match/match-ref-mut-let-invariance.stderr b/src/test/ui/match/match-ref-mut-let-invariance.stderr deleted file mode 100644 index c021a5a91f5..00000000000 --- a/src/test/ui/match/match-ref-mut-let-invariance.stderr +++ /dev/null @@ -1,22 +0,0 @@ -error[E0308]: mismatched types - --> $DIR/match-ref-mut-let-invariance.rs:11:9 - | -LL | x - | ^ lifetime mismatch - | - = note: expected mutable reference `&'a mut &'a i32` - found mutable reference `&'a mut &'b i32` -note: the lifetime `'a` as defined here... - --> $DIR/match-ref-mut-let-invariance.rs:9:12 - | -LL | fn bar<'a>(&'a mut self) -> &'a mut &'a i32 { - | ^^ -note: ...does not necessarily outlive the lifetime `'b` as defined here - --> $DIR/match-ref-mut-let-invariance.rs:8:6 - | -LL | impl<'b> S<'b> { - | ^^ - -error: aborting due to previous error - -For more information about this error, try `rustc --explain E0308`. -- cgit 1.4.1-3-g733a5