Skip to content

Commit 50294f6

Browse files
authored
Rollup merge of #96212 - marmeladema:nll-revisions-regions, r=jackh726
Use revisions instead of nll compare mode for `/regions/` ui tests Created #96211 for the duplicated mismatched types errors r? `@jackh726`
2 parents b7e67a6 + e10aa15 commit 50294f6

File tree

160 files changed

+743
-470
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

160 files changed

+743
-470
lines changed

src/test/ui/regions/issue-28848.stderr renamed to src/test/ui/regions/issue-28848.base.stderr

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,16 @@
11
error[E0478]: lifetime bound not satisfied
2-
--> $DIR/issue-28848.rs:10:5
2+
--> $DIR/issue-28848.rs:14:5
33
|
44
LL | Foo::<'a, 'b>::xmute(u)
55
| ^^^^^^^^^^^^^
66
|
77
note: lifetime parameter instantiated with the lifetime `'b` as defined here
8-
--> $DIR/issue-28848.rs:9:16
8+
--> $DIR/issue-28848.rs:13:16
99
|
1010
LL | pub fn foo<'a, 'b>(u: &'b ()) -> &'a () {
1111
| ^^
1212
note: but lifetime parameter must outlive the lifetime `'a` as defined here
13-
--> $DIR/issue-28848.rs:9:12
13+
--> $DIR/issue-28848.rs:13:12
1414
|
1515
LL | pub fn foo<'a, 'b>(u: &'b ()) -> &'a () {
1616
| ^^

src/test/ui/regions/issue-28848.nll.stderr

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
error: lifetime may not live long enough
2-
--> $DIR/issue-28848.rs:10:5
2+
--> $DIR/issue-28848.rs:14:5
33
|
44
LL | pub fn foo<'a, 'b>(u: &'b ()) -> &'a () {
55
| -- -- lifetime `'b` defined here

src/test/ui/regions/issue-28848.rs

+7-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
// revisions: base nll
2+
// ignore-compare-mode-nll
3+
//[nll] compile-flags: -Z borrowck=mir
4+
15
struct Foo<'a, 'b: 'a>(&'a &'b ());
26

37
impl<'a, 'b> Foo<'a, 'b> {
@@ -7,7 +11,9 @@ impl<'a, 'b> Foo<'a, 'b> {
711
}
812

913
pub fn foo<'a, 'b>(u: &'b ()) -> &'a () {
10-
Foo::<'a, 'b>::xmute(u) //~ ERROR lifetime bound not satisfied
14+
Foo::<'a, 'b>::xmute(u)
15+
//[base]~^ ERROR lifetime bound not satisfied
16+
//[nll]~^^ ERROR lifetime may not live long enough
1117
}
1218

1319
fn main() {}

src/test/ui/regions/region-invariant-static-error-reporting.stderr renamed to src/test/ui/regions/region-invariant-static-error-reporting.base.stderr

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
error[E0308]: `if` and `else` have incompatible types
2-
--> $DIR/region-invariant-static-error-reporting.rs:17:9
2+
--> $DIR/region-invariant-static-error-reporting.rs:21:9
33
|
44
LL | let bad = if x.is_some() {
55
| _______________-
@@ -14,7 +14,7 @@ LL | | };
1414
= note: expected struct `Invariant<'a>`
1515
found struct `Invariant<'static>`
1616
note: the lifetime `'a` as defined here...
17-
--> $DIR/region-invariant-static-error-reporting.rs:13:10
17+
--> $DIR/region-invariant-static-error-reporting.rs:17:10
1818
|
1919
LL | fn unify<'a>(x: Option<Invariant<'a>>, f: fn(Invariant<'a>)) {
2020
| ^^

src/test/ui/regions/region-invariant-static-error-reporting.nll.stderr

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
error[E0521]: borrowed data escapes outside of function
2-
--> $DIR/region-invariant-static-error-reporting.rs:15:9
2+
--> $DIR/region-invariant-static-error-reporting.rs:19:9
33
|
44
LL | fn unify<'a>(x: Option<Invariant<'a>>, f: fn(Invariant<'a>)) {
55
| -- - `x` is a reference that is only valid in the function body

src/test/ui/regions/region-invariant-static-error-reporting.rs

+8-4
Original file line numberDiff line numberDiff line change
@@ -3,18 +3,22 @@
33
// over time, but this test used to exhibit some pretty bogus messages
44
// that were not remotely helpful.
55

6-
// error-pattern:the lifetime `'a`
7-
// error-pattern:the static lifetime
6+
// revisions: base nll
7+
// ignore-compare-mode-nll
8+
//[base] error-pattern:the lifetime `'a`
9+
//[base] error-pattern:the static lifetime
10+
//[nll] compile-flags: -Z borrowck=mir
11+
//[nll] error-pattern:argument requires that `'a` must outlive `'static`
812

913
struct Invariant<'a>(Option<&'a mut &'a mut ()>);
1014

1115
fn mk_static() -> Invariant<'static> { Invariant(None) }
1216

1317
fn unify<'a>(x: Option<Invariant<'a>>, f: fn(Invariant<'a>)) {
1418
let bad = if x.is_some() {
15-
x.unwrap()
19+
x.unwrap() //[nll]~ ERROR borrowed data escapes outside of function [E0521]
1620
} else {
17-
mk_static()
21+
mk_static() //[base]~ ERROR `if` and `else` have incompatible types [E0308]
1822
};
1923
f(bad);
2024
}

src/test/ui/regions/region-lifetime-bounds-on-fns-where-clause.stderr renamed to src/test/ui/regions/region-lifetime-bounds-on-fns-where-clause.base.stderr

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
error[E0623]: lifetime mismatch
2-
--> $DIR/region-lifetime-bounds-on-fns-where-clause.rs:8:10
2+
--> $DIR/region-lifetime-bounds-on-fns-where-clause.rs:12:10
33
|
44
LL | fn b<'a, 'b>(x: &mut &'a isize, y: &mut &'b isize) {
55
| --------- --------- these two types are declared with different lifetimes...
@@ -8,7 +8,7 @@ LL | *x = *y;
88
| ^^ ...but data from `y` flows into `x` here
99

1010
error[E0623]: lifetime mismatch
11-
--> $DIR/region-lifetime-bounds-on-fns-where-clause.rs:14:7
11+
--> $DIR/region-lifetime-bounds-on-fns-where-clause.rs:20:7
1212
|
1313
LL | fn c<'a,'b>(x: &mut &'a isize, y: &mut &'b isize) {
1414
| --------- --------- these two types are declared with different lifetimes...
@@ -17,7 +17,7 @@ LL | a(x, y);
1717
| ^ ...but data from `y` flows into `x` here
1818

1919
error[E0308]: mismatched types
20-
--> $DIR/region-lifetime-bounds-on-fns-where-clause.rs:20:43
20+
--> $DIR/region-lifetime-bounds-on-fns-where-clause.rs:28:43
2121
|
2222
LL | let _: fn(&mut &isize, &mut &isize) = a;
2323
| ^ one type is more general than the other

src/test/ui/regions/region-lifetime-bounds-on-fns-where-clause.nll.stderr

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
error: lifetime may not live long enough
2-
--> $DIR/region-lifetime-bounds-on-fns-where-clause.rs:8:5
2+
--> $DIR/region-lifetime-bounds-on-fns-where-clause.rs:12:5
33
|
44
LL | fn b<'a, 'b>(x: &mut &'a isize, y: &mut &'b isize) {
55
| -- -- lifetime `'b` defined here
@@ -12,7 +12,7 @@ LL | *x = *y;
1212
= help: consider adding the following bound: `'b: 'a`
1313

1414
error: lifetime may not live long enough
15-
--> $DIR/region-lifetime-bounds-on-fns-where-clause.rs:14:5
15+
--> $DIR/region-lifetime-bounds-on-fns-where-clause.rs:20:5
1616
|
1717
LL | fn c<'a,'b>(x: &mut &'a isize, y: &mut &'b isize) {
1818
| -- -- lifetime `'b` defined here
@@ -28,7 +28,7 @@ LL | a(x, y);
2828
= help: see <https://doc.rust-lang.org/nomicon/subtyping.html> for more information about variance
2929

3030
error[E0308]: mismatched types
31-
--> $DIR/region-lifetime-bounds-on-fns-where-clause.rs:20:12
31+
--> $DIR/region-lifetime-bounds-on-fns-where-clause.rs:28:12
3232
|
3333
LL | let _: fn(&mut &isize, &mut &isize) = a;
3434
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ one type is more general than the other
@@ -37,7 +37,7 @@ LL | let _: fn(&mut &isize, &mut &isize) = a;
3737
found fn pointer `for<'r, 's> fn(&'r mut &isize, &'s mut &isize)`
3838

3939
error[E0308]: mismatched types
40-
--> $DIR/region-lifetime-bounds-on-fns-where-clause.rs:20:12
40+
--> $DIR/region-lifetime-bounds-on-fns-where-clause.rs:28:12
4141
|
4242
LL | let _: fn(&mut &isize, &mut &isize) = a;
4343
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ one type is more general than the other

src/test/ui/regions/region-lifetime-bounds-on-fns-where-clause.rs

+13-3
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,33 @@
1+
// revisions: base nll
2+
// ignore-compare-mode-nll
3+
//[nll] compile-flags: -Z borrowck=mir
4+
15
fn a<'a, 'b>(x: &mut &'a isize, y: &mut &'b isize) where 'b: 'a {
26
// Note: this is legal because of the `'b:'a` declaration.
37
*x = *y;
48
}
59

610
fn b<'a, 'b>(x: &mut &'a isize, y: &mut &'b isize) {
711
// Illegal now because there is no `'b:'a` declaration.
8-
*x = *y; //~ ERROR E0623
12+
*x = *y;
13+
//[base]~^ ERROR E0623
14+
//[nll]~^^ ERROR lifetime may not live long enough
915
}
1016

1117
fn c<'a,'b>(x: &mut &'a isize, y: &mut &'b isize) {
1218
// Here we try to call `foo` but do not know that `'a` and `'b` are
1319
// related as required.
14-
a(x, y); //~ ERROR lifetime mismatch [E0623]
20+
a(x, y);
21+
//[base]~^ ERROR lifetime mismatch [E0623]
22+
//[nll]~^^ ERROR lifetime may not live long enough
1523
}
1624

1725
fn d() {
1826
// 'a and 'b are early bound in the function `a` because they appear
1927
// inconstraints:
20-
let _: fn(&mut &isize, &mut &isize) = a; //~ ERROR mismatched types
28+
let _: fn(&mut &isize, &mut &isize) = a;
29+
//~^ ERROR mismatched types [E0308]
30+
//[nll]~^^ ERROR mismatched types [E0308]
2131
}
2232

2333
fn e() {

src/test/ui/regions/region-multiple-lifetime-bounds-on-fns-where-clause.stderr renamed to src/test/ui/regions/region-multiple-lifetime-bounds-on-fns-where-clause.base.stderr

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
error[E0623]: lifetime mismatch
2-
--> $DIR/region-multiple-lifetime-bounds-on-fns-where-clause.rs:9:10
2+
--> $DIR/region-multiple-lifetime-bounds-on-fns-where-clause.rs:13:10
33
|
44
LL | fn b<'a, 'b, 'c>(x: &mut &'a isize, y: &mut &'b isize, z: &mut &'c isize) {
55
| --------- --------- these two types are declared with different lifetimes...
@@ -8,7 +8,7 @@ LL | *x = *y;
88
| ^^ ...but data from `y` flows into `x` here
99

1010
error[E0623]: lifetime mismatch
11-
--> $DIR/region-multiple-lifetime-bounds-on-fns-where-clause.rs:10:10
11+
--> $DIR/region-multiple-lifetime-bounds-on-fns-where-clause.rs:16:10
1212
|
1313
LL | fn b<'a, 'b, 'c>(x: &mut &'a isize, y: &mut &'b isize, z: &mut &'c isize) {
1414
| --------- ---------
@@ -19,7 +19,7 @@ LL | *z = *y;
1919
| ^^ ...but data from `y` flows into `z` here
2020

2121
error[E0623]: lifetime mismatch
22-
--> $DIR/region-multiple-lifetime-bounds-on-fns-where-clause.rs:16:7
22+
--> $DIR/region-multiple-lifetime-bounds-on-fns-where-clause.rs:22:7
2323
|
2424
LL | fn c<'a,'b, 'c>(x: &mut &'a isize, y: &mut &'b isize, z: &mut &'c isize) {
2525
| --------- --------- these two types are declared with different lifetimes...
@@ -28,7 +28,7 @@ LL | a(x, y, z);
2828
| ^ ...but data from `y` flows into `x` here
2929

3030
error[E0308]: mismatched types
31-
--> $DIR/region-multiple-lifetime-bounds-on-fns-where-clause.rs:22:56
31+
--> $DIR/region-multiple-lifetime-bounds-on-fns-where-clause.rs:30:56
3232
|
3333
LL | let _: fn(&mut &isize, &mut &isize, &mut &isize) = a;
3434
| ^ one type is more general than the other

src/test/ui/regions/region-multiple-lifetime-bounds-on-fns-where-clause.nll.stderr

+5-5
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
error: lifetime may not live long enough
2-
--> $DIR/region-multiple-lifetime-bounds-on-fns-where-clause.rs:9:5
2+
--> $DIR/region-multiple-lifetime-bounds-on-fns-where-clause.rs:13:5
33
|
44
LL | fn b<'a, 'b, 'c>(x: &mut &'a isize, y: &mut &'b isize, z: &mut &'c isize) {
55
| -- -- lifetime `'b` defined here
@@ -12,7 +12,7 @@ LL | *x = *y;
1212
= help: consider adding the following bound: `'b: 'a`
1313

1414
error: lifetime may not live long enough
15-
--> $DIR/region-multiple-lifetime-bounds-on-fns-where-clause.rs:16:5
15+
--> $DIR/region-multiple-lifetime-bounds-on-fns-where-clause.rs:22:5
1616
|
1717
LL | fn c<'a,'b, 'c>(x: &mut &'a isize, y: &mut &'b isize, z: &mut &'c isize) {
1818
| -- -- lifetime `'b` defined here
@@ -28,7 +28,7 @@ LL | a(x, y, z);
2828
= help: see <https://doc.rust-lang.org/nomicon/subtyping.html> for more information about variance
2929

3030
error[E0308]: mismatched types
31-
--> $DIR/region-multiple-lifetime-bounds-on-fns-where-clause.rs:22:12
31+
--> $DIR/region-multiple-lifetime-bounds-on-fns-where-clause.rs:30:12
3232
|
3333
LL | let _: fn(&mut &isize, &mut &isize, &mut &isize) = a;
3434
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ one type is more general than the other
@@ -37,7 +37,7 @@ LL | let _: fn(&mut &isize, &mut &isize, &mut &isize) = a;
3737
found fn pointer `for<'r, 's, 't0> fn(&'r mut &isize, &'s mut &isize, &'t0 mut &isize)`
3838

3939
error[E0308]: mismatched types
40-
--> $DIR/region-multiple-lifetime-bounds-on-fns-where-clause.rs:22:12
40+
--> $DIR/region-multiple-lifetime-bounds-on-fns-where-clause.rs:30:12
4141
|
4242
LL | let _: fn(&mut &isize, &mut &isize, &mut &isize) = a;
4343
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ one type is more general than the other
@@ -46,7 +46,7 @@ LL | let _: fn(&mut &isize, &mut &isize, &mut &isize) = a;
4646
found fn pointer `for<'r, 's, 't0> fn(&'r mut &isize, &'s mut &isize, &'t0 mut &isize)`
4747

4848
error[E0308]: mismatched types
49-
--> $DIR/region-multiple-lifetime-bounds-on-fns-where-clause.rs:22:12
49+
--> $DIR/region-multiple-lifetime-bounds-on-fns-where-clause.rs:30:12
5050
|
5151
LL | let _: fn(&mut &isize, &mut &isize, &mut &isize) = a;
5252
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ one type is more general than the other

src/test/ui/regions/region-multiple-lifetime-bounds-on-fns-where-clause.polonius.stderr

-82
This file was deleted.

src/test/ui/regions/region-multiple-lifetime-bounds-on-fns-where-clause.rs

+15-4
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
// revisions: base nll
2+
// ignore-compare-mode-nll
3+
//[nll] compile-flags: -Z borrowck=mir
4+
15
fn a<'a, 'b, 'c>(x: &mut &'a isize, y: &mut &'b isize, z: &mut &'c isize) where 'b: 'a + 'c {
26
// Note: this is legal because of the `'b:'a` declaration.
37
*x = *y;
@@ -6,20 +10,27 @@ fn a<'a, 'b, 'c>(x: &mut &'a isize, y: &mut &'b isize, z: &mut &'c isize) where
610

711
fn b<'a, 'b, 'c>(x: &mut &'a isize, y: &mut &'b isize, z: &mut &'c isize) {
812
// Illegal now because there is no `'b:'a` declaration.
9-
*x = *y; //~ ERROR E0623
10-
*z = *y; //~ ERROR E0623
13+
*x = *y;
14+
//[base]~^ ERROR E0623
15+
//[nll]~^^ ERROR lifetime may not live long enough
16+
*z = *y; //[base]~ ERROR E0623
1117
}
1218

1319
fn c<'a,'b, 'c>(x: &mut &'a isize, y: &mut &'b isize, z: &mut &'c isize) {
1420
// Here we try to call `foo` but do not know that `'a` and `'b` are
1521
// related as required.
16-
a(x, y, z); //~ ERROR lifetime mismatch [E0623]
22+
a(x, y, z);
23+
//[base]~^ ERROR lifetime mismatch [E0623]
24+
//[nll]~^^ ERROR lifetime may not live long enough
1725
}
1826

1927
fn d() {
2028
// 'a and 'b are early bound in the function `a` because they appear
2129
// inconstraints:
22-
let _: fn(&mut &isize, &mut &isize, &mut &isize) = a; //~ ERROR E0308
30+
let _: fn(&mut &isize, &mut &isize, &mut &isize) = a;
31+
//~^ ERROR E0308
32+
//[nll]~^^ ERROR mismatched types [E0308]
33+
//[nll]~| ERROR mismatched types [E0308]
2334
}
2435

2536
fn e() {

0 commit comments

Comments
 (0)