diff options
| author | Matthew Jasper <mjjasper1@gmail.com> | 2018-09-15 18:30:29 +0100 |
|---|---|---|
| committer | Matthew Jasper <mjjasper1@gmail.com> | 2018-09-19 20:50:09 +0100 |
| commit | bd0895d7d011cc4c6bef4f95e6df64d2fee6ff73 (patch) | |
| tree | 146b8e71049cc840d5a99f42d9f96da9882f53da | |
| parent | 994dc4bd1ef01b45408750679d9ec46bc1c2ff33 (diff) | |
| download | rust-bd0895d7d011cc4c6bef4f95e6df64d2fee6ff73.tar.gz rust-bd0895d7d011cc4c6bef4f95e6df64d2fee6ff73.zip | |
Update ui tests
51 files changed, 205 insertions, 174 deletions
diff --git a/src/test/ui/associated-types/cache/project-fn-ret-contravariant.krisskross.nll.stderr b/src/test/ui/associated-types/cache/project-fn-ret-contravariant.krisskross.nll.stderr index b61ea27ebe1..044a3f70b4a 100644 --- a/src/test/ui/associated-types/cache/project-fn-ret-contravariant.krisskross.nll.stderr +++ b/src/test/ui/associated-types/cache/project-fn-ret-contravariant.krisskross.nll.stderr @@ -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 diff --git a/src/test/ui/associated-types/cache/project-fn-ret-contravariant.transmute.nll.stderr b/src/test/ui/associated-types/cache/project-fn-ret-contravariant.transmute.nll.stderr index 2f632fec17e..10f70b525e0 100644 --- a/src/test/ui/associated-types/cache/project-fn-ret-contravariant.transmute.nll.stderr +++ b/src/test/ui/associated-types/cache/project-fn-ret-contravariant.transmute.nll.stderr @@ -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 diff --git a/src/test/ui/associated-types/cache/project-fn-ret-invariant.krisskross.nll.stderr b/src/test/ui/associated-types/cache/project-fn-ret-invariant.krisskross.nll.stderr index 971448997e3..1cb68785694 100644 --- a/src/test/ui/associated-types/cache/project-fn-ret-invariant.krisskross.nll.stderr +++ b/src/test/ui/associated-types/cache/project-fn-ret-invariant.krisskross.nll.stderr @@ -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 diff --git a/src/test/ui/associated-types/cache/project-fn-ret-invariant.transmute.nll.stderr b/src/test/ui/associated-types/cache/project-fn-ret-invariant.transmute.nll.stderr index 63e1f665005..2329adb5dea 100644 --- a/src/test/ui/associated-types/cache/project-fn-ret-invariant.transmute.nll.stderr +++ b/src/test/ui/associated-types/cache/project-fn-ret-invariant.transmute.nll.stderr @@ -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 diff --git a/src/test/ui/impl-trait/must_outlive_least_region_or_bound.nll.stderr b/src/test/ui/impl-trait/must_outlive_least_region_or_bound.nll.stderr index 3019e3aa1f7..485d3566244 100644 --- a/src/test/ui/impl-trait/must_outlive_least_region_or_bound.nll.stderr +++ b/src/test/ui/impl-trait/must_outlive_least_region_or_bound.nll.stderr @@ -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`... diff --git a/src/test/ui/impl-trait/static-return-lifetime-infered.nll.stderr b/src/test/ui/impl-trait/static-return-lifetime-infered.nll.stderr index 4bc8876c232..7e9aa90c6c5 100644 --- a/src/test/ui/impl-trait/static-return-lifetime-infered.nll.stderr +++ b/src/test/ui/impl-trait/static-return-lifetime-infered.nll.stderr @@ -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 { diff --git a/src/test/ui/impl-trait/type_parameters_captured.nll.stderr b/src/test/ui/impl-trait/type_parameters_captured.nll.stderr index 3c2c86fffde..18258ef1f9d 100644 --- a/src/test/ui/impl-trait/type_parameters_captured.nll.stderr +++ b/src/test/ui/impl-trait/type_parameters_captured.nll.stderr @@ -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`... diff --git a/src/test/ui/issues/issue-10291.nll.stderr b/src/test/ui/issues/issue-10291.nll.stderr index d19c4d880c7..201a3b3d54a 100644 --- a/src/test/ui/issues/issue-10291.nll.stderr +++ b/src/test/ui/issues/issue-10291.nll.stderr @@ -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 diff --git a/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-2.nll.stderr b/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-2.nll.stderr index 017c3e97747..e4aafd7b66e 100644 --- a/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-2.nll.stderr +++ b/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-2.nll.stderr @@ -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 diff --git a/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-both-are-structs-2.nll.stderr b/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-both-are-structs-2.nll.stderr index b8e1b483081..934cdcd2ef2 100644 --- a/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-both-are-structs-2.nll.stderr +++ b/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-both-are-structs-2.nll.stderr @@ -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 diff --git a/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-both-are-structs-3.nll.stderr b/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-both-are-structs-3.nll.stderr index 4b7352fe224..cbfd9d47809 100644 --- a/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-both-are-structs-3.nll.stderr +++ b/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-both-are-structs-3.nll.stderr @@ -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 diff --git a/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-both-are-structs-4.nll.stderr b/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-both-are-structs-4.nll.stderr index 53a2fef4806..4f0efe24cf7 100644 --- a/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-both-are-structs-4.nll.stderr +++ b/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-both-are-structs-4.nll.stderr @@ -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 diff --git a/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-one-is-struct-2.nll.stderr b/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-one-is-struct-2.nll.stderr index 1a5f788e143..fc1fab7aab5 100644 --- a/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-one-is-struct-2.nll.stderr +++ b/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-one-is-struct-2.nll.stderr @@ -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 diff --git a/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-one-is-struct-3.nll.stderr b/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-one-is-struct-3.nll.stderr index d098354d983..8100fa89c2d 100644 --- a/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-one-is-struct-3.nll.stderr +++ b/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-one-is-struct-3.nll.stderr @@ -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 diff --git a/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-one-is-struct-4.nll.stderr b/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-one-is-struct-4.nll.stderr index 17a70aa85be..1c4a8b66589 100644 --- a/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-one-is-struct-4.nll.stderr +++ b/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-one-is-struct-4.nll.stderr @@ -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 diff --git a/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-one-is-struct.nll.stderr b/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-one-is-struct.nll.stderr index 2ebdedddc50..2a4c5a685f1 100644 --- a/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-one-is-struct.nll.stderr +++ b/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-one-is-struct.nll.stderr @@ -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 diff --git a/src/test/ui/nll/closure-requirements/escape-argument-callee.stderr b/src/test/ui/nll/closure-requirements/escape-argument-callee.stderr index 72b60188c4c..1f9cb6d050f 100644 --- a/src/test/ui/nll/closure-requirements/escape-argument-callee.stderr +++ b/src/test/ui/nll/closure-requirements/escape-argument-callee.stderr @@ -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` diff --git a/src/test/ui/nll/closure-requirements/propagate-approximated-ref.stderr b/src/test/ui/nll/closure-requirements/propagate-approximated-ref.stderr index 1af96b97e73..2e1249a5e81 100644 --- a/src/test/ui/nll/closure-requirements/propagate-approximated-ref.stderr +++ b/src/test/ui/nll/closure-requirements/propagate-approximated-ref.stderr @@ -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 diff --git a/src/test/ui/nll/closure-requirements/propagate-approximated-shorter-to-static-no-bound.stderr b/src/test/ui/nll/closure-requirements/propagate-approximated-shorter-to-static-no-bound.stderr index 9de9e21ba43..9f1d9d21d11 100644 --- a/src/test/ui/nll/closure-requirements/propagate-approximated-shorter-to-static-no-bound.stderr +++ b/src/test/ui/nll/closure-requirements/propagate-approximated-shorter-to-static-no-bound.stderr @@ -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 diff --git a/src/test/ui/nll/closure-requirements/propagate-approximated-shorter-to-static-wrong-bound.stderr b/src/test/ui/nll/closure-requirements/propagate-approximated-shorter-to-static-wrong-bound.stderr index 6acb6750055..4e72fe4bb28 100644 --- a/src/test/ui/nll/closure-requirements/propagate-approximated-shorter-to-static-wrong-bound.stderr +++ b/src/test/ui/nll/closure-requirements/propagate-approximated-shorter-to-static-wrong-bound.stderr @@ -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 diff --git a/src/test/ui/nll/closure-requirements/propagate-approximated-val.stderr b/src/test/ui/nll/closure-requirements/propagate-approximated-val.stderr index e0902ca1ddb..de60b23ef6b 100644 --- a/src/test/ui/nll/closure-requirements/propagate-approximated-val.stderr +++ b/src/test/ui/nll/closure-requirements/propagate-approximated-val.stderr @@ -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 diff --git a/src/test/ui/nll/issue-50716.stderr b/src/test/ui/nll/issue-50716.stderr index f12ab9b4f96..eddad056995 100644 --- a/src/test/ui/nll/issue-50716.stderr +++ b/src/test/ui/nll/issue-50716.stderr @@ -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 diff --git a/src/test/ui/nll/issue-52113.rs b/src/test/ui/nll/issue-52113.rs index e484c249d84..af577e8499b 100644 --- a/src/test/ui/nll/issue-52113.rs +++ b/src/test/ui/nll/issue-52113.rs @@ -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() { } diff --git a/src/test/ui/nll/issue-52113.stderr b/src/test/ui/nll/issue-52113.stderr index b21539361e6..45a192de454 100644 --- a/src/test/ui/nll/issue-52113.stderr +++ b/src/test/ui/nll/issue-52113.stderr @@ -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 diff --git a/src/test/ui/nll/issue-52742.stderr b/src/test/ui/nll/issue-52742.stderr index 515ba55cf6f..83a594941c0 100644 --- a/src/test/ui/nll/issue-52742.stderr +++ b/src/test/ui/nll/issue-52742.stderr @@ -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 diff --git a/src/test/ui/nll/mir_check_cast_reify.rs b/src/test/ui/nll/mir_check_cast_reify.rs index 332ec7a7da2..c878be9e2a2 100644 --- a/src/test/ui/nll/mir_check_cast_reify.rs +++ b/src/test/ui/nll/mir_check_cast_reify.rs @@ -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() {} diff --git a/src/test/ui/nll/mir_check_cast_reify.stderr b/src/test/ui/nll/mir_check_cast_reify.stderr index fa5c4100c91..fdb71b17287 100644 --- a/src/test/ui/nll/mir_check_cast_reify.stderr +++ b/src/test/ui/nll/mir_check_cast_reify.stderr @@ -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 diff --git a/src/test/ui/nll/mir_check_cast_unsafe_fn.rs b/src/test/ui/nll/mir_check_cast_unsafe_fn.rs index 937ab31c315..be91a946857 100644 --- a/src/test/ui/nll/mir_check_cast_unsafe_fn.rs +++ b/src/test/ui/nll/mir_check_cast_unsafe_fn.rs @@ -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() {} diff --git a/src/test/ui/nll/mir_check_cast_unsafe_fn.stderr b/src/test/ui/nll/mir_check_cast_unsafe_fn.stderr index 82ff71c0551..c14fb93a525 100644 --- a/src/test/ui/nll/mir_check_cast_unsafe_fn.stderr +++ b/src/test/ui/nll/mir_check_cast_unsafe_fn.stderr @@ -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 diff --git a/src/test/ui/nll/mir_check_cast_unsize.stderr b/src/test/ui/nll/mir_check_cast_unsize.stderr index 77a2e8311f0..526dfb60133 100644 --- a/src/test/ui/nll/mir_check_cast_unsize.stderr +++ b/src/test/ui/nll/mir_check_cast_unsize.stderr @@ -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 diff --git a/src/test/ui/nll/relate_tys/hr-fn-aaa-as-aba.stderr b/src/test/ui/nll/relate_tys/hr-fn-aaa-as-aba.stderr index c9195395b87..9a83872b965 100644 --- a/src/test/ui/nll/relate_tys/hr-fn-aaa-as-aba.stderr +++ b/src/test/ui/nll/relate_tys/hr-fn-aaa-as-aba.stderr @@ -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 diff --git a/src/test/ui/nll/ty-outlives/impl-trait-outlives.rs b/src/test/ui/nll/ty-outlives/impl-trait-outlives.rs index 43666365892..64eb7353638 100644 --- a/src/test/ui/nll/ty-outlives/impl-trait-outlives.rs +++ b/src/test/ui/nll/ty-outlives/impl-trait-outlives.rs @@ -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 diff --git a/src/test/ui/nll/ty-outlives/impl-trait-outlives.stderr b/src/test/ui/nll/ty-outlives/impl-trait-outlives.stderr index 05b674f8a9d..61d2d2d6d82 100644 --- a/src/test/ui/nll/ty-outlives/impl-trait-outlives.stderr +++ b/src/test/ui/nll/ty-outlives/impl-trait-outlives.stderr @@ -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)`... diff --git a/src/test/ui/nll/ty-outlives/projection-one-region-closure.stderr b/src/test/ui/nll/ty-outlives/projection-one-region-closure.stderr index a91761f3ece..4bd96ab4e71 100644 --- a/src/test/ui/nll/ty-outlives/projection-one-region-closure.stderr +++ b/src/test/ui/nll/ty-outlives/projection-one-region-closure.stderr @@ -32,8 +32,16 @@ LL | | } T ] +error[E0309]: the parameter type `T` may not live long enough + --> $DIR/projection-one-region-closure.rs:55:29 + | +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:5 + --> $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 @@ -41,15 +49,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` - -error[E0309]: the parameter type `T` may not live long enough - --> $DIR/projection-one-region-closure.rs:55:29 - | -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))`... + | ^^^^^^^^^^^^^^^^^^^^^^^^^^ closure body requires that `'b` must outlive `'a` note: External requirements --> $DIR/projection-one-region-closure.rs:66:29 @@ -86,8 +86,16 @@ LL | | } T ] +error[E0309]: the parameter type `T` may not live long enough + --> $DIR/projection-one-region-closure.rs:66:29 + | +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:5 + --> $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 @@ -95,15 +103,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` - -error[E0309]: the parameter type `T` may not live long enough - --> $DIR/projection-one-region-closure.rs:66:29 - | -LL | with_signature(cell, t, |cell, t| require(cell, t)); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^ - | - = help: consider adding an explicit lifetime bound `T: ReEarlyBound(0, 'a)`... + | ^^^^^^^^^^^^^^^^^^^^^^^^^^ closure body requires that `'b` must outlive `'a` note: External requirements --> $DIR/projection-one-region-closure.rs:87:29 @@ -140,8 +140,16 @@ LL | | } T ] +error[E0309]: the parameter type `T` may not live long enough + --> $DIR/projection-one-region-closure.rs:87:29 + | +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:5 + --> $DIR/projection-one-region-closure.rs:87:29 | LL | fn projection_outlives<'a, 'b, T>(cell: Cell<&'a ()>, t: T) | -- -- lifetime `'b` defined here @@ -149,15 +157,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` - -error[E0309]: the parameter type `T` may not live long enough - --> $DIR/projection-one-region-closure.rs:87:29 - | -LL | with_signature(cell, t, |cell, t| require(cell, t)); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^ - | - = help: consider adding an explicit lifetime bound `T: ReEarlyBound(0, 'a)`... + | ^^^^^^^^^^^^^^^^^^^^^^^^^^ closure body requires that `'b` must outlive `'a` note: External requirements --> $DIR/projection-one-region-closure.rs:99:29 diff --git a/src/test/ui/nll/ty-outlives/projection-one-region-trait-bound-closure.stderr b/src/test/ui/nll/ty-outlives/projection-one-region-trait-bound-closure.stderr index 0064393f271..ccf70a77bff 100644 --- a/src/test/ui/nll/ty-outlives/projection-one-region-trait-bound-closure.stderr +++ b/src/test/ui/nll/ty-outlives/projection-one-region-trait-bound-closure.stderr @@ -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 diff --git a/src/test/ui/nll/ty-outlives/projection-two-region-trait-bound-closure.stderr b/src/test/ui/nll/ty-outlives/projection-two-region-trait-bound-closure.stderr index 19dcb5f93da..372b803082f 100644 --- a/src/test/ui/nll/ty-outlives/projection-two-region-trait-bound-closure.stderr +++ b/src/test/ui/nll/ty-outlives/projection-two-region-trait-bound-closure.stderr @@ -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 diff --git a/src/test/ui/nll/user-annotations/patterns.stderr b/src/test/ui/nll/user-annotations/patterns.stderr index 563de1a9e02..f359608462d 100644 --- a/src/test/ui/nll/user-annotations/patterns.stderr +++ b/src/test/ui/nll/user-annotations/patterns.stderr @@ -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 diff --git a/src/test/ui/object-lifetime/object-lifetime-default-from-rptr-box-error.nll.stderr b/src/test/ui/object-lifetime/object-lifetime-default-from-rptr-box-error.nll.stderr index e62b9b07021..a6bfcf1d369 100644 --- a/src/test/ui/object-lifetime/object-lifetime-default-from-rptr-box-error.nll.stderr +++ b/src/test/ui/object-lifetime/object-lifetime-default-from-rptr-box-error.nll.stderr @@ -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 diff --git a/src/test/ui/object-lifetime/object-lifetime-default-from-rptr-struct-error.nll.stderr b/src/test/ui/object-lifetime/object-lifetime-default-from-rptr-struct-error.nll.stderr index 803f9d3fd7e..396ff1302b1 100644 --- a/src/test/ui/object-lifetime/object-lifetime-default-from-rptr-struct-error.nll.stderr +++ b/src/test/ui/object-lifetime/object-lifetime-default-from-rptr-struct-error.nll.stderr @@ -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 diff --git a/src/test/ui/regions/region-object-lifetime-in-coercion.nll.stderr b/src/test/ui/regions/region-object-lifetime-in-coercion.nll.stderr index e8c1d7e74a0..53d3b2d5323 100644 --- a/src/test/ui/regions/region-object-lifetime-in-coercion.nll.stderr +++ b/src/test/ui/regions/region-object-lifetime-in-coercion.nll.stderr @@ -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 diff --git a/src/test/ui/regions/regions-addr-of-self.nll.stderr b/src/test/ui/regions/regions-addr-of-self.nll.stderr index a85822e48fa..0e38abef668 100644 --- a/src/test/ui/regions/regions-addr-of-self.nll.stderr +++ b/src/test/ui/regions/regions-addr-of-self.nll.stderr @@ -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 diff --git a/src/test/ui/regions/regions-addr-of-upvar-self.nll.stderr b/src/test/ui/regions/regions-addr-of-upvar-self.nll.stderr index 9d6301af0fb..6e4bf26047e 100644 --- a/src/test/ui/regions/regions-addr-of-upvar-self.nll.stderr +++ b/src/test/ui/regions/regions-addr-of-upvar-self.nll.stderr @@ -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 diff --git a/src/test/ui/regions/regions-close-object-into-object-2.nll.stderr b/src/test/ui/regions/regions-close-object-into-object-2.nll.stderr index e619431ddbb..c073e3728e7 100644 --- a/src/test/ui/regions/regions-close-object-into-object-2.nll.stderr +++ b/src/test/ui/regions/regions-close-object-into-object-2.nll.stderr @@ -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 diff --git a/src/test/ui/regions/regions-close-object-into-object-4.nll.stderr b/src/test/ui/regions/regions-close-object-into-object-4.nll.stderr index 1de1cdc9807..4b47b951d77 100644 --- a/src/test/ui/regions/regions-close-object-into-object-4.nll.stderr +++ b/src/test/ui/regions/regions-close-object-into-object-4.nll.stderr @@ -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 | diff --git a/src/test/ui/regions/regions-free-region-ordering-callee.nll.stderr b/src/test/ui/regions/regions-free-region-ordering-callee.nll.stderr index 98a4dc29ae7..d0606295713 100644 --- a/src/test/ui/regions/regions-free-region-ordering-callee.nll.stderr +++ b/src/test/ui/regions/regions-free-region-ordering-callee.nll.stderr @@ -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 diff --git a/src/test/ui/regions/regions-nested-fns.nll.stderr b/src/test/ui/regions/regions-nested-fns.nll.stderr index 9e6c57f6733..4bb602d572f 100644 --- a/src/test/ui/regions/regions-nested-fns.nll.stderr +++ b/src/test/ui/regions/regions-nested-fns.nll.stderr @@ -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`. diff --git a/src/test/ui/regions/regions-trait-object-subtyping.nll.stderr b/src/test/ui/regions/regions-trait-object-subtyping.nll.stderr index d4140242c01..0a9bcee1ce2 100644 --- a/src/test/ui/regions/regions-trait-object-subtyping.nll.stderr +++ b/src/test/ui/regions/regions-trait-object-subtyping.nll.stderr @@ -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 diff --git a/src/test/ui/underscore-lifetime/dyn-trait-underscore.nll.stderr b/src/test/ui/underscore-lifetime/dyn-trait-underscore.nll.stderr index 745c65c54df..7adb195b7d0 100644 --- a/src/test/ui/underscore-lifetime/dyn-trait-underscore.nll.stderr +++ b/src/test/ui/underscore-lifetime/dyn-trait-underscore.nll.stderr @@ -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 diff --git a/src/test/ui/variance/variance-contravariant-arg-object.nll.stderr b/src/test/ui/variance/variance-contravariant-arg-object.nll.stderr index 4ef45edc242..a30720dc6ba 100644 --- a/src/test/ui/variance/variance-contravariant-arg-object.nll.stderr +++ b/src/test/ui/variance/variance-contravariant-arg-object.nll.stderr @@ -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 diff --git a/src/test/ui/variance/variance-covariant-arg-object.nll.stderr b/src/test/ui/variance/variance-covariant-arg-object.nll.stderr index 3105ebaf031..26699a537e8 100644 --- a/src/test/ui/variance/variance-covariant-arg-object.nll.stderr +++ b/src/test/ui/variance/variance-covariant-arg-object.nll.stderr @@ -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 diff --git a/src/test/ui/variance/variance-invariant-arg-object.nll.stderr b/src/test/ui/variance/variance-invariant-arg-object.nll.stderr index 54ad4f4c5fb..20ab6485986 100644 --- a/src/test/ui/variance/variance-invariant-arg-object.nll.stderr +++ b/src/test/ui/variance/variance-invariant-arg-object.nll.stderr @@ -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 |
