Skip to content

Use revisions to track NLL test output (part 1) #95591

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Apr 6, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
error[E0308]: mismatched types
--> $DIR/issue-50716.rs:14:9
--> $DIR/issue-50716.rs:18:9
|
LL | let _x = *s;
| ^^ lifetime mismatch
|
= note: expected type `<<&'a T as A>::X as Sized>`
found type `<<&'static T as A>::X as Sized>`
note: the lifetime `'a` as defined here...
--> $DIR/issue-50716.rs:9:8
--> $DIR/issue-50716.rs:13:8
|
LL | fn foo<'a, T: 'static>(s: Box<<&'a T as A>::X>)
| ^^
Expand Down
2 changes: 1 addition & 1 deletion src/test/ui/nll/issue-50716.nll.stderr
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
error: lifetime may not live long enough
--> $DIR/issue-50716.rs:14:14
--> $DIR/issue-50716.rs:18:14
|
LL | fn foo<'a, T: 'static>(s: Box<<&'a T as A>::X>)
| -- lifetime `'a` defined here
Expand Down
4 changes: 4 additions & 0 deletions src/test/ui/nll/issue-50716.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@
// Regression test for the issue #50716: NLL ignores lifetimes bounds
// derived from `Sized` requirements

// revisions: base nll
// ignore-compare-mode-nll
//[nll] compile-flags: -Z borrowck=mir

trait A {
type X: ?Sized;
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
error[E0312]: lifetime of reference outlives lifetime of borrowed content...
--> $DIR/issue-52742.rs:12:18
--> $DIR/issue-52742.rs:17:18
|
LL | self.y = b.z
| ^^^
|
note: ...the reference is valid for the lifetime `'_` as defined here...
--> $DIR/issue-52742.rs:10:10
--> $DIR/issue-52742.rs:15:10
|
LL | impl Foo<'_, '_> {
| ^^
note: ...but the borrowed content is only valid for the anonymous lifetime defined here
--> $DIR/issue-52742.rs:11:31
--> $DIR/issue-52742.rs:16:31
|
LL | fn take_bar(&mut self, b: Bar<'_>) {
| ^^^^^^^
Expand Down
2 changes: 1 addition & 1 deletion src/test/ui/nll/issue-52742.nll.stderr
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
error: lifetime may not live long enough
--> $DIR/issue-52742.rs:12:9
--> $DIR/issue-52742.rs:17:9
|
LL | fn take_bar(&mut self, b: Bar<'_>) {
| --------- -- let's call this `'1`
Expand Down
5 changes: 5 additions & 0 deletions src/test/ui/nll/issue-52742.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
// revisions: base nll
// ignore-compare-mode-nll
//[nll] compile-flags: -Z borrowck=mir


struct Foo<'a, 'b> {
x: &'a u32,
y: &'b u32,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,26 +1,26 @@
error[E0495]: cannot infer an appropriate lifetime for lifetime parameter `'s` due to conflicting requirements
--> $DIR/issue-55394.rs:9:9
--> $DIR/issue-55394.rs:13:9
|
LL | Foo { bar }
| ^^^
|
note: first, the lifetime cannot outlive the anonymous lifetime defined here...
--> $DIR/issue-55394.rs:8:17
--> $DIR/issue-55394.rs:12:17
|
LL | fn new(bar: &mut Bar) -> Self {
| ^^^^^^^^
note: ...so that reference does not outlive borrowed content
--> $DIR/issue-55394.rs:9:15
--> $DIR/issue-55394.rs:13:15
|
LL | Foo { bar }
| ^^^
note: but, the lifetime must be valid for the lifetime `'_` as defined here...
--> $DIR/issue-55394.rs:7:10
--> $DIR/issue-55394.rs:11:10
|
LL | impl Foo<'_> {
| ^^
note: ...so that the types are compatible
--> $DIR/issue-55394.rs:9:9
--> $DIR/issue-55394.rs:13:9
|
LL | Foo { bar }
| ^^^^^^^^^^^
Expand Down
2 changes: 1 addition & 1 deletion src/test/ui/nll/issue-55394.nll.stderr
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
error: lifetime may not live long enough
--> $DIR/issue-55394.rs:9:9
--> $DIR/issue-55394.rs:13:9
|
LL | fn new(bar: &mut Bar) -> Self {
| - ---- return type is Foo<'2>
Expand Down
4 changes: 4 additions & 0 deletions src/test/ui/nll/issue-55394.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
// revisions: base nll
// ignore-compare-mode-nll
//[nll] compile-flags: -Z borrowck=mir

struct Bar;

struct Foo<'s> {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
error[E0312]: lifetime of reference outlives lifetime of borrowed content...
--> $DIR/issue-55401.rs:3:5
--> $DIR/issue-55401.rs:7:5
|
LL | *y
| ^^
|
= note: ...the reference is valid for the static lifetime...
note: ...but the borrowed content is only valid for the lifetime `'a` as defined here
--> $DIR/issue-55401.rs:1:47
--> $DIR/issue-55401.rs:5:47
|
LL | fn static_to_a_to_static_through_ref_in_tuple<'a>(x: &'a u32) -> &'static u32 {
| ^^
Expand Down
2 changes: 1 addition & 1 deletion src/test/ui/nll/issue-55401.nll.stderr
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
error: lifetime may not live long enough
--> $DIR/issue-55401.rs:3:5
--> $DIR/issue-55401.rs:7:5
|
LL | fn static_to_a_to_static_through_ref_in_tuple<'a>(x: &'a u32) -> &'static u32 {
| -- lifetime `'a` defined here
Expand Down
4 changes: 4 additions & 0 deletions src/test/ui/nll/issue-55401.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
// revisions: base nll
// ignore-compare-mode-nll
//[nll] compile-flags: -Z borrowck=mir

fn static_to_a_to_static_through_ref_in_tuple<'a>(x: &'a u32) -> &'static u32 {
let (ref y, _z): (&'a u32, u32) = (&22, 44);
*y //~ ERROR
Expand Down
Original file line number Diff line number Diff line change
@@ -1,25 +1,25 @@
error[E0312]: lifetime of reference outlives lifetime of borrowed content...
--> $DIR/lub-if.rs:28:9
--> $DIR/lub-if.rs:32:9
|
LL | s
| ^
|
= note: ...the reference is valid for the static lifetime...
note: ...but the borrowed content is only valid for the lifetime `'a` as defined here
--> $DIR/lub-if.rs:23:17
--> $DIR/lub-if.rs:27:17
|
LL | pub fn opt_str2<'a>(maybestr: &'a Option<String>) -> &'static str {
| ^^

error[E0312]: lifetime of reference outlives lifetime of borrowed content...
--> $DIR/lub-if.rs:35:9
--> $DIR/lub-if.rs:41:9
|
LL | s
| ^
|
= note: ...the reference is valid for the static lifetime...
note: ...but the borrowed content is only valid for the lifetime `'a` as defined here
--> $DIR/lub-if.rs:32:17
--> $DIR/lub-if.rs:38:17
|
LL | pub fn opt_str3<'a>(maybestr: &'a Option<String>) -> &'static str {
| ^^
Expand Down
4 changes: 2 additions & 2 deletions src/test/ui/nll/lub-if.nll.stderr
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
error: lifetime may not live long enough
--> $DIR/lub-if.rs:28:9
--> $DIR/lub-if.rs:32:9
|
LL | pub fn opt_str2<'a>(maybestr: &'a Option<String>) -> &'static str {
| -- lifetime `'a` defined here
Expand All @@ -8,7 +8,7 @@ LL | s
| ^ returning this value requires that `'a` must outlive `'static`

error: lifetime may not live long enough
--> $DIR/lub-if.rs:35:9
--> $DIR/lub-if.rs:41:9
|
LL | pub fn opt_str3<'a>(maybestr: &'a Option<String>) -> &'static str {
| -- lifetime `'a` defined here
Expand Down
12 changes: 10 additions & 2 deletions src/test/ui/nll/lub-if.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@
// of the various arms, particularly in the case where regions are
// involved.

// revisions: base nll
// ignore-compare-mode-nll
//[nll] compile-flags: -Z borrowck=mir

pub fn opt_str0<'a>(maybestr: &'a Option<String>) -> &'a str {
if maybestr.is_none() {
"(none)"
Expand All @@ -25,14 +29,18 @@ pub fn opt_str2<'a>(maybestr: &'a Option<String>) -> &'static str {
"(none)"
} else {
let s: &'a str = maybestr.as_ref().unwrap();
s //~ ERROR E0312
s
//[base]~^ ERROR E0312
//[nll]~^^ ERROR lifetime may not live long enough
}
}

pub fn opt_str3<'a>(maybestr: &'a Option<String>) -> &'static str {
if maybestr.is_some() {
let s: &'a str = maybestr.as_ref().unwrap();
s //~ ERROR E0312
s
//[base]~^ ERROR E0312
//[nll]~^^ ERROR lifetime may not live long enough
} else {
"(none)"
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,25 +1,25 @@
error[E0312]: lifetime of reference outlives lifetime of borrowed content...
--> $DIR/lub-match.rs:30:13
--> $DIR/lub-match.rs:34:13
|
LL | s
| ^
|
= note: ...the reference is valid for the static lifetime...
note: ...but the borrowed content is only valid for the lifetime `'a` as defined here
--> $DIR/lub-match.rs:25:17
--> $DIR/lub-match.rs:29:17
|
LL | pub fn opt_str2<'a>(maybestr: &'a Option<String>) -> &'static str {
| ^^

error[E0312]: lifetime of reference outlives lifetime of borrowed content...
--> $DIR/lub-match.rs:39:13
--> $DIR/lub-match.rs:45:13
|
LL | s
| ^
|
= note: ...the reference is valid for the static lifetime...
note: ...but the borrowed content is only valid for the lifetime `'a` as defined here
--> $DIR/lub-match.rs:35:17
--> $DIR/lub-match.rs:41:17
|
LL | pub fn opt_str3<'a>(maybestr: &'a Option<String>) -> &'static str {
| ^^
Expand Down
4 changes: 2 additions & 2 deletions src/test/ui/nll/lub-match.nll.stderr
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
error: lifetime may not live long enough
--> $DIR/lub-match.rs:30:13
--> $DIR/lub-match.rs:34:13
|
LL | pub fn opt_str2<'a>(maybestr: &'a Option<String>) -> &'static str {
| -- lifetime `'a` defined here
Expand All @@ -8,7 +8,7 @@ LL | s
| ^ returning this value requires that `'a` must outlive `'static`

error: lifetime may not live long enough
--> $DIR/lub-match.rs:39:13
--> $DIR/lub-match.rs:45:13
|
LL | pub fn opt_str3<'a>(maybestr: &'a Option<String>) -> &'static str {
| -- lifetime `'a` defined here
Expand Down
12 changes: 10 additions & 2 deletions src/test/ui/nll/lub-match.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@
// of the various arms, particularly in the case where regions are
// involved.

// revisions: base nll
// ignore-compare-mode-nll
//[nll] compile-flags: -Z borrowck=mir

pub fn opt_str0<'a>(maybestr: &'a Option<String>) -> &'a str {
match *maybestr {
Some(ref s) => {
Expand All @@ -27,7 +31,9 @@ pub fn opt_str2<'a>(maybestr: &'a Option<String>) -> &'static str {
None => "(none)",
Some(ref s) => {
let s: &'a str = s;
s //~ ERROR E0312
s
//[base]~^ ERROR E0312
//[nll]~^^ ERROR lifetime may not live long enough
}
}
}
Expand All @@ -36,7 +42,9 @@ pub fn opt_str3<'a>(maybestr: &'a Option<String>) -> &'static str {
match *maybestr {
Some(ref s) => {
let s: &'a str = s;
s //~ ERROR E0312
s
//[base]~^ ERROR E0312
//[nll]~^^ ERROR lifetime may not live long enough
}
None => "(none)",
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,59 +1,59 @@
error[E0495]: cannot infer an appropriate lifetime for lifetime parameter `'a` due to conflicting requirements
--> $DIR/type-alias-free-regions.rs:17:9
--> $DIR/type-alias-free-regions.rs:21:9
|
LL | C { f: b }
| ^
|
note: first, the lifetime cannot outlive the anonymous lifetime defined here...
--> $DIR/type-alias-free-regions.rs:16:24
--> $DIR/type-alias-free-regions.rs:20:24
|
LL | fn from_box(b: Box<B>) -> Self {
| ^
note: ...so that the expression is assignable
--> $DIR/type-alias-free-regions.rs:17:16
--> $DIR/type-alias-free-regions.rs:21:16
|
LL | C { f: b }
| ^
= note: expected `Box<Box<&isize>>`
found `Box<Box<&isize>>`
note: but, the lifetime must be valid for the lifetime `'a` as defined here...
--> $DIR/type-alias-free-regions.rs:15:6
--> $DIR/type-alias-free-regions.rs:19:6
|
LL | impl<'a> FromBox<'a> for C<'a> {
| ^^
note: ...so that the types are compatible
--> $DIR/type-alias-free-regions.rs:17:9
--> $DIR/type-alias-free-regions.rs:21:9
|
LL | C { f: b }
| ^^^^^^^^^^
= note: expected `C<'a>`
found `C<'_>`

error[E0495]: cannot infer an appropriate lifetime due to conflicting requirements
--> $DIR/type-alias-free-regions.rs:27:16
--> $DIR/type-alias-free-regions.rs:31:16
|
LL | C { f: Box::new(b.0) }
| ^^^^^^^^^^^^^
|
note: first, the lifetime cannot outlive the anonymous lifetime defined here...
--> $DIR/type-alias-free-regions.rs:26:23
--> $DIR/type-alias-free-regions.rs:30:23
|
LL | fn from_tuple(b: (B,)) -> Self {
| ^
note: ...so that the expression is assignable
--> $DIR/type-alias-free-regions.rs:27:25
--> $DIR/type-alias-free-regions.rs:31:25
|
LL | C { f: Box::new(b.0) }
| ^^^
= note: expected `Box<&isize>`
found `Box<&isize>`
note: but, the lifetime must be valid for the lifetime `'a` as defined here...
--> $DIR/type-alias-free-regions.rs:25:6
--> $DIR/type-alias-free-regions.rs:29:6
|
LL | impl<'a> FromTuple<'a> for C<'a> {
| ^^
note: ...so that the types are compatible
--> $DIR/type-alias-free-regions.rs:27:9
--> $DIR/type-alias-free-regions.rs:31:9
|
LL | C { f: Box::new(b.0) }
| ^^^^^^^^^^^^^^^^^^^^^^
Expand Down
4 changes: 2 additions & 2 deletions src/test/ui/nll/type-alias-free-regions.nll.stderr
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
error: lifetime may not live long enough
--> $DIR/type-alias-free-regions.rs:17:9
--> $DIR/type-alias-free-regions.rs:21:9
|
LL | impl<'a> FromBox<'a> for C<'a> {
| -- lifetime `'a` defined here
Expand All @@ -9,7 +9,7 @@ LL | C { f: b }
| ^^^^^^^^^^ associated function was supposed to return data with lifetime `'a` but it is returning data with lifetime `'1`

error: lifetime may not live long enough
--> $DIR/type-alias-free-regions.rs:27:9
--> $DIR/type-alias-free-regions.rs:31:9
|
LL | impl<'a> FromTuple<'a> for C<'a> {
| -- lifetime `'a` defined here
Expand Down
Loading