Skip to content

Commit 707d2eb

Browse files
committed
Use revisions for NLL (consistently) in higher-ranked-trait-bounds
1 parent dc435ee commit 707d2eb

File tree

6 files changed

+49
-27
lines changed

6 files changed

+49
-27
lines changed

src/test/ui/higher-rank-trait-bounds/issue-59311.stderr renamed to src/test/ui/higher-rank-trait-bounds/issue-59311.base.stderr

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
error[E0477]: the type `&'a V` does not fulfill the required lifetime
2-
--> $DIR/issue-59311.rs:17:5
2+
--> $DIR/issue-59311.rs:21:5
33
|
44
LL | v.t(|| {});
55
| ^^^^^^^^^^
66
|
77
note: type must satisfy the static lifetime as required by this binding
8-
--> $DIR/issue-59311.rs:15:24
8+
--> $DIR/issue-59311.rs:19:24
99
|
1010
LL | for<'a> &'a V: T + 'static,
1111
| ^^^^^^^

src/test/ui/higher-rank-trait-bounds/issue-59311.nll.stderr

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
error: higher-ranked lifetime error
2-
--> $DIR/issue-59311.rs:17:5
2+
--> $DIR/issue-59311.rs:21:5
33
|
44
LL | v.t(|| {});
55
| ^^^^^^^^^^
66
|
7-
= note: could not prove [closure@$DIR/issue-59311.rs:17:9: 17:14] well-formed
7+
= note: could not prove [closure@$DIR/issue-59311.rs:21:9: 21:14] well-formed
88

99
error: higher-ranked lifetime error
10-
--> $DIR/issue-59311.rs:17:9
10+
--> $DIR/issue-59311.rs:21:9
1111
|
1212
LL | v.t(|| {});
1313
| ^^^^^

src/test/ui/higher-rank-trait-bounds/issue-59311.rs

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,10 @@
66
// an error, but the regression test is here to ensure
77
// that it does not ICE. See discussion on #74889 for details.
88

9+
// revisions: base nll
10+
// ignore-compare-mode-nll
11+
//[nll] compile-flags: -Z borrowck=mir
12+
913
pub trait T {
1014
fn t<F: Fn()>(&self, _: F) {}
1115
}
@@ -14,7 +18,10 @@ pub fn crash<V>(v: &V)
1418
where
1519
for<'a> &'a V: T + 'static,
1620
{
17-
v.t(|| {}); //~ ERROR: `&'a V` does not fulfill the required lifetime
21+
v.t(|| {});
22+
//[base]~^ ERROR: `&'a V` does not fulfill the required lifetime
23+
//[nll]~^^ ERROR: higher-ranked lifetime error
24+
//[nll]~| ERROR: higher-ranked lifetime error
1825
}
1926

2027
fn main() {}
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
error: implementation of `Parser` is not general enough
2+
--> $DIR/issue-71955.rs:49:5
3+
|
4+
LL | foo(bar, "string", |s| s.len() == 5);
5+
| ^^^ implementation of `Parser` is not general enough
6+
|
7+
= note: `for<'a> fn(&'a str) -> (&'a str, &'a str) {bar}` must implement `Parser<'0>`, for any lifetime `'0`...
8+
= note: ...but it actually implements `Parser<'1>`, for some specific lifetime `'1`
9+
10+
error: implementation of `Parser` is not general enough
11+
--> $DIR/issue-71955.rs:53:5
12+
|
13+
LL | foo(baz, "string", |s| s.0.len() == 5);
14+
| ^^^ implementation of `Parser` is not general enough
15+
|
16+
= note: `for<'a> fn(&'a str) -> (&'a str, Wrapper<'a>) {baz}` must implement `Parser<'0>`, for any lifetime `'0`...
17+
= note: ...but it actually implements `Parser<'1>`, for some specific lifetime `'1`
18+
19+
error: aborting due to 2 previous errors
20+

src/test/ui/higher-rank-trait-bounds/normalize-under-binder/issue-71955.nll.stderr

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,75 +1,75 @@
11
error[E0308]: mismatched types
2-
--> $DIR/issue-71955.rs:54:5
2+
--> $DIR/issue-71955.rs:49:5
33
|
44
LL | foo(bar, "string", |s| s.len() == 5);
55
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ one type is more general than the other
66
|
77
= note: expected type `for<'r, 's> FnOnce<(&'r &'s str,)>`
88
found type `for<'r> FnOnce<(&'r &str,)>`
99
note: this closure does not fulfill the lifetime requirements
10-
--> $DIR/issue-71955.rs:54:24
10+
--> $DIR/issue-71955.rs:49:24
1111
|
1212
LL | foo(bar, "string", |s| s.len() == 5);
1313
| ^^^^^^^^^^^^^^^^
1414
note: the lifetime requirement is introduced here
15-
--> $DIR/issue-71955.rs:34:9
15+
--> $DIR/issue-71955.rs:29:9
1616
|
1717
LL | F2: FnOnce(&<F1 as Parser>::Output) -> bool
1818
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
1919

2020
error[E0308]: mismatched types
21-
--> $DIR/issue-71955.rs:54:5
21+
--> $DIR/issue-71955.rs:49:5
2222
|
2323
LL | foo(bar, "string", |s| s.len() == 5);
2424
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ one type is more general than the other
2525
|
2626
= note: expected type `FnOnce<(&&str,)>`
2727
found type `for<'r> FnOnce<(&'r &str,)>`
2828
note: this closure does not fulfill the lifetime requirements
29-
--> $DIR/issue-71955.rs:54:24
29+
--> $DIR/issue-71955.rs:49:24
3030
|
3131
LL | foo(bar, "string", |s| s.len() == 5);
3232
| ^^^^^^^^^^^^^^^^
3333
note: the lifetime requirement is introduced here
34-
--> $DIR/issue-71955.rs:34:44
34+
--> $DIR/issue-71955.rs:29:44
3535
|
3636
LL | F2: FnOnce(&<F1 as Parser>::Output) -> bool
3737
| ^^^^
3838

3939
error[E0308]: mismatched types
40-
--> $DIR/issue-71955.rs:58:5
40+
--> $DIR/issue-71955.rs:53:5
4141
|
4242
LL | foo(baz, "string", |s| s.0.len() == 5);
4343
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ one type is more general than the other
4444
|
4545
= note: expected type `for<'r, 's> FnOnce<(&'r Wrapper<'s>,)>`
4646
found type `for<'r> FnOnce<(&'r Wrapper<'_>,)>`
4747
note: this closure does not fulfill the lifetime requirements
48-
--> $DIR/issue-71955.rs:58:24
48+
--> $DIR/issue-71955.rs:53:24
4949
|
5050
LL | foo(baz, "string", |s| s.0.len() == 5);
5151
| ^^^^^^^^^^^^^^^^^^
5252
note: the lifetime requirement is introduced here
53-
--> $DIR/issue-71955.rs:34:9
53+
--> $DIR/issue-71955.rs:29:9
5454
|
5555
LL | F2: FnOnce(&<F1 as Parser>::Output) -> bool
5656
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
5757

5858
error[E0308]: mismatched types
59-
--> $DIR/issue-71955.rs:58:5
59+
--> $DIR/issue-71955.rs:53:5
6060
|
6161
LL | foo(baz, "string", |s| s.0.len() == 5);
6262
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ one type is more general than the other
6363
|
6464
= note: expected type `FnOnce<(&Wrapper<'_>,)>`
6565
found type `for<'r> FnOnce<(&'r Wrapper<'_>,)>`
6666
note: this closure does not fulfill the lifetime requirements
67-
--> $DIR/issue-71955.rs:58:24
67+
--> $DIR/issue-71955.rs:53:24
6868
|
6969
LL | foo(baz, "string", |s| s.0.len() == 5);
7070
| ^^^^^^^^^^^^^^^^^^
7171
note: the lifetime requirement is introduced here
72-
--> $DIR/issue-71955.rs:34:44
72+
--> $DIR/issue-71955.rs:29:44
7373
|
7474
LL | F2: FnOnce(&<F1 as Parser>::Output) -> bool
7575
| ^^^^

src/test/ui/higher-rank-trait-bounds/normalize-under-binder/issue-71955.rs

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,8 @@
11
// ignore-compare-mode-nll
2-
// revisions: migrate nll
2+
// revisions: base nll
33
// [nll]compile-flags: -Zborrowck=mir
4-
// check-fail
5-
6-
// Since we are testing nll (and migration) explicitly as a separate
7-
// revisions, don't worry about the --compare-mode=nll on this test.
8-
9-
// ignore-compare-mode-nll
104

5+
// check-fail
116
#![feature(rustc_attrs)]
127

138
trait Parser<'s> {
@@ -52,11 +47,11 @@ fn main() {
5247
}
5348

5449
foo(bar, "string", |s| s.len() == 5);
55-
//[migrate]~^ ERROR implementation of `Parser` is not general enough
50+
//[base]~^ ERROR implementation of `Parser` is not general enough
5651
//[nll]~^^ ERROR mismatched types
5752
//[nll]~| ERROR mismatched types
5853
foo(baz, "string", |s| s.0.len() == 5);
59-
//[migrate]~^ ERROR implementation of `Parser` is not general enough
54+
//[base]~^ ERROR implementation of `Parser` is not general enough
6055
//[nll]~^^ ERROR mismatched types
6156
//[nll]~| ERROR mismatched types
6257
}

0 commit comments

Comments
 (0)