Use revisions for NLL in const-generics and match

This commit is contained in:
Jack Huey 2022-05-21 14:27:58 -04:00
parent f1a7f9ab40
commit 1e435e332e
9 changed files with 30 additions and 14 deletions

View file

@ -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

View file

@ -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

View file

@ -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;

View file

@ -1,5 +1,5 @@
error[E0308]: mismatched types
--> $DIR/match-ref-mut-invariance.rs:10:37
--> $DIR/match-ref-mut-invariance.rs:14:37
|
LL | match self.0 { ref mut x => x }
| ^ lifetime mismatch
@ -7,12 +7,12 @@ LL | match self.0 { ref mut x => x }
= 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
--> $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:8:6
--> $DIR/match-ref-mut-invariance.rs:12:6
|
LL | impl<'b> S<'b> {
| ^^

View file

@ -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

View file

@ -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
}
}

View file

@ -1,5 +1,5 @@
error[E0308]: mismatched types
--> $DIR/match-ref-mut-let-invariance.rs:11:9
--> $DIR/match-ref-mut-let-invariance.rs:15:9
|
LL | x
| ^ lifetime mismatch
@ -7,12 +7,12 @@ LL | x
= 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
--> $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:8:6
--> $DIR/match-ref-mut-let-invariance.rs:12:6
|
LL | impl<'b> S<'b> {
| ^^

View file

@ -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

View file

@ -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
}
}