Move some tests with compare-mode=nll output to revisions
This commit is contained in:
parent
0677edc86e
commit
72e3e0e6f5
@ -1,5 +1,5 @@
|
||||
error[E0308]: mismatched types
|
||||
--> $DIR/issue-50716.rs:14:9
|
||||
--> $DIR/issue-50716.rs:18:9
|
||||
|
|
||||
LL | let _x = *s;
|
||||
| ^^ lifetime mismatch
|
||||
@ -7,7 +7,7 @@ LL | let _x = *s;
|
||||
= 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>)
|
||||
| ^^
|
@ -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
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -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<'_>) {
|
||||
| ^^^^^^^
|
@ -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`
|
||||
|
@ -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,
|
||||
|
@ -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 }
|
||||
| ^^^^^^^^^^^
|
@ -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>
|
||||
|
@ -1,3 +1,7 @@
|
||||
// revisions: base nll
|
||||
// ignore-compare-mode-nll
|
||||
//[nll] compile-flags: -Z borrowck=mir
|
||||
|
||||
struct Bar;
|
||||
|
||||
struct Foo<'s> {
|
||||
|
@ -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 {
|
||||
| ^^
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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 {
|
||||
| ^^
|
@ -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
|
||||
@ -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
|
||||
|
@ -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)"
|
||||
@ -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)"
|
||||
}
|
||||
|
@ -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 {
|
||||
| ^^
|
@ -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
|
||||
@ -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
|
||||
|
@ -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) => {
|
||||
@ -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
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -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)",
|
||||
}
|
||||
|
@ -1,28 +1,28 @@
|
||||
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 }
|
||||
| ^^^^^^^^^^
|
||||
@ -30,30 +30,30 @@ LL | C { f: b }
|
||||
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) }
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^
|
@ -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
|
||||
@ -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
|
||||
|
@ -1,6 +1,10 @@
|
||||
// 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.
|
||||
|
||||
// revisions: base nll
|
||||
// ignore-compare-mode-nll
|
||||
//[nll] compile-flags: -Z borrowck=mir
|
||||
|
||||
type A<'a> = &'a isize;
|
||||
type B<'a> = Box<A<'a>>;
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
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 {
|
||||
| ------- this data with lifetime `'a`...
|
@ -1,5 +1,5 @@
|
||||
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 {
|
||||
| -- lifetime `'a` defined here
|
||||
|
@ -1,3 +1,7 @@
|
||||
// revisions: base nll
|
||||
// ignore-compare-mode-nll
|
||||
//[nll] compile-flags: -Z borrowck=mir
|
||||
|
||||
struct Foo<'a> { x: &'a u32 }
|
||||
|
||||
impl<'a> Foo<'a> {
|
||||
|
@ -1,12 +1,12 @@
|
||||
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
|
||||
| ^^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
= 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/constant-in-expr-normalize.rs:17:8
|
||||
--> $DIR/constant-in-expr-normalize.rs:21:8
|
||||
|
|
||||
LL | fn foo<'a>(_: &'a u32) -> &'static u32 {
|
||||
| ^^
|
@ -1,5 +1,5 @@
|
||||
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 {
|
||||
| -- lifetime `'a` defined here
|
||||
|
@ -1,3 +1,7 @@
|
||||
// revisions: base nll
|
||||
// ignore-compare-mode-nll
|
||||
//[nll] compile-flags: -Z borrowck=mir
|
||||
|
||||
trait Mirror {
|
||||
type Me;
|
||||
}
|
||||
|
@ -1,12 +1,12 @@
|
||||
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
|
||||
| ^^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
= 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/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 {
|
||||
| ^^
|
@ -1,5 +1,5 @@
|
||||
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 {
|
||||
| -- lifetime `'a` defined here
|
||||
|
@ -1,3 +1,7 @@
|
||||
// revisions: base nll
|
||||
// ignore-compare-mode-nll
|
||||
//[nll] compile-flags: -Z borrowck=mir
|
||||
|
||||
trait Foo<'a> {
|
||||
const C: &'a u32;
|
||||
}
|
||||
|
@ -1,12 +1,12 @@
|
||||
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
|
||||
| ^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
= 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/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 {
|
||||
| ^^
|
@ -1,5 +1,5 @@
|
||||
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 {
|
||||
| -- lifetime `'a` defined here
|
||||
|
@ -1,3 +1,7 @@
|
||||
// revisions: base nll
|
||||
// ignore-compare-mode-nll
|
||||
//[nll] compile-flags: -Z borrowck=mir
|
||||
|
||||
trait Foo<'a> {
|
||||
const C: &'a u32;
|
||||
}
|
||||
|
@ -1,16 +1,16 @@
|
||||
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
|
||||
| ^^^^
|
||||
|
|
||||
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 {
|
||||
| ^^
|
||||
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
|
||||
| ^^^^
|
||||
@ -18,7 +18,7 @@ LL | T::C
|
||||
found `Foo<'a>`
|
||||
= note: but, the lifetime must be valid for the static lifetime...
|
||||
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
|
||||
| ^^^^
|
@ -1,5 +1,5 @@
|
||||
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 {
|
||||
| -- lifetime `'a` defined here
|
||||
|
@ -1,3 +1,7 @@
|
||||
// revisions: base nll
|
||||
// ignore-compare-mode-nll
|
||||
//[nll] compile-flags: -Z borrowck=mir
|
||||
|
||||
trait Foo<'a> {
|
||||
const C: &'a u32;
|
||||
}
|
||||
|
@ -1,5 +1,5 @@
|
||||
error: implementation of `FnOnce` is not general enough
|
||||
--> $DIR/rfc1623.rs:28:8
|
||||
--> $DIR/rfc1623.rs:36:8
|
||||
|
|
||||
LL | f: &id,
|
||||
| ^^^ implementation of `FnOnce` is not general enough
|
@ -1,11 +1,12 @@
|
||||
error[E0308]: mismatched types
|
||||
--> $DIR/rfc1623.rs:25:35
|
||||
--> $DIR/rfc1623.rs:29:35
|
||||
|
|
||||
LL | static SOME_STRUCT: &SomeStruct = &SomeStruct {
|
||||
| ___________________________________^
|
||||
LL | | foo: &Foo { bools: &[false, true] },
|
||||
LL | | bar: &Bar { bools: &[true, true] },
|
||||
LL | | f: &id,
|
||||
LL | |
|
||||
LL | |
|
||||
LL | |
|
||||
... |
|
||||
LL | |
|
||||
LL | | };
|
||||
| |_^ one type is more general than the other
|
||||
@ -14,13 +15,14 @@ LL | | };
|
||||
found type `Fn<(&Foo<'_>,)>`
|
||||
|
||||
error[E0308]: mismatched types
|
||||
--> $DIR/rfc1623.rs:25:35
|
||||
--> $DIR/rfc1623.rs:29:35
|
||||
|
|
||||
LL | static SOME_STRUCT: &SomeStruct = &SomeStruct {
|
||||
| ___________________________________^
|
||||
LL | | foo: &Foo { bools: &[false, true] },
|
||||
LL | | bar: &Bar { bools: &[true, true] },
|
||||
LL | | f: &id,
|
||||
LL | |
|
||||
LL | |
|
||||
LL | |
|
||||
... |
|
||||
LL | |
|
||||
LL | | };
|
||||
| |_^ one type is more general than the other
|
||||
@ -29,13 +31,14 @@ LL | | };
|
||||
found type `Fn<(&Foo<'_>,)>`
|
||||
|
||||
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 | | foo: &Foo { bools: &[false, true] },
|
||||
LL | | bar: &Bar { bools: &[true, true] },
|
||||
LL | | f: &id,
|
||||
LL | |
|
||||
LL | |
|
||||
LL | |
|
||||
... |
|
||||
LL | |
|
||||
LL | | };
|
||||
| |_^ 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`
|
||||
|
||||
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 | | foo: &Foo { bools: &[false, true] },
|
||||
LL | | bar: &Bar { bools: &[true, true] },
|
||||
LL | | f: &id,
|
||||
LL | |
|
||||
LL | |
|
||||
LL | |
|
||||
... |
|
||||
LL | |
|
||||
LL | | };
|
||||
| |_^ implementation of `FnOnce` is not general enough
|
||||
|
@ -1,3 +1,7 @@
|
||||
// revisions: base nll
|
||||
// ignore-compare-mode-nll
|
||||
//[nll] compile-flags: -Z borrowck=mir
|
||||
|
||||
#![allow(dead_code)]
|
||||
|
||||
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 {
|
||||
//[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] },
|
||||
bar: &Bar { bools: &[true, true] },
|
||||
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
|
||||
|
Loading…
Reference in New Issue
Block a user