Update ui tests
This commit is contained in:
parent
994dc4bd1e
commit
bd0895d7d0
51 changed files with 208 additions and 177 deletions
|
|
@ -1,23 +1,24 @@
|
|||
error: unsatisfied lifetime constraints
|
||||
--> $DIR/project-fn-ret-contravariant.rs:53:12
|
||||
--> $DIR/project-fn-ret-contravariant.rs:55:4
|
||||
|
|
||||
LL | fn transmute<'a,'b>(x: &'a u32, y: &'b u32) -> (&'a u32, &'b u32) {
|
||||
| -- -- lifetime `'b` defined here
|
||||
| |
|
||||
| lifetime `'a` defined here
|
||||
LL | let a = bar(foo, y);
|
||||
| ^^^^^^^^^^^ assignment requires that `'b` must outlive `'a`
|
||||
...
|
||||
LL | (a, b) //[krisskross]~ ERROR 55:5: 55:6: lifetime mismatch [E0623]
|
||||
| ^^^^^^ function was supposed to return data with lifetime `'b` but it is returning data with lifetime `'a`
|
||||
|
||||
error: unsatisfied lifetime constraints
|
||||
--> $DIR/project-fn-ret-contravariant.rs:54:12
|
||||
--> $DIR/project-fn-ret-contravariant.rs:55:4
|
||||
|
|
||||
LL | fn transmute<'a,'b>(x: &'a u32, y: &'b u32) -> (&'a u32, &'b u32) {
|
||||
| -- -- lifetime `'b` defined here
|
||||
| |
|
||||
| lifetime `'a` defined here
|
||||
LL | let a = bar(foo, y);
|
||||
LL | let b = bar(foo, x);
|
||||
| ^^^^^^^^^^^ assignment requires that `'a` must outlive `'b`
|
||||
...
|
||||
LL | (a, b) //[krisskross]~ ERROR 55:5: 55:6: lifetime mismatch [E0623]
|
||||
| ^^^^^^ function was supposed to return data with lifetime `'a` but it is returning data with lifetime `'b`
|
||||
|
||||
error: aborting due to 2 previous errors
|
||||
|
||||
|
|
|
|||
|
|
@ -14,7 +14,7 @@ LL | fn baz<'a,'b>(x: &'a u32) -> &'static u32 {
|
|||
| |
|
||||
| lifetime `'a` defined here
|
||||
LL | bar(foo, x) //[transmute]~ ERROR E0495
|
||||
| ^^^^^^^^^^^ requires that `'a` must outlive `'b`
|
||||
| ^^^^^^^^^^^ function was supposed to return data with lifetime `'b` but it is returning data with lifetime `'a`
|
||||
|
||||
error: aborting due to 2 previous errors
|
||||
|
||||
|
|
|
|||
|
|
@ -1,23 +1,24 @@
|
|||
error: unsatisfied lifetime constraints
|
||||
--> $DIR/project-fn-ret-invariant.rs:63:12
|
||||
--> $DIR/project-fn-ret-invariant.rs:65:4
|
||||
|
|
||||
LL | fn transmute<'a,'b>(x: Type<'a>, y: Type<'b>) -> (Type<'a>, Type<'b>) {
|
||||
| -- -- lifetime `'b` defined here
|
||||
| |
|
||||
| lifetime `'a` defined here
|
||||
LL | let a = bar(foo, y); //[krisskross]~ ERROR E0623
|
||||
| ^^^^^^^^^^^ assignment requires that `'b` must outlive `'a`
|
||||
...
|
||||
LL | (a, b) //[krisskross]~ ERROR E0623
|
||||
| ^^^^^^ function was supposed to return data with lifetime `'b` but it is returning data with lifetime `'a`
|
||||
|
||||
error: unsatisfied lifetime constraints
|
||||
--> $DIR/project-fn-ret-invariant.rs:64:12
|
||||
--> $DIR/project-fn-ret-invariant.rs:65:4
|
||||
|
|
||||
LL | fn transmute<'a,'b>(x: Type<'a>, y: Type<'b>) -> (Type<'a>, Type<'b>) {
|
||||
| -- -- lifetime `'b` defined here
|
||||
| |
|
||||
| lifetime `'a` defined here
|
||||
LL | let a = bar(foo, y); //[krisskross]~ ERROR E0623
|
||||
LL | let b = bar(foo, x);
|
||||
| ^^^^^^^^^^^ assignment requires that `'a` must outlive `'b`
|
||||
...
|
||||
LL | (a, b) //[krisskross]~ ERROR E0623
|
||||
| ^^^^^^ function was supposed to return data with lifetime `'a` but it is returning data with lifetime `'b`
|
||||
|
||||
error: aborting due to 2 previous errors
|
||||
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@ LL | bar(foo, x) //[transmute]~ ERROR E0495
|
|||
| ^^^^^^^^^^^ returning this value requires that `'a` must outlive `'static`
|
||||
|
||||
error: unsatisfied lifetime constraints
|
||||
--> $DIR/project-fn-ret-invariant.rs:58:13
|
||||
--> $DIR/project-fn-ret-invariant.rs:58:4
|
||||
|
|
||||
LL | fn baz<'a,'b>(x: Type<'a>) -> Type<'static> {
|
||||
| -- -- lifetime `'b` defined here
|
||||
|
|
@ -16,7 +16,7 @@ LL | fn baz<'a,'b>(x: Type<'a>) -> Type<'static> {
|
|||
| lifetime `'a` defined here
|
||||
...
|
||||
LL | bar(foo, x) //[transmute]~ ERROR E0495
|
||||
| ^ requires that `'a` must outlive `'b`
|
||||
| ^^^^^^^^^^^ function was supposed to return data with lifetime `'b` but it is returning data with lifetime `'a`
|
||||
|
||||
error: aborting due to 2 previous errors
|
||||
|
||||
|
|
|
|||
|
|
@ -36,10 +36,10 @@ LL | move |_| println!("{}", y)
|
|||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^ function was supposed to return data with lifetime `'a` but it is returning data with lifetime `'b`
|
||||
|
||||
error[E0310]: the parameter type `T` may not live long enough
|
||||
--> $DIR/must_outlive_least_region_or_bound.rs:34:5
|
||||
--> $DIR/must_outlive_least_region_or_bound.rs:32:51
|
||||
|
|
||||
LL | x
|
||||
| ^
|
||||
LL | fn ty_param_wont_outlive_static<T:Debug>(x: T) -> impl Debug + 'static {
|
||||
| ^^^^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
= help: consider adding an explicit lifetime bound `T: 'static`...
|
||||
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@ error: unsatisfied lifetime constraints
|
|||
LL | fn iter_values_anon(&self) -> impl Iterator<Item=u32> {
|
||||
| - let's call the lifetime of this reference `'1`
|
||||
LL | self.x.iter().map(|a| a.0)
|
||||
| ^^^^^^ cast requires that `'1` must outlive `'static`
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^ returning this value requires that `'1` must outlive `'static`
|
||||
help: to allow this impl Trait to capture borrowed data with lifetime `'1`, add `'_` as a constraint
|
||||
|
|
||||
LL | fn iter_values_anon(&self) -> impl Iterator<Item=u32> + '_ {
|
||||
|
|
@ -16,7 +16,7 @@ error: unsatisfied lifetime constraints
|
|||
LL | fn iter_values<'a>(&'a self) -> impl Iterator<Item=u32> {
|
||||
| -- lifetime `'a` defined here
|
||||
LL | self.x.iter().map(|a| a.0)
|
||||
| ^^^^^^ cast requires that `'a` must outlive `'static`
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^ returning this value requires that `'a` must outlive `'static`
|
||||
help: to allow this impl Trait to capture borrowed data with lifetime `'a`, add `'a` as a constraint
|
||||
|
|
||||
LL | fn iter_values<'a>(&'a self) -> impl Iterator<Item=u32> + 'a {
|
||||
|
|
|
|||
|
|
@ -1,8 +1,8 @@
|
|||
error[E0310]: the parameter type `T` may not live long enough
|
||||
--> $DIR/type_parameters_captured.rs:19:5
|
||||
--> $DIR/type_parameters_captured.rs:17:20
|
||||
|
|
||||
LL | x
|
||||
| ^
|
||||
LL | fn foo<T>(x: T) -> impl Any + 'static {
|
||||
| ^^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
= help: consider adding an explicit lifetime bound `T: 'static`...
|
||||
|
||||
|
|
|
|||
|
|
@ -1,10 +1,13 @@
|
|||
error: unsatisfied lifetime constraints
|
||||
--> $DIR/issue-10291.rs:12:5
|
||||
--> $DIR/issue-10291.rs:12:65
|
||||
|
|
||||
LL | fn test<'x>(x: &'x isize) {
|
||||
| -- lifetime `'x` defined here
|
||||
LL | drop::<Box<for<'z> FnMut(&'z isize) -> &'z isize>>(Box::new(|z| {
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ requires that `'x` must outlive `'static`
|
||||
LL | fn test<'x>(x: &'x isize) {
|
||||
| -- lifetime `'x` defined here
|
||||
LL | drop::<Box<for<'z> FnMut(&'z isize) -> &'z isize>>(Box::new(|z| {
|
||||
| _________________________________________________________________^
|
||||
LL | | x //~ ERROR E0312
|
||||
LL | | }));
|
||||
| |_____^ closure body requires that `'x` must outlive `'static`
|
||||
|
||||
error: aborting due to previous error
|
||||
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@ LL | fn foo(&mut (ref mut v, w): &mut (&u8, &u8), x: &u8) {
|
|||
| |
|
||||
| let's call the lifetime of this reference `'2`
|
||||
LL | *v = x; //~ ERROR lifetime mismatch
|
||||
| ^^^^^^ requires that `'1` must outlive `'2`
|
||||
| ^^^^^^ assignment requires that `'1` must outlive `'2`
|
||||
|
||||
error: aborting due to previous error
|
||||
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@ LL | fn foo(mut x: Ref, y: Ref) {
|
|||
| |
|
||||
| has type `Ref<'_, '2>`
|
||||
LL | x.b = y.b; //~ ERROR lifetime mismatch
|
||||
| ^^^^^^^^^ requires that `'1` must outlive `'2`
|
||||
| ^^^^^^^^^ assignment requires that `'1` must outlive `'2`
|
||||
|
||||
error: aborting due to previous error
|
||||
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@ LL | fn foo(mut x: Ref) {
|
|||
| has type `Ref<'_, '1>`
|
||||
| has type `Ref<'2, '_>`
|
||||
LL | x.a = x.b; //~ ERROR lifetime mismatch
|
||||
| ^^^^^^^^^ requires that `'1` must outlive `'2`
|
||||
| ^^^^^^^^^ assignment requires that `'1` must outlive `'2`
|
||||
|
||||
error: aborting due to previous error
|
||||
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@ LL | fn foo(mut x: Ref) {
|
|||
| has type `Ref<'_, '1>`
|
||||
| has type `Ref<'2, '_>`
|
||||
LL | x.a = x.b; //~ ERROR lifetime mismatch
|
||||
| ^^^^^^^^^ requires that `'1` must outlive `'2`
|
||||
| ^^^^^^^^^ assignment requires that `'1` must outlive `'2`
|
||||
|
||||
error: aborting due to previous error
|
||||
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@ LL | fn foo(mut x: Ref, y: &u32) {
|
|||
| |
|
||||
| has type `Ref<'_, '1>`
|
||||
LL | y = x.b; //~ ERROR lifetime mismatch
|
||||
| ^^^^^^^ requires that `'1` must outlive `'2`
|
||||
| ^^^^^^^ assignment requires that `'1` must outlive `'2`
|
||||
|
||||
error[E0384]: cannot assign to immutable argument `y`
|
||||
--> $DIR/ex3-both-anon-regions-one-is-struct-2.rs:14:5
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@ LL | fn foo(mut y: Ref, x: &u32) {
|
|||
| |
|
||||
| has type `Ref<'_, '2>`
|
||||
LL | y.b = x; //~ ERROR lifetime mismatch
|
||||
| ^^^^^^^ requires that `'1` must outlive `'2`
|
||||
| ^^^^^^^ assignment requires that `'1` must outlive `'2`
|
||||
|
||||
error: aborting due to previous error
|
||||
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@ LL | fn foo(mut y: Ref, x: &u32) {
|
|||
| |
|
||||
| has type `Ref<'_, '2>`
|
||||
LL | y.b = x; //~ ERROR lifetime mismatch
|
||||
| ^^^^^^^ requires that `'1` must outlive `'2`
|
||||
| ^^^^^^^ assignment requires that `'1` must outlive `'2`
|
||||
|
||||
error: aborting due to previous error
|
||||
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@ LL | fn foo(mut x: Ref, y: &u32) {
|
|||
| |
|
||||
| has type `Ref<'_, '2>`
|
||||
LL | x.b = y; //~ ERROR lifetime mismatch
|
||||
| ^^^^^^^ requires that `'1` must outlive `'2`
|
||||
| ^^^^^^^ assignment requires that `'1` must outlive `'2`
|
||||
|
||||
error: aborting due to previous error
|
||||
|
||||
|
|
|
|||
|
|
@ -13,7 +13,7 @@ error: unsatisfied lifetime constraints
|
|||
--> $DIR/escape-argument-callee.rs:36:45
|
||||
|
|
||||
LL | let mut closure = expect_sig(|p, y| *p = y);
|
||||
| - - ^^^^^^ requires that `'1` must outlive `'2`
|
||||
| - - ^^^^^^ assignment requires that `'1` must outlive `'2`
|
||||
| | |
|
||||
| | has type `&'1 i32`
|
||||
| has type `&mut &'2 i32`
|
||||
|
|
|
|||
|
|
@ -34,19 +34,20 @@ LL | | }
|
|||
= note: defining type: DefId(0/0:6 ~ propagate_approximated_ref[317d]::supply[0]) with substs []
|
||||
|
||||
error: unsatisfied lifetime constraints
|
||||
--> $DIR/propagate-approximated-ref.rs:53:5
|
||||
--> $DIR/propagate-approximated-ref.rs:53:47
|
||||
|
|
||||
LL | fn supply<'a, 'b>(cell_a: Cell<&'a u32>, cell_b: Cell<&'b u32>) {
|
||||
| -- -- lifetime `'b` defined here
|
||||
| |
|
||||
| lifetime `'a` defined here
|
||||
LL | / establish_relationships(&cell_a, &cell_b, |_outlives1, _outlives2, x, y| {
|
||||
LL | establish_relationships(&cell_a, &cell_b, |_outlives1, _outlives2, x, y| {
|
||||
| _______________________________________________^
|
||||
LL | | //~^ ERROR unsatisfied lifetime constraints
|
||||
LL | |
|
||||
LL | | // Only works if 'x: 'y:
|
||||
LL | | demand_y(x, y, x.get())
|
||||
LL | | });
|
||||
| |______^ argument requires that `'a` must outlive `'b`
|
||||
| |_____^ closure body requires that `'a` must outlive `'b`
|
||||
|
||||
error: aborting due to previous error
|
||||
|
||||
|
|
|
|||
|
|
@ -49,14 +49,21 @@ LL | | });
|
|||
| |______^ `cell_a` escapes the function body here
|
||||
|
||||
error: unsatisfied lifetime constraints
|
||||
--> $DIR/propagate-approximated-shorter-to-static-no-bound.rs:45:29
|
||||
--> $DIR/propagate-approximated-shorter-to-static-no-bound.rs:45:47
|
||||
|
|
||||
LL | fn supply<'a, 'b>(cell_a: Cell<&'a u32>, cell_b: Cell<&'b u32>) {
|
||||
| -- -- lifetime `'b` defined here
|
||||
| |
|
||||
| lifetime `'a` defined here
|
||||
LL | establish_relationships(&cell_a, &cell_b, |_outlives, x, y| {
|
||||
| ^^^^^^^ requires that `'a` must outlive `'b`
|
||||
LL | fn supply<'a, 'b>(cell_a: Cell<&'a u32>, cell_b: Cell<&'b u32>) {
|
||||
| -- -- lifetime `'b` defined here
|
||||
| |
|
||||
| lifetime `'a` defined here
|
||||
LL | establish_relationships(&cell_a, &cell_b, |_outlives, x, y| {
|
||||
| _______________________________________________^
|
||||
LL | | //~^ ERROR borrowed data escapes outside of function
|
||||
LL | | //~| ERROR unsatisfied lifetime constraints
|
||||
LL | |
|
||||
LL | | // Only works if 'x: 'y:
|
||||
LL | | demand_y(x, y, x.get())
|
||||
LL | | });
|
||||
| |_____^ closure body requires that `'a` must outlive `'b`
|
||||
|
||||
error: aborting due to 2 previous errors
|
||||
|
||||
|
|
|
|||
|
|
@ -47,14 +47,20 @@ LL | | });
|
|||
| |______^ `cell_a` escapes the function body here
|
||||
|
||||
error: unsatisfied lifetime constraints
|
||||
--> $DIR/propagate-approximated-shorter-to-static-wrong-bound.rs:48:29
|
||||
--> $DIR/propagate-approximated-shorter-to-static-wrong-bound.rs:48:47
|
||||
|
|
||||
LL | fn supply<'a, 'b>(cell_a: Cell<&'a u32>, cell_b: Cell<&'b u32>) {
|
||||
| -- -- lifetime `'b` defined here
|
||||
| |
|
||||
| lifetime `'a` defined here
|
||||
LL | establish_relationships(&cell_a, &cell_b, |_outlives1, _outlives2, x, y| {
|
||||
| ^^^^^^^ requires that `'a` must outlive `'b`
|
||||
LL | fn supply<'a, 'b>(cell_a: Cell<&'a u32>, cell_b: Cell<&'b u32>) {
|
||||
| -- -- lifetime `'b` defined here
|
||||
| |
|
||||
| lifetime `'a` defined here
|
||||
LL | establish_relationships(&cell_a, &cell_b, |_outlives1, _outlives2, x, y| {
|
||||
| _______________________________________________^
|
||||
LL | | //~^ ERROR borrowed data escapes outside of function
|
||||
LL | | //~| ERROR unsatisfied lifetime constraints
|
||||
LL | | // Only works if 'x: 'y:
|
||||
LL | | demand_y(x, y, x.get())
|
||||
LL | | });
|
||||
| |_____^ closure body requires that `'a` must outlive `'b`
|
||||
|
||||
error: aborting due to 2 previous errors
|
||||
|
||||
|
|
|
|||
|
|
@ -34,19 +34,20 @@ LL | | }
|
|||
= note: defining type: DefId(0/0:6 ~ propagate_approximated_val[317d]::test[0]) with substs []
|
||||
|
||||
error: unsatisfied lifetime constraints
|
||||
--> $DIR/propagate-approximated-val.rs:46:5
|
||||
--> $DIR/propagate-approximated-val.rs:46:45
|
||||
|
|
||||
LL | fn test<'a, 'b>(cell_a: Cell<&'a u32>, cell_b: Cell<&'b u32>) {
|
||||
| -- -- lifetime `'b` defined here
|
||||
| |
|
||||
| lifetime `'a` defined here
|
||||
LL | / establish_relationships(cell_a, cell_b, |outlives1, outlives2, x, y| {
|
||||
LL | establish_relationships(cell_a, cell_b, |outlives1, outlives2, x, y| {
|
||||
| _____________________________________________^
|
||||
LL | | //~^ ERROR unsatisfied lifetime constraints
|
||||
LL | |
|
||||
LL | | // Only works if 'x: 'y:
|
||||
LL | | demand_y(outlives1, outlives2, x.get())
|
||||
LL | | });
|
||||
| |______^ argument requires that `'a` must outlive `'b`
|
||||
| |_____^ closure body requires that `'a` must outlive `'b`
|
||||
|
||||
error: aborting due to previous error
|
||||
|
||||
|
|
|
|||
|
|
@ -1,11 +1,11 @@
|
|||
error: borrowed data escapes outside of function
|
||||
error: unsatisfied lifetime constraints
|
||||
--> $DIR/issue-50716.rs:25:14
|
||||
|
|
||||
LL | fn foo<'a, T: 'static>(s: Box<<&'a T as A>::X>)
|
||||
| - `s` is a reference that is only valid in the function body
|
||||
| -- lifetime `'a` defined here
|
||||
...
|
||||
LL | let _x = *s; //~ ERROR
|
||||
| ^^ `s` escapes the function body here
|
||||
| ^^ proving this value is `Sized` requires that `'a` must outlive `'static`
|
||||
|
||||
error: aborting due to previous error
|
||||
|
||||
|
|
|
|||
|
|
@ -40,11 +40,11 @@ fn produce3<'a, 'b: 'a>(data: &'a mut Vec<&'a u32>, value: &'b u32) -> impl Bazi
|
|||
}
|
||||
|
||||
fn produce_err<'a, 'b: 'a>(data: &'b mut Vec<&'b u32>, value: &'a u32) -> impl Bazinga + 'b {
|
||||
let x = move || { //~ ERROR unsatisfied lifetime constraints
|
||||
let x = move || {
|
||||
let value: &'a u32 = value;
|
||||
data.push(value);
|
||||
};
|
||||
x
|
||||
x //~ ERROR unsatisfied lifetime constraints
|
||||
}
|
||||
|
||||
fn main() { }
|
||||
|
|
|
|||
|
|
@ -1,12 +1,13 @@
|
|||
error: unsatisfied lifetime constraints
|
||||
--> $DIR/issue-52113.rs:43:9
|
||||
--> $DIR/issue-52113.rs:47:5
|
||||
|
|
||||
LL | fn produce_err<'a, 'b: 'a>(data: &'b mut Vec<&'b u32>, value: &'a u32) -> impl Bazinga + 'b {
|
||||
| -- -- lifetime `'b` defined here
|
||||
| |
|
||||
| lifetime `'a` defined here
|
||||
LL | let x = move || { //~ ERROR unsatisfied lifetime constraints
|
||||
| ^ requires that `'a` must outlive `'b`
|
||||
...
|
||||
LL | x //~ ERROR unsatisfied lifetime constraints
|
||||
| ^ returning this value requires that `'a` must outlive `'b`
|
||||
|
||||
error: aborting due to previous error
|
||||
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@ LL | fn take_bar(&mut self, b: Bar<'_>) {
|
|||
| |
|
||||
| has type `&mut Foo<'_, '2>`
|
||||
LL | self.y = b.z
|
||||
| ^^^^^^^^^^^^ requires that `'1` must outlive `'2`
|
||||
| ^^^^^^^^^^^^ assignment requires that `'1` must outlive `'2`
|
||||
|
||||
error: aborting due to previous error
|
||||
|
||||
|
|
|
|||
|
|
@ -44,8 +44,8 @@ fn bar<'a>(x: &'a u32) -> &'static u32 {
|
|||
// The MIR type checker must therefore relate `'?0` to `'?1` and `'?2`
|
||||
// as part of checking the `ReifyFnPointer`.
|
||||
let f: fn(_) -> _ = foo;
|
||||
//~^ ERROR unsatisfied lifetime constraints
|
||||
f(x)
|
||||
//~^ ERROR unsatisfied lifetime constraints
|
||||
}
|
||||
|
||||
fn main() {}
|
||||
|
|
|
|||
|
|
@ -1,11 +1,11 @@
|
|||
error: unsatisfied lifetime constraints
|
||||
--> $DIR/mir_check_cast_reify.rs:46:25
|
||||
--> $DIR/mir_check_cast_reify.rs:47:5
|
||||
|
|
||||
LL | fn bar<'a>(x: &'a u32) -> &'static u32 {
|
||||
| -- lifetime `'a` defined here
|
||||
...
|
||||
LL | let f: fn(_) -> _ = foo;
|
||||
| ^^^ cast requires that `'a` must outlive `'static`
|
||||
LL | f(x)
|
||||
| ^^^^ returning this value requires that `'a` must outlive `'static`
|
||||
|
||||
error: aborting due to previous error
|
||||
|
||||
|
|
|
|||
|
|
@ -16,8 +16,8 @@ fn bar<'a>(input: &'a u32, f: fn(&'a u32) -> &'a u32) -> &'static u32 {
|
|||
// Here the NLL checker must relate the types in `f` to the types
|
||||
// in `g`. These are related via the `UnsafeFnPointer` cast.
|
||||
let g: unsafe fn(_) -> _ = f;
|
||||
//~^ ERROR unsatisfied lifetime constraints
|
||||
unsafe { g(input) }
|
||||
//~^ ERROR unsatisfied lifetime constraints
|
||||
}
|
||||
|
||||
fn main() {}
|
||||
|
|
|
|||
|
|
@ -1,11 +1,11 @@
|
|||
error: unsatisfied lifetime constraints
|
||||
--> $DIR/mir_check_cast_unsafe_fn.rs:18:32
|
||||
--> $DIR/mir_check_cast_unsafe_fn.rs:19:14
|
||||
|
|
||||
LL | fn bar<'a>(input: &'a u32, f: fn(&'a u32) -> &'a u32) -> &'static u32 {
|
||||
| -- lifetime `'a` defined here
|
||||
...
|
||||
LL | let g: unsafe fn(_) -> _ = f;
|
||||
| ^ cast requires that `'a` must outlive `'static`
|
||||
LL | unsafe { g(input) }
|
||||
| ^^^^^^^^ returning this value requires that `'a` must outlive `'static`
|
||||
|
||||
error: aborting due to previous error
|
||||
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@ error: unsatisfied lifetime constraints
|
|||
LL | fn bar<'a>(x: &'a u32) -> &'static dyn Debug {
|
||||
| -- lifetime `'a` defined here
|
||||
LL | x
|
||||
| ^ cast requires that `'a` must outlive `'static`
|
||||
| ^ returning this value requires that `'a` must outlive `'static`
|
||||
|
||||
error: aborting due to previous error
|
||||
|
||||
|
|
|
|||
|
|
@ -5,10 +5,10 @@ LL | let a: for<'a, 'b> fn(&'a u32, &'b u32) -> &'a u32 = make_it();
|
|||
| ^^^^^^^^^
|
||||
|
||||
error: higher-ranked subtype error
|
||||
--> $DIR/hr-fn-aaa-as-aba.rs:32:58
|
||||
--> $DIR/hr-fn-aaa-as-aba.rs:32:9
|
||||
|
|
||||
LL | let _: for<'a, 'b> fn(&'a u32, &'b u32) -> &'a u32 = make_it();
|
||||
| ^^^^^^^^^
|
||||
| ^
|
||||
|
||||
error: aborting due to 2 previous errors
|
||||
|
||||
|
|
|
|||
|
|
@ -15,11 +15,11 @@
|
|||
use std::fmt::Debug;
|
||||
|
||||
fn no_region<'a, T>(x: Box<T>) -> impl Debug + 'a
|
||||
//~^ ERROR the parameter type `T` may not live long enough [E0309]
|
||||
where
|
||||
T: Debug,
|
||||
{
|
||||
x
|
||||
//~^ ERROR the parameter type `T` may not live long enough [E0309]
|
||||
}
|
||||
|
||||
fn correct_region<'a, T>(x: Box<T>) -> impl Debug + 'a
|
||||
|
|
@ -30,11 +30,11 @@ where
|
|||
}
|
||||
|
||||
fn wrong_region<'a, 'b, T>(x: Box<T>) -> impl Debug + 'a
|
||||
//~^ ERROR the parameter type `T` may not live long enough [E0309]
|
||||
where
|
||||
T: 'b + Debug,
|
||||
{
|
||||
x
|
||||
//~^ ERROR the parameter type `T` may not live long enough [E0309]
|
||||
}
|
||||
|
||||
fn outlives_region<'a, 'b, T>(x: Box<T>) -> impl Debug + 'a
|
||||
|
|
|
|||
|
|
@ -1,16 +1,16 @@
|
|||
error[E0309]: the parameter type `T` may not live long enough
|
||||
--> $DIR/impl-trait-outlives.rs:21:5
|
||||
--> $DIR/impl-trait-outlives.rs:17:35
|
||||
|
|
||||
LL | x
|
||||
| ^
|
||||
LL | fn no_region<'a, T>(x: Box<T>) -> impl Debug + 'a
|
||||
| ^^^^^^^^^^^^^^^
|
||||
|
|
||||
= help: consider adding an explicit lifetime bound `T: ReEarlyBound(0, 'a)`...
|
||||
|
||||
error[E0309]: the parameter type `T` may not live long enough
|
||||
--> $DIR/impl-trait-outlives.rs:36:5
|
||||
--> $DIR/impl-trait-outlives.rs:32:42
|
||||
|
|
||||
LL | x
|
||||
| ^
|
||||
LL | fn wrong_region<'a, 'b, T>(x: Box<T>) -> impl Debug + 'a
|
||||
| ^^^^^^^^^^^^^^^
|
||||
|
|
||||
= help: consider adding an explicit lifetime bound `T: ReEarlyBound(0, 'a)`...
|
||||
|
||||
|
|
|
|||
|
|
@ -32,17 +32,6 @@ LL | | }
|
|||
T
|
||||
]
|
||||
|
||||
error: unsatisfied lifetime constraints
|
||||
--> $DIR/projection-one-region-closure.rs:55:5
|
||||
|
|
||||
LL | fn no_relationships_late<'a, 'b, T>(cell: Cell<&'a ()>, t: T)
|
||||
| -- -- lifetime `'b` defined here
|
||||
| |
|
||||
| lifetime `'a` defined here
|
||||
...
|
||||
LL | with_signature(cell, t, |cell, t| require(cell, t));
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ argument requires that `'b` must outlive `'a`
|
||||
|
||||
error[E0309]: the parameter type `T` may not live long enough
|
||||
--> $DIR/projection-one-region-closure.rs:55:29
|
||||
|
|
||||
|
|
@ -51,6 +40,17 @@ LL | with_signature(cell, t, |cell, t| require(cell, t));
|
|||
|
|
||||
= help: consider adding an explicit lifetime bound `T: ReFree(DefId(0/0:8 ~ projection_one_region_closure[317d]::no_relationships_late[0]), BrNamed(crate0:DefIndex(1:16), 'a))`...
|
||||
|
||||
error: unsatisfied lifetime constraints
|
||||
--> $DIR/projection-one-region-closure.rs:55:29
|
||||
|
|
||||
LL | fn no_relationships_late<'a, 'b, T>(cell: Cell<&'a ()>, t: T)
|
||||
| -- -- lifetime `'b` defined here
|
||||
| |
|
||||
| lifetime `'a` defined here
|
||||
...
|
||||
LL | with_signature(cell, t, |cell, t| require(cell, t));
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^ closure body requires that `'b` must outlive `'a`
|
||||
|
||||
note: External requirements
|
||||
--> $DIR/projection-one-region-closure.rs:66:29
|
||||
|
|
||||
|
|
@ -86,17 +86,6 @@ LL | | }
|
|||
T
|
||||
]
|
||||
|
||||
error: unsatisfied lifetime constraints
|
||||
--> $DIR/projection-one-region-closure.rs:66:5
|
||||
|
|
||||
LL | fn no_relationships_early<'a, 'b, T>(cell: Cell<&'a ()>, t: T)
|
||||
| -- -- lifetime `'b` defined here
|
||||
| |
|
||||
| lifetime `'a` defined here
|
||||
...
|
||||
LL | with_signature(cell, t, |cell, t| require(cell, t));
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ argument requires that `'b` must outlive `'a`
|
||||
|
||||
error[E0309]: the parameter type `T` may not live long enough
|
||||
--> $DIR/projection-one-region-closure.rs:66:29
|
||||
|
|
||||
|
|
@ -105,6 +94,17 @@ LL | with_signature(cell, t, |cell, t| require(cell, t));
|
|||
|
|
||||
= help: consider adding an explicit lifetime bound `T: ReEarlyBound(0, 'a)`...
|
||||
|
||||
error: unsatisfied lifetime constraints
|
||||
--> $DIR/projection-one-region-closure.rs:66:29
|
||||
|
|
||||
LL | fn no_relationships_early<'a, 'b, T>(cell: Cell<&'a ()>, t: T)
|
||||
| -- -- lifetime `'b` defined here
|
||||
| |
|
||||
| lifetime `'a` defined here
|
||||
...
|
||||
LL | with_signature(cell, t, |cell, t| require(cell, t));
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^ closure body requires that `'b` must outlive `'a`
|
||||
|
||||
note: External requirements
|
||||
--> $DIR/projection-one-region-closure.rs:87:29
|
||||
|
|
||||
|
|
@ -140,17 +140,6 @@ LL | | }
|
|||
T
|
||||
]
|
||||
|
||||
error: unsatisfied lifetime constraints
|
||||
--> $DIR/projection-one-region-closure.rs:87:5
|
||||
|
|
||||
LL | fn projection_outlives<'a, 'b, T>(cell: Cell<&'a ()>, t: T)
|
||||
| -- -- lifetime `'b` defined here
|
||||
| |
|
||||
| lifetime `'a` defined here
|
||||
...
|
||||
LL | with_signature(cell, t, |cell, t| require(cell, t));
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ argument requires that `'b` must outlive `'a`
|
||||
|
||||
error[E0309]: the parameter type `T` may not live long enough
|
||||
--> $DIR/projection-one-region-closure.rs:87:29
|
||||
|
|
||||
|
|
@ -159,6 +148,17 @@ LL | with_signature(cell, t, |cell, t| require(cell, t));
|
|||
|
|
||||
= help: consider adding an explicit lifetime bound `T: ReEarlyBound(0, 'a)`...
|
||||
|
||||
error: unsatisfied lifetime constraints
|
||||
--> $DIR/projection-one-region-closure.rs:87:29
|
||||
|
|
||||
LL | fn projection_outlives<'a, 'b, T>(cell: Cell<&'a ()>, t: T)
|
||||
| -- -- lifetime `'b` defined here
|
||||
| |
|
||||
| lifetime `'a` defined here
|
||||
...
|
||||
LL | with_signature(cell, t, |cell, t| require(cell, t));
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^ closure body requires that `'b` must outlive `'a`
|
||||
|
||||
note: External requirements
|
||||
--> $DIR/projection-one-region-closure.rs:99:29
|
||||
|
|
||||
|
|
|
|||
|
|
@ -32,7 +32,7 @@ LL | | }
|
|||
]
|
||||
|
||||
error: unsatisfied lifetime constraints
|
||||
--> $DIR/projection-one-region-trait-bound-closure.rs:47:5
|
||||
--> $DIR/projection-one-region-trait-bound-closure.rs:47:29
|
||||
|
|
||||
LL | fn no_relationships_late<'a, 'b, T>(cell: Cell<&'a ()>, t: T)
|
||||
| -- -- lifetime `'b` defined here
|
||||
|
|
@ -40,7 +40,7 @@ LL | fn no_relationships_late<'a, 'b, T>(cell: Cell<&'a ()>, t: T)
|
|||
| lifetime `'a` defined here
|
||||
...
|
||||
LL | with_signature(cell, t, |cell, t| require(cell, t));
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ argument requires that `'b` must outlive `'a`
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^ closure body requires that `'b` must outlive `'a`
|
||||
|
||||
note: External requirements
|
||||
--> $DIR/projection-one-region-trait-bound-closure.rs:57:29
|
||||
|
|
@ -77,7 +77,7 @@ LL | | }
|
|||
]
|
||||
|
||||
error: unsatisfied lifetime constraints
|
||||
--> $DIR/projection-one-region-trait-bound-closure.rs:57:5
|
||||
--> $DIR/projection-one-region-trait-bound-closure.rs:57:29
|
||||
|
|
||||
LL | fn no_relationships_early<'a, 'b, T>(cell: Cell<&'a ()>, t: T)
|
||||
| -- -- lifetime `'b` defined here
|
||||
|
|
@ -85,7 +85,7 @@ LL | fn no_relationships_early<'a, 'b, T>(cell: Cell<&'a ()>, t: T)
|
|||
| lifetime `'a` defined here
|
||||
...
|
||||
LL | with_signature(cell, t, |cell, t| require(cell, t));
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ argument requires that `'b` must outlive `'a`
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^ closure body requires that `'b` must outlive `'a`
|
||||
|
||||
note: External requirements
|
||||
--> $DIR/projection-one-region-trait-bound-closure.rs:77:29
|
||||
|
|
@ -122,7 +122,7 @@ LL | | }
|
|||
]
|
||||
|
||||
error: unsatisfied lifetime constraints
|
||||
--> $DIR/projection-one-region-trait-bound-closure.rs:77:5
|
||||
--> $DIR/projection-one-region-trait-bound-closure.rs:77:29
|
||||
|
|
||||
LL | fn projection_outlives<'a, 'b, T>(cell: Cell<&'a ()>, t: T)
|
||||
| -- -- lifetime `'b` defined here
|
||||
|
|
@ -130,7 +130,7 @@ LL | fn projection_outlives<'a, 'b, T>(cell: Cell<&'a ()>, t: T)
|
|||
| lifetime `'a` defined here
|
||||
...
|
||||
LL | with_signature(cell, t, |cell, t| require(cell, t));
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ argument requires that `'b` must outlive `'a`
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^ closure body requires that `'b` must outlive `'a`
|
||||
|
||||
note: External requirements
|
||||
--> $DIR/projection-one-region-trait-bound-closure.rs:87:29
|
||||
|
|
|
|||
|
|
@ -235,7 +235,7 @@ LL | | }
|
|||
]
|
||||
|
||||
error: unsatisfied lifetime constraints
|
||||
--> $DIR/projection-two-region-trait-bound-closure.rs:105:5
|
||||
--> $DIR/projection-two-region-trait-bound-closure.rs:105:29
|
||||
|
|
||||
LL | fn two_regions<'a, 'b, T>(cell: Cell<&'a ()>, t: T)
|
||||
| -- -- lifetime `'b` defined here
|
||||
|
|
@ -243,7 +243,7 @@ LL | fn two_regions<'a, 'b, T>(cell: Cell<&'a ()>, t: T)
|
|||
| lifetime `'a` defined here
|
||||
...
|
||||
LL | with_signature(cell, t, |cell, t| require(cell, t));
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ argument requires that `'b` must outlive `'a`
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^ closure body requires that `'b` must outlive `'a`
|
||||
|
||||
note: External requirements
|
||||
--> $DIR/projection-two-region-trait-bound-closure.rs:115:29
|
||||
|
|
|
|||
|
|
@ -131,12 +131,12 @@ LL | y //~ ERROR
|
|||
| ^ returning this value requires that `'a` must outlive `'static`
|
||||
|
||||
error: unsatisfied lifetime constraints
|
||||
--> $DIR/patterns.rs:117:40
|
||||
--> $DIR/patterns.rs:117:9
|
||||
|
|
||||
LL | fn a_to_static_then_static<'a>(x: &'a u32) -> &'static u32 {
|
||||
| -- lifetime `'a` defined here
|
||||
LL | let (y, _z): (&'static u32, u32) = (x, 44); //~ ERROR
|
||||
| ^^^^^^^ requires that `'a` must outlive `'static`
|
||||
| ^^^^^^^ type annotation requires that `'a` must outlive `'static`
|
||||
|
||||
error: aborting due to 14 previous errors
|
||||
|
||||
|
|
|
|||
|
|
@ -1,10 +1,10 @@
|
|||
error: borrowed data escapes outside of function
|
||||
error: unsatisfied lifetime constraints
|
||||
--> $DIR/object-lifetime-default-from-rptr-box-error.rs:25:5
|
||||
|
|
||||
LL | fn c<'a>(t: &'a Box<Test+'a>, mut ss: SomeStruct<'a>) {
|
||||
| - `t` is a reference that is only valid in the function body
|
||||
| -- lifetime `'a` defined here
|
||||
LL | ss.t = t; //~ ERROR mismatched types
|
||||
| ^^^^^^^^ `t` escapes the function body here
|
||||
| ^^^^^^^^ assignment requires that `'a` must outlive `'static`
|
||||
|
||||
error: aborting due to previous error
|
||||
|
||||
|
|
|
|||
|
|
@ -1,10 +1,10 @@
|
|||
error: borrowed data escapes outside of function
|
||||
error: unsatisfied lifetime constraints
|
||||
--> $DIR/object-lifetime-default-from-rptr-struct-error.rs:31:5
|
||||
|
|
||||
LL | fn c<'a>(t: &'a MyBox<Test+'a>, mut ss: SomeStruct<'a>) {
|
||||
| - `t` is a reference that is only valid in the function body
|
||||
| -- lifetime `'a` defined here
|
||||
LL | ss.t = t; //~ ERROR mismatched types
|
||||
| ^^^^^^^^ `t` escapes the function body here
|
||||
| ^^^^^^^^ assignment requires that `'a` must outlive `'static`
|
||||
|
||||
error: aborting due to previous error
|
||||
|
||||
|
|
|
|||
|
|
@ -1,10 +1,10 @@
|
|||
error[E0621]: explicit lifetime required in the type of `v`
|
||||
--> $DIR/region-object-lifetime-in-coercion.rs:18:33
|
||||
--> $DIR/region-object-lifetime-in-coercion.rs:18:9
|
||||
|
|
||||
LL | fn a(v: &[u8]) -> Box<Foo + 'static> {
|
||||
| ----- help: add explicit lifetime `'static` to the type of `v`: `&'static [u8]`
|
||||
LL | let x: Box<Foo + 'static> = Box::new(v);
|
||||
| ^^^^^^^^^^^ lifetime `'static` required
|
||||
| ^ lifetime `'static` required
|
||||
|
||||
error[E0621]: explicit lifetime required in the type of `v`
|
||||
--> $DIR/region-object-lifetime-in-coercion.rs:24:5
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@ error: unsatisfied lifetime constraints
|
|||
LL | pub fn chase_cat(&mut self) {
|
||||
| - let's call the lifetime of this reference `'1`
|
||||
LL | let p: &'static mut usize = &mut self.cats_chased; //~ ERROR cannot infer
|
||||
| ^ requires that `'1` must outlive `'static`
|
||||
| ^ type annotation requires that `'1` must outlive `'static`
|
||||
|
||||
error: aborting due to previous error
|
||||
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@ error: unsatisfied lifetime constraints
|
|||
LL | let _f = || {
|
||||
| -- lifetime `'1` represents this closure's body
|
||||
LL | let p: &'static mut usize = &mut self.food; //~ ERROR cannot infer
|
||||
| ^ requires that `'1` must outlive `'static`
|
||||
| ^ type annotation requires that `'1` must outlive `'static`
|
||||
|
|
||||
= note: closure implements `FnMut`, so references to captured variables can't escape the closure
|
||||
|
||||
|
|
@ -16,17 +16,21 @@ LL | pub fn chase_cat(&mut self) {
|
|||
LL | let _f = || {
|
||||
| -- lifetime `'1` represents this closure's body
|
||||
LL | let p: &'static mut usize = &mut self.food; //~ ERROR cannot infer
|
||||
| ^ requires that `'1` must outlive `'2`
|
||||
| ^ type annotation requires that `'1` must outlive `'2`
|
||||
|
|
||||
= note: closure implements `FnMut`, so references to captured variables can't escape the closure
|
||||
|
||||
error: unsatisfied lifetime constraints
|
||||
--> $DIR/regions-addr-of-upvar-self.rs:19:13
|
||||
--> $DIR/regions-addr-of-upvar-self.rs:19:18
|
||||
|
|
||||
LL | pub fn chase_cat(&mut self) {
|
||||
| - let's call the lifetime of this reference `'1`
|
||||
LL | let _f = || {
|
||||
| ^^ requires that `'1` must outlive `'static`
|
||||
LL | pub fn chase_cat(&mut self) {
|
||||
| - let's call the lifetime of this reference `'1`
|
||||
LL | let _f = || {
|
||||
| __________________^
|
||||
LL | | let p: &'static mut usize = &mut self.food; //~ ERROR cannot infer
|
||||
LL | | *p = 3;
|
||||
LL | | };
|
||||
| |_________^ closure body requires that `'1` must outlive `'static`
|
||||
|
||||
error[E0597]: `self` does not live long enough
|
||||
--> $DIR/regions-addr-of-upvar-self.rs:20:46
|
||||
|
|
|
|||
|
|
@ -1,10 +1,10 @@
|
|||
error: unsatisfied lifetime constraints
|
||||
--> $DIR/regions-close-object-into-object-2.rs:20:11
|
||||
--> $DIR/regions-close-object-into-object-2.rs:20:5
|
||||
|
|
||||
LL | fn g<'a, T: 'static>(v: Box<A<T>+'a>) -> Box<X+'static> {
|
||||
| -- lifetime `'a` defined here
|
||||
LL | box B(&*v) as Box<X> //~ ERROR cannot infer
|
||||
| ^^^ cast requires that `'a` must outlive `'static`
|
||||
| ^^^^^^^^^^^^^^^^^^^^ returning this value requires that `'a` must outlive `'static`
|
||||
|
||||
error[E0597]: `*v` does not live long enough
|
||||
--> $DIR/regions-close-object-into-object-2.rs:20:11
|
||||
|
|
|
|||
|
|
@ -6,6 +6,14 @@ LL | box B(&*v) as Box<X> //~ ERROR cannot infer
|
|||
|
|
||||
= help: consider adding an explicit lifetime bound `U: 'static`...
|
||||
|
||||
error: unsatisfied lifetime constraints
|
||||
--> $DIR/regions-close-object-into-object-4.rs:20:5
|
||||
|
|
||||
LL | fn i<'a, T, U>(v: Box<A<U>+'a>) -> Box<X+'static> {
|
||||
| -- lifetime `'a` defined here
|
||||
LL | box B(&*v) as Box<X> //~ ERROR cannot infer
|
||||
| ^^^^^^^^^^^^^^^^^^^^ returning this value requires that `'a` must outlive `'static`
|
||||
|
||||
error[E0310]: the parameter type `U` may not live long enough
|
||||
--> $DIR/regions-close-object-into-object-4.rs:20:9
|
||||
|
|
||||
|
|
@ -14,14 +22,6 @@ LL | box B(&*v) as Box<X> //~ ERROR cannot infer
|
|||
|
|
||||
= help: consider adding an explicit lifetime bound `U: 'static`...
|
||||
|
||||
error: unsatisfied lifetime constraints
|
||||
--> $DIR/regions-close-object-into-object-4.rs:20:11
|
||||
|
|
||||
LL | fn i<'a, T, U>(v: Box<A<U>+'a>) -> Box<X+'static> {
|
||||
| -- lifetime `'a` defined here
|
||||
LL | box B(&*v) as Box<X> //~ ERROR cannot infer
|
||||
| ^^^ cast requires that `'a` must outlive `'static`
|
||||
|
||||
error[E0597]: `*v` does not live long enough
|
||||
--> $DIR/regions-close-object-into-object-4.rs:20:11
|
||||
|
|
||||
|
|
|
|||
|
|
@ -18,7 +18,7 @@ LL | fn ordering3<'a, 'b>(x: &'a usize, y: &'b usize) -> &'a &'b usize {
|
|||
| lifetime `'a` defined here
|
||||
LL | // Do not infer an ordering from the return value.
|
||||
LL | let z: &'b usize = &*x;
|
||||
| ^^^ requires that `'a` must outlive `'b`
|
||||
| ^^^ assignment requires that `'a` must outlive `'b`
|
||||
|
||||
error: aborting due to 2 previous errors
|
||||
|
||||
|
|
|
|||
|
|
@ -1,22 +1,14 @@
|
|||
error: unsatisfied lifetime constraints
|
||||
error: borrowed data escapes outside of closure
|
||||
--> $DIR/regions-nested-fns.rs:20:9
|
||||
|
|
||||
LL | let mut ay = &y; //~ ERROR E0495
|
||||
| ------ lifetime `'2` appears in the type of `ay`
|
||||
| ------ `ay` is declared here, outside of the closure body
|
||||
LL |
|
||||
LL | ignore::<Box<for<'z> FnMut(&'z isize)>>(Box::new(|z| {
|
||||
| - has type `&'1 isize`
|
||||
| - `z` is a reference that is only valid in the closure body
|
||||
...
|
||||
LL | ay = z;
|
||||
| ^^^^^^ requires that `'1` must outlive `'2`
|
||||
|
||||
error: unsatisfied lifetime constraints
|
||||
--> $DIR/regions-nested-fns.rs:14:9
|
||||
|
|
||||
LL | fn nested<'x>(x: &'x isize) {
|
||||
| -- lifetime `'x` defined here
|
||||
LL | let y = 3;
|
||||
| ^ requires that `'x` must outlive `'static`
|
||||
| ^^^^^^ `z` escapes the closure body here
|
||||
|
||||
error[E0597]: `y` does not live long enough
|
||||
--> $DIR/regions-nested-fns.rs:15:18
|
||||
|
|
@ -43,6 +35,20 @@ LL | }
|
|||
|
|
||||
= note: borrowed value must be valid for the static lifetime...
|
||||
|
||||
error: unsatisfied lifetime constraints
|
||||
--> $DIR/regions-nested-fns.rs:23:68
|
||||
|
|
||||
LL | fn nested<'x>(x: &'x isize) {
|
||||
| -- lifetime `'x` defined here
|
||||
...
|
||||
LL | ignore::< Box<for<'z> FnMut(&'z isize) -> &'z isize>>(Box::new(|z| {
|
||||
| ____________________________________________________________________^
|
||||
LL | | if false { return x; } //~ ERROR E0312
|
||||
LL | | if false { return ay; }
|
||||
LL | | return z;
|
||||
LL | | }));
|
||||
| |_____^ closure body requires that `'x` must outlive `'static`
|
||||
|
||||
error: aborting due to 4 previous errors
|
||||
|
||||
For more information about this error, try `rustc --explain E0597`.
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@ LL | fn foo3<'a,'b>(x: &'a mut Dummy) -> &'b mut Dummy {
|
|||
| lifetime `'a` defined here
|
||||
LL | // Without knowing 'a:'b, we can't coerce
|
||||
LL | x //~ ERROR lifetime bound not satisfied
|
||||
| ^ returning this value requires that `'a` must outlive `'b`
|
||||
| ^ cast requires that `'a` must outlive `'b`
|
||||
|
||||
error: unsatisfied lifetime constraints
|
||||
--> $DIR/regions-trait-object-subtyping.rs:32:5
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@ LL | fn a<T>(items: &[T]) -> Box<dyn Iterator<Item=&T>> {
|
|||
| - let's call the lifetime of this reference `'1`
|
||||
LL | // ^^^^^^^^^^^^^^^^^^^^^ bound *here* defaults to `'static`
|
||||
LL | Box::new(items.iter()) //~ ERROR cannot infer an appropriate lifetime
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^ cast requires that `'1` must outlive `'static`
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^ returning this value requires that `'1` must outlive `'static`
|
||||
|
||||
error: aborting due to previous error
|
||||
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@ LL | fn get_min_from_max<'min, 'max>(v: Box<Get<&'max i32>>)
|
|||
| lifetime `'min` defined here
|
||||
...
|
||||
LL | v //~ ERROR mismatched types
|
||||
| ^ cast requires that `'min` must outlive `'max`
|
||||
| ^ returning this value requires that `'min` must outlive `'max`
|
||||
|
||||
error: unsatisfied lifetime constraints
|
||||
--> $DIR/variance-contravariant-arg-object.rs:32:5
|
||||
|
|
@ -18,7 +18,7 @@ LL | fn get_max_from_min<'min, 'max, G>(v: Box<Get<&'min i32>>)
|
|||
| lifetime `'min` defined here
|
||||
...
|
||||
LL | v //~ ERROR mismatched types
|
||||
| ^ cast requires that `'min` must outlive `'max`
|
||||
| ^ returning this value requires that `'min` must outlive `'max`
|
||||
|
||||
error: aborting due to 2 previous errors
|
||||
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@ LL | fn get_min_from_max<'min, 'max>(v: Box<Get<&'max i32>>)
|
|||
| lifetime `'min` defined here
|
||||
...
|
||||
LL | v //~ ERROR mismatched types
|
||||
| ^ cast requires that `'min` must outlive `'max`
|
||||
| ^ returning this value requires that `'min` must outlive `'max`
|
||||
|
||||
error: unsatisfied lifetime constraints
|
||||
--> $DIR/variance-covariant-arg-object.rs:32:5
|
||||
|
|
@ -18,7 +18,7 @@ LL | fn get_max_from_min<'min, 'max, G>(v: Box<Get<&'min i32>>)
|
|||
| lifetime `'min` defined here
|
||||
...
|
||||
LL | v //~ ERROR mismatched types
|
||||
| ^ cast requires that `'min` must outlive `'max`
|
||||
| ^ returning this value requires that `'min` must outlive `'max`
|
||||
|
||||
error: aborting due to 2 previous errors
|
||||
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@ LL | fn get_min_from_max<'min, 'max>(v: Box<Get<&'max i32>>)
|
|||
| lifetime `'min` defined here
|
||||
...
|
||||
LL | v //~ ERROR mismatched types
|
||||
| ^ cast requires that `'min` must outlive `'max`
|
||||
| ^ returning this value requires that `'min` must outlive `'max`
|
||||
|
||||
error: unsatisfied lifetime constraints
|
||||
--> $DIR/variance-invariant-arg-object.rs:28:5
|
||||
|
|
@ -18,7 +18,7 @@ LL | fn get_max_from_min<'min, 'max, G>(v: Box<Get<&'min i32>>)
|
|||
| lifetime `'min` defined here
|
||||
...
|
||||
LL | v //~ ERROR mismatched types
|
||||
| ^ cast requires that `'min` must outlive `'max`
|
||||
| ^ returning this value requires that `'min` must outlive `'max`
|
||||
|
||||
error: aborting due to 2 previous errors
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue