1
Fork 0

Move some tests with compare-mode=nll output to revisions

This commit is contained in:
Jack Huey 2022-04-01 19:51:50 -04:00
parent 0677edc86e
commit 72e3e0e6f5
39 changed files with 147 additions and 78 deletions

View file

@ -1,5 +1,5 @@
error[E0308]: mismatched types error[E0308]: mismatched types
--> $DIR/issue-50716.rs:14:9 --> $DIR/issue-50716.rs:18:9
| |
LL | let _x = *s; LL | let _x = *s;
| ^^ lifetime mismatch | ^^ lifetime mismatch
@ -7,7 +7,7 @@ LL | let _x = *s;
= note: expected type `<<&'a T as A>::X as Sized>` = note: expected type `<<&'a T as A>::X as Sized>`
found type `<<&'static T as A>::X as Sized>` found type `<<&'static T as A>::X as Sized>`
note: the lifetime `'a` as defined here... 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>) LL | fn foo<'a, T: 'static>(s: Box<<&'a T as A>::X>)
| ^^ | ^^

View file

@ -1,5 +1,5 @@
error: lifetime may not live long enough 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>) LL | fn foo<'a, T: 'static>(s: Box<<&'a T as A>::X>)
| -- lifetime `'a` defined here | -- lifetime `'a` defined here

View file

@ -2,6 +2,10 @@
// Regression test for the issue #50716: NLL ignores lifetimes bounds // Regression test for the issue #50716: NLL ignores lifetimes bounds
// derived from `Sized` requirements // derived from `Sized` requirements
// revisions: base nll
// ignore-compare-mode-nll
//[nll] compile-flags: -Z borrowck=mir
trait A { trait A {
type X: ?Sized; type X: ?Sized;
} }

View file

@ -1,16 +1,16 @@
error[E0312]: lifetime of reference outlives lifetime of borrowed content... 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 LL | self.y = b.z
| ^^^ | ^^^
| |
note: ...the reference is valid for the lifetime `'_` as defined here... 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<'_, '_> { LL | impl Foo<'_, '_> {
| ^^ | ^^
note: ...but the borrowed content is only valid for the anonymous lifetime defined here 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<'_>) { LL | fn take_bar(&mut self, b: Bar<'_>) {
| ^^^^^^^ | ^^^^^^^

View file

@ -1,5 +1,5 @@
error: lifetime may not live long enough 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<'_>) { LL | fn take_bar(&mut self, b: Bar<'_>) {
| --------- -- let's call this `'1` | --------- -- let's call this `'1`

View file

@ -1,3 +1,8 @@
// revisions: base nll
// ignore-compare-mode-nll
//[nll] compile-flags: -Z borrowck=mir
struct Foo<'a, 'b> { struct Foo<'a, 'b> {
x: &'a u32, x: &'a u32,
y: &'b u32, y: &'b u32,

View file

@ -1,26 +1,26 @@
error[E0495]: cannot infer an appropriate lifetime for lifetime parameter `'s` due to conflicting requirements 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 } LL | Foo { bar }
| ^^^ | ^^^
| |
note: first, the lifetime cannot outlive the anonymous lifetime defined here... 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 { LL | fn new(bar: &mut Bar) -> Self {
| ^^^^^^^^ | ^^^^^^^^
note: ...so that reference does not outlive borrowed content note: ...so that reference does not outlive borrowed content
--> $DIR/issue-55394.rs:9:15 --> $DIR/issue-55394.rs:13:15
| |
LL | Foo { bar } LL | Foo { bar }
| ^^^ | ^^^
note: but, the lifetime must be valid for the lifetime `'_` as defined here... 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<'_> { LL | impl Foo<'_> {
| ^^ | ^^
note: ...so that the types are compatible note: ...so that the types are compatible
--> $DIR/issue-55394.rs:9:9 --> $DIR/issue-55394.rs:13:9
| |
LL | Foo { bar } LL | Foo { bar }
| ^^^^^^^^^^^ | ^^^^^^^^^^^

View file

@ -1,5 +1,5 @@
error: lifetime may not live long enough 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 { LL | fn new(bar: &mut Bar) -> Self {
| - ---- return type is Foo<'2> | - ---- return type is Foo<'2>

View file

@ -1,3 +1,7 @@
// revisions: base nll
// ignore-compare-mode-nll
//[nll] compile-flags: -Z borrowck=mir
struct Bar; struct Bar;
struct Foo<'s> { struct Foo<'s> {

View file

@ -1,12 +1,12 @@
error[E0312]: lifetime of reference outlives lifetime of borrowed content... error[E0312]: lifetime of reference outlives lifetime of borrowed content...
--> $DIR/issue-55401.rs:3:5 --> $DIR/issue-55401.rs:7:5
| |
LL | *y LL | *y
| ^^ | ^^
| |
= note: ...the reference is valid for the static lifetime... = note: ...the reference is valid for the static lifetime...
note: ...but the borrowed content is only valid for the lifetime `'a` as defined here 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 { LL | fn static_to_a_to_static_through_ref_in_tuple<'a>(x: &'a u32) -> &'static u32 {
| ^^ | ^^

View file

@ -1,5 +1,5 @@
error: lifetime may not live long enough 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 { LL | fn static_to_a_to_static_through_ref_in_tuple<'a>(x: &'a u32) -> &'static u32 {
| -- lifetime `'a` defined here | -- lifetime `'a` defined here

View file

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

View file

@ -1,25 +1,25 @@
error[E0312]: lifetime of reference outlives lifetime of borrowed content... error[E0312]: lifetime of reference outlives lifetime of borrowed content...
--> $DIR/lub-if.rs:28:9 --> $DIR/lub-if.rs:32:9
| |
LL | s LL | s
| ^ | ^
| |
= note: ...the reference is valid for the static lifetime... = note: ...the reference is valid for the static lifetime...
note: ...but the borrowed content is only valid for the lifetime `'a` as defined here 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 { LL | pub fn opt_str2<'a>(maybestr: &'a Option<String>) -> &'static str {
| ^^ | ^^
error[E0312]: lifetime of reference outlives lifetime of borrowed content... error[E0312]: lifetime of reference outlives lifetime of borrowed content...
--> $DIR/lub-if.rs:35:9 --> $DIR/lub-if.rs:41:9
| |
LL | s LL | s
| ^ | ^
| |
= note: ...the reference is valid for the static lifetime... = note: ...the reference is valid for the static lifetime...
note: ...but the borrowed content is only valid for the lifetime `'a` as defined here 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 { LL | pub fn opt_str3<'a>(maybestr: &'a Option<String>) -> &'static str {
| ^^ | ^^

View file

@ -1,5 +1,5 @@
error: lifetime may not live long enough 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 { LL | pub fn opt_str2<'a>(maybestr: &'a Option<String>) -> &'static str {
| -- lifetime `'a` defined here | -- lifetime `'a` defined here
@ -8,7 +8,7 @@ LL | s
| ^ returning this value requires that `'a` must outlive `'static` | ^ returning this value requires that `'a` must outlive `'static`
error: lifetime may not live long enough 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 { LL | pub fn opt_str3<'a>(maybestr: &'a Option<String>) -> &'static str {
| -- lifetime `'a` defined here | -- lifetime `'a` defined here

View file

@ -2,6 +2,10 @@
// of the various arms, particularly in the case where regions are // of the various arms, particularly in the case where regions are
// involved. // 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 { pub fn opt_str0<'a>(maybestr: &'a Option<String>) -> &'a str {
if maybestr.is_none() { if maybestr.is_none() {
"(none)" "(none)"
@ -25,14 +29,18 @@ pub fn opt_str2<'a>(maybestr: &'a Option<String>) -> &'static str {
"(none)" "(none)"
} else { } else {
let s: &'a str = maybestr.as_ref().unwrap(); 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 { pub fn opt_str3<'a>(maybestr: &'a Option<String>) -> &'static str {
if maybestr.is_some() { if maybestr.is_some() {
let s: &'a str = maybestr.as_ref().unwrap(); let s: &'a str = maybestr.as_ref().unwrap();
s //~ ERROR E0312 s
//[base]~^ ERROR E0312
//[nll]~^^ ERROR lifetime may not live long enough
} else { } else {
"(none)" "(none)"
} }

View file

@ -1,25 +1,25 @@
error[E0312]: lifetime of reference outlives lifetime of borrowed content... error[E0312]: lifetime of reference outlives lifetime of borrowed content...
--> $DIR/lub-match.rs:30:13 --> $DIR/lub-match.rs:34:13
| |
LL | s LL | s
| ^ | ^
| |
= note: ...the reference is valid for the static lifetime... = note: ...the reference is valid for the static lifetime...
note: ...but the borrowed content is only valid for the lifetime `'a` as defined here 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 { LL | pub fn opt_str2<'a>(maybestr: &'a Option<String>) -> &'static str {
| ^^ | ^^
error[E0312]: lifetime of reference outlives lifetime of borrowed content... error[E0312]: lifetime of reference outlives lifetime of borrowed content...
--> $DIR/lub-match.rs:39:13 --> $DIR/lub-match.rs:45:13
| |
LL | s LL | s
| ^ | ^
| |
= note: ...the reference is valid for the static lifetime... = note: ...the reference is valid for the static lifetime...
note: ...but the borrowed content is only valid for the lifetime `'a` as defined here 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 { LL | pub fn opt_str3<'a>(maybestr: &'a Option<String>) -> &'static str {
| ^^ | ^^

View file

@ -1,5 +1,5 @@
error: lifetime may not live long enough 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 { LL | pub fn opt_str2<'a>(maybestr: &'a Option<String>) -> &'static str {
| -- lifetime `'a` defined here | -- lifetime `'a` defined here
@ -8,7 +8,7 @@ LL | s
| ^ returning this value requires that `'a` must outlive `'static` | ^ returning this value requires that `'a` must outlive `'static`
error: lifetime may not live long enough 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 { LL | pub fn opt_str3<'a>(maybestr: &'a Option<String>) -> &'static str {
| -- lifetime `'a` defined here | -- lifetime `'a` defined here

View file

@ -2,6 +2,10 @@
// of the various arms, particularly in the case where regions are // of the various arms, particularly in the case where regions are
// involved. // 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 { pub fn opt_str0<'a>(maybestr: &'a Option<String>) -> &'a str {
match *maybestr { match *maybestr {
Some(ref s) => { Some(ref s) => {
@ -27,7 +31,9 @@ pub fn opt_str2<'a>(maybestr: &'a Option<String>) -> &'static str {
None => "(none)", None => "(none)",
Some(ref s) => { Some(ref s) => {
let s: &'a str = s; let s: &'a str = s;
s //~ ERROR E0312 s
//[base]~^ ERROR E0312
//[nll]~^^ ERROR lifetime may not live long enough
} }
} }
} }
@ -36,7 +42,9 @@ pub fn opt_str3<'a>(maybestr: &'a Option<String>) -> &'static str {
match *maybestr { match *maybestr {
Some(ref s) => { Some(ref s) => {
let s: &'a str = s; let s: &'a str = s;
s //~ ERROR E0312 s
//[base]~^ ERROR E0312
//[nll]~^^ ERROR lifetime may not live long enough
} }
None => "(none)", None => "(none)",
} }

View file

@ -1,28 +1,28 @@
error[E0495]: cannot infer an appropriate lifetime for lifetime parameter `'a` due to conflicting requirements 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 } LL | C { f: b }
| ^ | ^
| |
note: first, the lifetime cannot outlive the anonymous lifetime defined here... 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 { LL | fn from_box(b: Box<B>) -> Self {
| ^ | ^
note: ...so that the expression is assignable 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 } LL | C { f: b }
| ^ | ^
= note: expected `Box<Box<&isize>>` = note: expected `Box<Box<&isize>>`
found `Box<Box<&isize>>` found `Box<Box<&isize>>`
note: but, the lifetime must be valid for the lifetime `'a` as defined here... 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> { LL | impl<'a> FromBox<'a> for C<'a> {
| ^^ | ^^
note: ...so that the types are compatible 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 } LL | C { f: b }
| ^^^^^^^^^^ | ^^^^^^^^^^
@ -30,30 +30,30 @@ LL | C { f: b }
found `C<'_>` found `C<'_>`
error[E0495]: cannot infer an appropriate lifetime due to conflicting requirements 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) } LL | C { f: Box::new(b.0) }
| ^^^^^^^^^^^^^ | ^^^^^^^^^^^^^
| |
note: first, the lifetime cannot outlive the anonymous lifetime defined here... 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 { LL | fn from_tuple(b: (B,)) -> Self {
| ^ | ^
note: ...so that the expression is assignable 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) } LL | C { f: Box::new(b.0) }
| ^^^ | ^^^
= note: expected `Box<&isize>` = note: expected `Box<&isize>`
found `Box<&isize>` found `Box<&isize>`
note: but, the lifetime must be valid for the lifetime `'a` as defined here... 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> { LL | impl<'a> FromTuple<'a> for C<'a> {
| ^^ | ^^
note: ...so that the types are compatible 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) } LL | C { f: Box::new(b.0) }
| ^^^^^^^^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^^^^^^^^^

View file

@ -1,5 +1,5 @@
error: lifetime may not live long enough 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> { LL | impl<'a> FromBox<'a> for C<'a> {
| -- lifetime `'a` defined here | -- lifetime `'a` defined here
@ -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` | ^^^^^^^^^^ 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 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> { LL | impl<'a> FromTuple<'a> for C<'a> {
| -- lifetime `'a` defined here | -- lifetime `'a` defined here

View file

@ -1,6 +1,10 @@
// Test that we don't assume that type aliases have the same type parameters // Test that we don't assume that type aliases have the same type parameters
// as the type they alias and then panic when we see this. // as the type they alias and then panic when we see this.
// revisions: base nll
// ignore-compare-mode-nll
//[nll] compile-flags: -Z borrowck=mir
type A<'a> = &'a isize; type A<'a> = &'a isize;
type B<'a> = Box<A<'a>>; type B<'a> = Box<A<'a>>;

View file

@ -1,5 +1,5 @@
error[E0759]: `fn` parameter has lifetime `'a` but it needs to satisfy a `'static` lifetime requirement error[E0759]: `fn` parameter has lifetime `'a` but it needs to satisfy a `'static` lifetime requirement
--> $DIR/constant-in-expr-inherent-1.rs:8:5 --> $DIR/constant-in-expr-inherent-1.rs:12:5
| |
LL | fn foo<'a>(_: &'a u32) -> &'static u32 { LL | fn foo<'a>(_: &'a u32) -> &'static u32 {
| ------- this data with lifetime `'a`... | ------- this data with lifetime `'a`...

View file

@ -1,5 +1,5 @@
error: lifetime may not live long enough error: lifetime may not live long enough
--> $DIR/constant-in-expr-inherent-1.rs:8:5 --> $DIR/constant-in-expr-inherent-1.rs:12:5
| |
LL | fn foo<'a>(_: &'a u32) -> &'static u32 { LL | fn foo<'a>(_: &'a u32) -> &'static u32 {
| -- lifetime `'a` defined here | -- lifetime `'a` defined here

View file

@ -1,3 +1,7 @@
// revisions: base nll
// ignore-compare-mode-nll
//[nll] compile-flags: -Z borrowck=mir
struct Foo<'a> { x: &'a u32 } struct Foo<'a> { x: &'a u32 }
impl<'a> Foo<'a> { impl<'a> Foo<'a> {

View file

@ -1,12 +1,12 @@
error[E0312]: lifetime of reference outlives lifetime of borrowed content... error[E0312]: lifetime of reference outlives lifetime of borrowed content...
--> $DIR/constant-in-expr-normalize.rs:18:5 --> $DIR/constant-in-expr-normalize.rs:22:5
| |
LL | <() as Foo<'a>>::C LL | <() as Foo<'a>>::C
| ^^^^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^^^^^
| |
= note: ...the reference is valid for the static lifetime... = note: ...the reference is valid for the static lifetime...
note: ...but the borrowed content is only valid for the lifetime `'a` as defined here note: ...but the borrowed content is only valid for the lifetime `'a` as defined here
--> $DIR/constant-in-expr-normalize.rs:17:8 --> $DIR/constant-in-expr-normalize.rs:21:8
| |
LL | fn foo<'a>(_: &'a u32) -> &'static u32 { LL | fn foo<'a>(_: &'a u32) -> &'static u32 {
| ^^ | ^^

View file

@ -1,5 +1,5 @@
error: lifetime may not live long enough error: lifetime may not live long enough
--> $DIR/constant-in-expr-normalize.rs:18:5 --> $DIR/constant-in-expr-normalize.rs:22:5
| |
LL | fn foo<'a>(_: &'a u32) -> &'static u32 { LL | fn foo<'a>(_: &'a u32) -> &'static u32 {
| -- lifetime `'a` defined here | -- lifetime `'a` defined here

View file

@ -1,3 +1,7 @@
// revisions: base nll
// ignore-compare-mode-nll
//[nll] compile-flags: -Z borrowck=mir
trait Mirror { trait Mirror {
type Me; type Me;
} }

View file

@ -1,12 +1,12 @@
error[E0312]: lifetime of reference outlives lifetime of borrowed content... error[E0312]: lifetime of reference outlives lifetime of borrowed content...
--> $DIR/constant-in-expr-trait-item-1.rs:10:5 --> $DIR/constant-in-expr-trait-item-1.rs:14:5
| |
LL | <() as Foo<'a>>::C LL | <() as Foo<'a>>::C
| ^^^^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^^^^^
| |
= note: ...the reference is valid for the static lifetime... = note: ...the reference is valid for the static lifetime...
note: ...but the borrowed content is only valid for the lifetime `'a` as defined here note: ...but the borrowed content is only valid for the lifetime `'a` as defined here
--> $DIR/constant-in-expr-trait-item-1.rs:9:8 --> $DIR/constant-in-expr-trait-item-1.rs:13:8
| |
LL | fn foo<'a>(_: &'a u32) -> &'static u32 { LL | fn foo<'a>(_: &'a u32) -> &'static u32 {
| ^^ | ^^

View file

@ -1,5 +1,5 @@
error: lifetime may not live long enough error: lifetime may not live long enough
--> $DIR/constant-in-expr-trait-item-1.rs:10:5 --> $DIR/constant-in-expr-trait-item-1.rs:14:5
| |
LL | fn foo<'a>(_: &'a u32) -> &'static u32 { LL | fn foo<'a>(_: &'a u32) -> &'static u32 {
| -- lifetime `'a` defined here | -- lifetime `'a` defined here

View file

@ -1,3 +1,7 @@
// revisions: base nll
// ignore-compare-mode-nll
//[nll] compile-flags: -Z borrowck=mir
trait Foo<'a> { trait Foo<'a> {
const C: &'a u32; const C: &'a u32;
} }

View file

@ -1,12 +1,12 @@
error[E0312]: lifetime of reference outlives lifetime of borrowed content... error[E0312]: lifetime of reference outlives lifetime of borrowed content...
--> $DIR/constant-in-expr-trait-item-2.rs:10:5 --> $DIR/constant-in-expr-trait-item-2.rs:14:5
| |
LL | <T as Foo<'a>>::C LL | <T as Foo<'a>>::C
| ^^^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^^^^
| |
= note: ...the reference is valid for the static lifetime... = note: ...the reference is valid for the static lifetime...
note: ...but the borrowed content is only valid for the lifetime `'a` as defined here note: ...but the borrowed content is only valid for the lifetime `'a` as defined here
--> $DIR/constant-in-expr-trait-item-2.rs:9:8 --> $DIR/constant-in-expr-trait-item-2.rs:13:8
| |
LL | fn foo<'a, T: Foo<'a>>() -> &'static u32 { LL | fn foo<'a, T: Foo<'a>>() -> &'static u32 {
| ^^ | ^^

View file

@ -1,5 +1,5 @@
error: lifetime may not live long enough error: lifetime may not live long enough
--> $DIR/constant-in-expr-trait-item-2.rs:10:5 --> $DIR/constant-in-expr-trait-item-2.rs:14:5
| |
LL | fn foo<'a, T: Foo<'a>>() -> &'static u32 { LL | fn foo<'a, T: Foo<'a>>() -> &'static u32 {
| -- lifetime `'a` defined here | -- lifetime `'a` defined here

View file

@ -1,3 +1,7 @@
// revisions: base nll
// ignore-compare-mode-nll
//[nll] compile-flags: -Z borrowck=mir
trait Foo<'a> { trait Foo<'a> {
const C: &'a u32; const C: &'a u32;
} }

View file

@ -1,16 +1,16 @@
error[E0495]: cannot infer an appropriate lifetime for lifetime parameter `'a` due to conflicting requirements error[E0495]: cannot infer an appropriate lifetime for lifetime parameter `'a` due to conflicting requirements
--> $DIR/constant-in-expr-trait-item-3.rs:10:5 --> $DIR/constant-in-expr-trait-item-3.rs:14:5
| |
LL | T::C LL | T::C
| ^^^^ | ^^^^
| |
note: first, the lifetime cannot outlive the lifetime `'a` as defined here... note: first, the lifetime cannot outlive the lifetime `'a` as defined here...
--> $DIR/constant-in-expr-trait-item-3.rs:9:8 --> $DIR/constant-in-expr-trait-item-3.rs:13:8
| |
LL | fn foo<'a, T: Foo<'a>>() -> &'static u32 { LL | fn foo<'a, T: Foo<'a>>() -> &'static u32 {
| ^^ | ^^
note: ...so that the types are compatible note: ...so that the types are compatible
--> $DIR/constant-in-expr-trait-item-3.rs:10:5 --> $DIR/constant-in-expr-trait-item-3.rs:14:5
| |
LL | T::C LL | T::C
| ^^^^ | ^^^^
@ -18,7 +18,7 @@ LL | T::C
found `Foo<'a>` found `Foo<'a>`
= note: but, the lifetime must be valid for the static lifetime... = note: but, the lifetime must be valid for the static lifetime...
note: ...so that reference does not outlive borrowed content note: ...so that reference does not outlive borrowed content
--> $DIR/constant-in-expr-trait-item-3.rs:10:5 --> $DIR/constant-in-expr-trait-item-3.rs:14:5
| |
LL | T::C LL | T::C
| ^^^^ | ^^^^

View file

@ -1,5 +1,5 @@
error: lifetime may not live long enough error: lifetime may not live long enough
--> $DIR/constant-in-expr-trait-item-3.rs:10:5 --> $DIR/constant-in-expr-trait-item-3.rs:14:5
| |
LL | fn foo<'a, T: Foo<'a>>() -> &'static u32 { LL | fn foo<'a, T: Foo<'a>>() -> &'static u32 {
| -- lifetime `'a` defined here | -- lifetime `'a` defined here

View file

@ -1,3 +1,7 @@
// revisions: base nll
// ignore-compare-mode-nll
//[nll] compile-flags: -Z borrowck=mir
trait Foo<'a> { trait Foo<'a> {
const C: &'a u32; const C: &'a u32;
} }

View file

@ -1,5 +1,5 @@
error: implementation of `FnOnce` is not general enough error: implementation of `FnOnce` is not general enough
--> $DIR/rfc1623.rs:28:8 --> $DIR/rfc1623.rs:36:8
| |
LL | f: &id, LL | f: &id,
| ^^^ implementation of `FnOnce` is not general enough | ^^^ implementation of `FnOnce` is not general enough

View file

@ -1,11 +1,12 @@
error[E0308]: mismatched types error[E0308]: mismatched types
--> $DIR/rfc1623.rs:25:35 --> $DIR/rfc1623.rs:29:35
| |
LL | static SOME_STRUCT: &SomeStruct = &SomeStruct { LL | static SOME_STRUCT: &SomeStruct = &SomeStruct {
| ___________________________________^ | ___________________________________^
LL | | foo: &Foo { bools: &[false, true] }, LL | |
LL | | bar: &Bar { bools: &[true, true] }, LL | |
LL | | f: &id, LL | |
... |
LL | | LL | |
LL | | }; LL | | };
| |_^ one type is more general than the other | |_^ one type is more general than the other
@ -14,13 +15,14 @@ LL | | };
found type `Fn<(&Foo<'_>,)>` found type `Fn<(&Foo<'_>,)>`
error[E0308]: mismatched types error[E0308]: mismatched types
--> $DIR/rfc1623.rs:25:35 --> $DIR/rfc1623.rs:29:35
| |
LL | static SOME_STRUCT: &SomeStruct = &SomeStruct { LL | static SOME_STRUCT: &SomeStruct = &SomeStruct {
| ___________________________________^ | ___________________________________^
LL | | foo: &Foo { bools: &[false, true] }, LL | |
LL | | bar: &Bar { bools: &[true, true] }, LL | |
LL | | f: &id, LL | |
... |
LL | | LL | |
LL | | }; LL | | };
| |_^ one type is more general than the other | |_^ one type is more general than the other
@ -29,13 +31,14 @@ LL | | };
found type `Fn<(&Foo<'_>,)>` found type `Fn<(&Foo<'_>,)>`
error: implementation of `FnOnce` is not general enough error: implementation of `FnOnce` is not general enough
--> $DIR/rfc1623.rs:25:35 --> $DIR/rfc1623.rs:29:35
| |
LL | static SOME_STRUCT: &SomeStruct = &SomeStruct { LL | static SOME_STRUCT: &SomeStruct = &SomeStruct {
| ___________________________________^ | ___________________________________^
LL | | foo: &Foo { bools: &[false, true] }, LL | |
LL | | bar: &Bar { bools: &[true, true] }, LL | |
LL | | f: &id, LL | |
... |
LL | | LL | |
LL | | }; LL | | };
| |_^ implementation of `FnOnce` is not general enough | |_^ implementation of `FnOnce` is not general enough
@ -44,13 +47,14 @@ LL | | };
= note: ...but it actually implements `FnOnce<(&'2 Foo<'_>,)>`, for some specific lifetime `'2` = note: ...but it actually implements `FnOnce<(&'2 Foo<'_>,)>`, for some specific lifetime `'2`
error: implementation of `FnOnce` is not general enough error: implementation of `FnOnce` is not general enough
--> $DIR/rfc1623.rs:25:35 --> $DIR/rfc1623.rs:29:35
| |
LL | static SOME_STRUCT: &SomeStruct = &SomeStruct { LL | static SOME_STRUCT: &SomeStruct = &SomeStruct {
| ___________________________________^ | ___________________________________^
LL | | foo: &Foo { bools: &[false, true] }, LL | |
LL | | bar: &Bar { bools: &[true, true] }, LL | |
LL | | f: &id, LL | |
... |
LL | | LL | |
LL | | }; LL | | };
| |_^ implementation of `FnOnce` is not general enough | |_^ implementation of `FnOnce` is not general enough

View file

@ -1,3 +1,7 @@
// revisions: base nll
// ignore-compare-mode-nll
//[nll] compile-flags: -Z borrowck=mir
#![allow(dead_code)] #![allow(dead_code)]
fn non_elidable<'a, 'b>(a: &'a u8, b: &'b u8) -> &'a u8 { fn non_elidable<'a, 'b>(a: &'a u8, b: &'b u8) -> &'a u8 {
@ -23,10 +27,14 @@ fn id<T>(t: T) -> T {
} }
static SOME_STRUCT: &SomeStruct = &SomeStruct { static SOME_STRUCT: &SomeStruct = &SomeStruct {
//[nll]~^ ERROR mismatched types
//[nll]~| ERROR mismatched types
//[nll]~| ERROR implementation of `FnOnce` is not general enough
//[nll]~| ERROR implementation of `FnOnce` is not general enough
foo: &Foo { bools: &[false, true] }, foo: &Foo { bools: &[false, true] },
bar: &Bar { bools: &[true, true] }, bar: &Bar { bools: &[true, true] },
f: &id, f: &id,
//~^ ERROR implementation of `FnOnce` is not general enough //[base]~^ ERROR implementation of `FnOnce` is not general enough
}; };
// very simple test for a 'static static with default lifetime // very simple test for a 'static static with default lifetime