Skip to content

Commit cbf54fa

Browse files
authored
Rollup merge of #95591 - jackh726:nll-revisions-1, r=oli-obk
Use revisions to track NLL test output (part 1) The idea here is 2 fold: 1) When we eventually do make NLL default on, that PR should be systematic in "delete revisions and corresponding error annotations" 2) This allows us to look at test NLL outputs in chunks. (Though, I've opted here not to "mark" these tests. There are some tests with NLL revisions *now* that will be missed. I expect we do a second pass once we have all the tests with NLL revisions; these tests should be easy enough to eyeball.) The actual review here should be "easy", but a bit tedious. I expect we should manually go through each test output and confirm it's okay. The majority of these are either: 1) Only span change (the one I see most common is highlighting an entire function call, rather than just the function name in that call) 2) "E0308 mismatched types" -> "lifetime does not live long enough" 3) "E0495 cannot infer an appropriate lifetime for lifetime parameter" -> "lifetime does not live long enough" 4) "E0312 lifetime of reference outlives lifetime of borrowed content" -> "lifetime does not live long enough" 5) "E0759 `XXX` has an anonymous lifetime `'_` but it needs to satisfy a `'static` lifetime requirement" -> "lifetime does not live long enough" 6) "E0623 lifetime mismatch" -> "lifetime does not live long enough" Other than the now lack of an error code, most of these look fine (with most giving more helpful suggestions now). `rfc1623` output isn't great. cc ``@marmeladema`` if you want to look through these Let's r? ``@oli-obk`` since you've commented on the Zulip thread ;)
2 parents 42ab448 + f881bf7 commit cbf54fa

File tree

111 files changed

+588
-328
lines changed

Some content is hidden

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

111 files changed

+588
-328
lines changed

src/test/ui/nll/issue-50716.stderr renamed to src/test/ui/nll/issue-50716.base.stderr

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
error[E0308]: mismatched types
2-
--> $DIR/issue-50716.rs:14:9
2+
--> $DIR/issue-50716.rs:18:9
33
|
44
LL | let _x = *s;
55
| ^^ lifetime mismatch
66
|
77
= note: expected type `<<&'a T as A>::X as Sized>`
88
found type `<<&'static T as A>::X as Sized>`
99
note: the lifetime `'a` as defined here...
10-
--> $DIR/issue-50716.rs:9:8
10+
--> $DIR/issue-50716.rs:13:8
1111
|
1212
LL | fn foo<'a, T: 'static>(s: Box<<&'a T as A>::X>)
1313
| ^^

src/test/ui/nll/issue-50716.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-50716.rs:14:14
2+
--> $DIR/issue-50716.rs:18:14
33
|
44
LL | fn foo<'a, T: 'static>(s: Box<<&'a T as A>::X>)
55
| -- lifetime `'a` defined here

src/test/ui/nll/issue-50716.rs

+4
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,10 @@
22
// Regression test for the issue #50716: NLL ignores lifetimes bounds
33
// derived from `Sized` requirements
44

5+
// revisions: base nll
6+
// ignore-compare-mode-nll
7+
//[nll] compile-flags: -Z borrowck=mir
8+
59
trait A {
610
type X: ?Sized;
711
}

src/test/ui/nll/issue-52742.stderr renamed to src/test/ui/nll/issue-52742.base.stderr

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,16 @@
11
error[E0312]: lifetime of reference outlives lifetime of borrowed content...
2-
--> $DIR/issue-52742.rs:12:18
2+
--> $DIR/issue-52742.rs:17:18
33
|
44
LL | self.y = b.z
55
| ^^^
66
|
77
note: ...the reference is valid for the lifetime `'_` as defined here...
8-
--> $DIR/issue-52742.rs:10:10
8+
--> $DIR/issue-52742.rs:15:10
99
|
1010
LL | impl Foo<'_, '_> {
1111
| ^^
1212
note: ...but the borrowed content is only valid for the anonymous lifetime defined here
13-
--> $DIR/issue-52742.rs:11:31
13+
--> $DIR/issue-52742.rs:16:31
1414
|
1515
LL | fn take_bar(&mut self, b: Bar<'_>) {
1616
| ^^^^^^^

src/test/ui/nll/issue-52742.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-52742.rs:12:9
2+
--> $DIR/issue-52742.rs:17:9
33
|
44
LL | fn take_bar(&mut self, b: Bar<'_>) {
55
| --------- -- let's call this `'1`

src/test/ui/nll/issue-52742.rs

+5
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
// revisions: base nll
2+
// ignore-compare-mode-nll
3+
//[nll] compile-flags: -Z borrowck=mir
4+
5+
16
struct Foo<'a, 'b> {
27
x: &'a u32,
38
y: &'b u32,

src/test/ui/nll/issue-55394.stderr renamed to src/test/ui/nll/issue-55394.base.stderr

+5-5
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,26 @@
11
error[E0495]: cannot infer an appropriate lifetime for lifetime parameter `'s` due to conflicting requirements
2-
--> $DIR/issue-55394.rs:9:9
2+
--> $DIR/issue-55394.rs:13:9
33
|
44
LL | Foo { bar }
55
| ^^^
66
|
77
note: first, the lifetime cannot outlive the anonymous lifetime defined here...
8-
--> $DIR/issue-55394.rs:8:17
8+
--> $DIR/issue-55394.rs:12:17
99
|
1010
LL | fn new(bar: &mut Bar) -> Self {
1111
| ^^^^^^^^
1212
note: ...so that reference does not outlive borrowed content
13-
--> $DIR/issue-55394.rs:9:15
13+
--> $DIR/issue-55394.rs:13:15
1414
|
1515
LL | Foo { bar }
1616
| ^^^
1717
note: but, the lifetime must be valid for the lifetime `'_` as defined here...
18-
--> $DIR/issue-55394.rs:7:10
18+
--> $DIR/issue-55394.rs:11:10
1919
|
2020
LL | impl Foo<'_> {
2121
| ^^
2222
note: ...so that the types are compatible
23-
--> $DIR/issue-55394.rs:9:9
23+
--> $DIR/issue-55394.rs:13:9
2424
|
2525
LL | Foo { bar }
2626
| ^^^^^^^^^^^

src/test/ui/nll/issue-55394.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-55394.rs:9:9
2+
--> $DIR/issue-55394.rs:13:9
33
|
44
LL | fn new(bar: &mut Bar) -> Self {
55
| - ---- return type is Foo<'2>

src/test/ui/nll/issue-55394.rs

+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
struct Bar;
26

37
struct Foo<'s> {

src/test/ui/nll/issue-55401.stderr renamed to src/test/ui/nll/issue-55401.base.stderr

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
error[E0312]: lifetime of reference outlives lifetime of borrowed content...
2-
--> $DIR/issue-55401.rs:3:5
2+
--> $DIR/issue-55401.rs:7:5
33
|
44
LL | *y
55
| ^^
66
|
77
= note: ...the reference is valid for the static lifetime...
88
note: ...but the borrowed content is only valid for the lifetime `'a` as defined here
9-
--> $DIR/issue-55401.rs:1:47
9+
--> $DIR/issue-55401.rs:5:47
1010
|
1111
LL | fn static_to_a_to_static_through_ref_in_tuple<'a>(x: &'a u32) -> &'static u32 {
1212
| ^^

src/test/ui/nll/issue-55401.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-55401.rs:3:5
2+
--> $DIR/issue-55401.rs:7:5
33
|
44
LL | fn static_to_a_to_static_through_ref_in_tuple<'a>(x: &'a u32) -> &'static u32 {
55
| -- lifetime `'a` defined here

src/test/ui/nll/issue-55401.rs

+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 static_to_a_to_static_through_ref_in_tuple<'a>(x: &'a u32) -> &'static u32 {
26
let (ref y, _z): (&'a u32, u32) = (&22, 44);
37
*y //~ ERROR

src/test/ui/nll/lub-if.stderr renamed to src/test/ui/nll/lub-if.base.stderr

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,25 @@
11
error[E0312]: lifetime of reference outlives lifetime of borrowed content...
2-
--> $DIR/lub-if.rs:28:9
2+
--> $DIR/lub-if.rs:32:9
33
|
44
LL | s
55
| ^
66
|
77
= note: ...the reference is valid for the static lifetime...
88
note: ...but the borrowed content is only valid for the lifetime `'a` as defined here
9-
--> $DIR/lub-if.rs:23:17
9+
--> $DIR/lub-if.rs:27:17
1010
|
1111
LL | pub fn opt_str2<'a>(maybestr: &'a Option<String>) -> &'static str {
1212
| ^^
1313

1414
error[E0312]: lifetime of reference outlives lifetime of borrowed content...
15-
--> $DIR/lub-if.rs:35:9
15+
--> $DIR/lub-if.rs:41:9
1616
|
1717
LL | s
1818
| ^
1919
|
2020
= note: ...the reference is valid for the static lifetime...
2121
note: ...but the borrowed content is only valid for the lifetime `'a` as defined here
22-
--> $DIR/lub-if.rs:32:17
22+
--> $DIR/lub-if.rs:38:17
2323
|
2424
LL | pub fn opt_str3<'a>(maybestr: &'a Option<String>) -> &'static str {
2525
| ^^

src/test/ui/nll/lub-if.nll.stderr

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
error: lifetime may not live long enough
2-
--> $DIR/lub-if.rs:28:9
2+
--> $DIR/lub-if.rs:32:9
33
|
44
LL | pub fn opt_str2<'a>(maybestr: &'a Option<String>) -> &'static str {
55
| -- lifetime `'a` defined here
@@ -8,7 +8,7 @@ LL | s
88
| ^ returning this value requires that `'a` must outlive `'static`
99

1010
error: lifetime may not live long enough
11-
--> $DIR/lub-if.rs:35:9
11+
--> $DIR/lub-if.rs:41:9
1212
|
1313
LL | pub fn opt_str3<'a>(maybestr: &'a Option<String>) -> &'static str {
1414
| -- lifetime `'a` defined here

src/test/ui/nll/lub-if.rs

+10-2
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,10 @@
22
// of the various arms, particularly in the case where regions are
33
// involved.
44

5+
// revisions: base nll
6+
// ignore-compare-mode-nll
7+
//[nll] compile-flags: -Z borrowck=mir
8+
59
pub fn opt_str0<'a>(maybestr: &'a Option<String>) -> &'a str {
610
if maybestr.is_none() {
711
"(none)"
@@ -25,14 +29,18 @@ pub fn opt_str2<'a>(maybestr: &'a Option<String>) -> &'static str {
2529
"(none)"
2630
} else {
2731
let s: &'a str = maybestr.as_ref().unwrap();
28-
s //~ ERROR E0312
32+
s
33+
//[base]~^ ERROR E0312
34+
//[nll]~^^ ERROR lifetime may not live long enough
2935
}
3036
}
3137

3238
pub fn opt_str3<'a>(maybestr: &'a Option<String>) -> &'static str {
3339
if maybestr.is_some() {
3440
let s: &'a str = maybestr.as_ref().unwrap();
35-
s //~ ERROR E0312
41+
s
42+
//[base]~^ ERROR E0312
43+
//[nll]~^^ ERROR lifetime may not live long enough
3644
} else {
3745
"(none)"
3846
}

src/test/ui/nll/lub-match.stderr renamed to src/test/ui/nll/lub-match.base.stderr

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,25 @@
11
error[E0312]: lifetime of reference outlives lifetime of borrowed content...
2-
--> $DIR/lub-match.rs:30:13
2+
--> $DIR/lub-match.rs:34:13
33
|
44
LL | s
55
| ^
66
|
77
= note: ...the reference is valid for the static lifetime...
88
note: ...but the borrowed content is only valid for the lifetime `'a` as defined here
9-
--> $DIR/lub-match.rs:25:17
9+
--> $DIR/lub-match.rs:29:17
1010
|
1111
LL | pub fn opt_str2<'a>(maybestr: &'a Option<String>) -> &'static str {
1212
| ^^
1313

1414
error[E0312]: lifetime of reference outlives lifetime of borrowed content...
15-
--> $DIR/lub-match.rs:39:13
15+
--> $DIR/lub-match.rs:45:13
1616
|
1717
LL | s
1818
| ^
1919
|
2020
= note: ...the reference is valid for the static lifetime...
2121
note: ...but the borrowed content is only valid for the lifetime `'a` as defined here
22-
--> $DIR/lub-match.rs:35:17
22+
--> $DIR/lub-match.rs:41:17
2323
|
2424
LL | pub fn opt_str3<'a>(maybestr: &'a Option<String>) -> &'static str {
2525
| ^^

src/test/ui/nll/lub-match.nll.stderr

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
error: lifetime may not live long enough
2-
--> $DIR/lub-match.rs:30:13
2+
--> $DIR/lub-match.rs:34:13
33
|
44
LL | pub fn opt_str2<'a>(maybestr: &'a Option<String>) -> &'static str {
55
| -- lifetime `'a` defined here
@@ -8,7 +8,7 @@ LL | s
88
| ^ returning this value requires that `'a` must outlive `'static`
99

1010
error: lifetime may not live long enough
11-
--> $DIR/lub-match.rs:39:13
11+
--> $DIR/lub-match.rs:45:13
1212
|
1313
LL | pub fn opt_str3<'a>(maybestr: &'a Option<String>) -> &'static str {
1414
| -- lifetime `'a` defined here

src/test/ui/nll/lub-match.rs

+10-2
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,10 @@
22
// of the various arms, particularly in the case where regions are
33
// involved.
44

5+
// revisions: base nll
6+
// ignore-compare-mode-nll
7+
//[nll] compile-flags: -Z borrowck=mir
8+
59
pub fn opt_str0<'a>(maybestr: &'a Option<String>) -> &'a str {
610
match *maybestr {
711
Some(ref s) => {
@@ -27,7 +31,9 @@ pub fn opt_str2<'a>(maybestr: &'a Option<String>) -> &'static str {
2731
None => "(none)",
2832
Some(ref s) => {
2933
let s: &'a str = s;
30-
s //~ ERROR E0312
34+
s
35+
//[base]~^ ERROR E0312
36+
//[nll]~^^ ERROR lifetime may not live long enough
3137
}
3238
}
3339
}
@@ -36,7 +42,9 @@ pub fn opt_str3<'a>(maybestr: &'a Option<String>) -> &'static str {
3642
match *maybestr {
3743
Some(ref s) => {
3844
let s: &'a str = s;
39-
s //~ ERROR E0312
45+
s
46+
//[base]~^ ERROR E0312
47+
//[nll]~^^ ERROR lifetime may not live long enough
4048
}
4149
None => "(none)",
4250
}

src/test/ui/nll/type-alias-free-regions.stderr renamed to src/test/ui/nll/type-alias-free-regions.base.stderr

+10-10
Original file line numberDiff line numberDiff line change
@@ -1,59 +1,59 @@
11
error[E0495]: cannot infer an appropriate lifetime for lifetime parameter `'a` due to conflicting requirements
2-
--> $DIR/type-alias-free-regions.rs:17:9
2+
--> $DIR/type-alias-free-regions.rs:21:9
33
|
44
LL | C { f: b }
55
| ^
66
|
77
note: first, the lifetime cannot outlive the anonymous lifetime defined here...
8-
--> $DIR/type-alias-free-regions.rs:16:24
8+
--> $DIR/type-alias-free-regions.rs:20:24
99
|
1010
LL | fn from_box(b: Box<B>) -> Self {
1111
| ^
1212
note: ...so that the expression is assignable
13-
--> $DIR/type-alias-free-regions.rs:17:16
13+
--> $DIR/type-alias-free-regions.rs:21:16
1414
|
1515
LL | C { f: b }
1616
| ^
1717
= note: expected `Box<Box<&isize>>`
1818
found `Box<Box<&isize>>`
1919
note: but, the lifetime must be valid for the lifetime `'a` as defined here...
20-
--> $DIR/type-alias-free-regions.rs:15:6
20+
--> $DIR/type-alias-free-regions.rs:19:6
2121
|
2222
LL | impl<'a> FromBox<'a> for C<'a> {
2323
| ^^
2424
note: ...so that the types are compatible
25-
--> $DIR/type-alias-free-regions.rs:17:9
25+
--> $DIR/type-alias-free-regions.rs:21:9
2626
|
2727
LL | C { f: b }
2828
| ^^^^^^^^^^
2929
= note: expected `C<'a>`
3030
found `C<'_>`
3131

3232
error[E0495]: cannot infer an appropriate lifetime due to conflicting requirements
33-
--> $DIR/type-alias-free-regions.rs:27:16
33+
--> $DIR/type-alias-free-regions.rs:31:16
3434
|
3535
LL | C { f: Box::new(b.0) }
3636
| ^^^^^^^^^^^^^
3737
|
3838
note: first, the lifetime cannot outlive the anonymous lifetime defined here...
39-
--> $DIR/type-alias-free-regions.rs:26:23
39+
--> $DIR/type-alias-free-regions.rs:30:23
4040
|
4141
LL | fn from_tuple(b: (B,)) -> Self {
4242
| ^
4343
note: ...so that the expression is assignable
44-
--> $DIR/type-alias-free-regions.rs:27:25
44+
--> $DIR/type-alias-free-regions.rs:31:25
4545
|
4646
LL | C { f: Box::new(b.0) }
4747
| ^^^
4848
= note: expected `Box<&isize>`
4949
found `Box<&isize>`
5050
note: but, the lifetime must be valid for the lifetime `'a` as defined here...
51-
--> $DIR/type-alias-free-regions.rs:25:6
51+
--> $DIR/type-alias-free-regions.rs:29:6
5252
|
5353
LL | impl<'a> FromTuple<'a> for C<'a> {
5454
| ^^
5555
note: ...so that the types are compatible
56-
--> $DIR/type-alias-free-regions.rs:27:9
56+
--> $DIR/type-alias-free-regions.rs:31:9
5757
|
5858
LL | C { f: Box::new(b.0) }
5959
| ^^^^^^^^^^^^^^^^^^^^^^

src/test/ui/nll/type-alias-free-regions.nll.stderr

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
error: lifetime may not live long enough
2-
--> $DIR/type-alias-free-regions.rs:17:9
2+
--> $DIR/type-alias-free-regions.rs:21:9
33
|
44
LL | impl<'a> FromBox<'a> for C<'a> {
55
| -- lifetime `'a` defined here
@@ -9,7 +9,7 @@ LL | C { f: b }
99
| ^^^^^^^^^^ associated function was supposed to return data with lifetime `'a` but it is returning data with lifetime `'1`
1010

1111
error: lifetime may not live long enough
12-
--> $DIR/type-alias-free-regions.rs:27:9
12+
--> $DIR/type-alias-free-regions.rs:31:9
1313
|
1414
LL | impl<'a> FromTuple<'a> for C<'a> {
1515
| -- lifetime `'a` defined here

0 commit comments

Comments
 (0)