From bd0895d7d011cc4c6bef4f95e6df64d2fee6ff73 Mon Sep 17 00:00:00 2001 From: Matthew Jasper Date: Sat, 15 Sep 2018 18:30:29 +0100 Subject: [PATCH] Update ui tests --- ...fn-ret-contravariant.krisskross.nll.stderr | 15 +++-- ...-fn-ret-contravariant.transmute.nll.stderr | 2 +- ...ect-fn-ret-invariant.krisskross.nll.stderr | 15 +++-- ...ject-fn-ret-invariant.transmute.nll.stderr | 4 +- ...t_outlive_least_region_or_bound.nll.stderr | 6 +- .../static-return-lifetime-infered.nll.stderr | 4 +- .../type_parameters_captured.nll.stderr | 6 +- src/test/ui/issues/issue-10291.nll.stderr | 13 ++-- .../ex3-both-anon-regions-2.nll.stderr | 2 +- ...anon-regions-both-are-structs-2.nll.stderr | 2 +- ...anon-regions-both-are-structs-3.nll.stderr | 2 +- ...anon-regions-both-are-structs-4.nll.stderr | 2 +- ...th-anon-regions-one-is-struct-2.nll.stderr | 2 +- ...th-anon-regions-one-is-struct-3.nll.stderr | 2 +- ...th-anon-regions-one-is-struct-4.nll.stderr | 2 +- ...both-anon-regions-one-is-struct.nll.stderr | 2 +- .../escape-argument-callee.stderr | 2 +- .../propagate-approximated-ref.stderr | 7 +- ...oximated-shorter-to-static-no-bound.stderr | 21 ++++-- ...mated-shorter-to-static-wrong-bound.stderr | 20 ++++-- .../propagate-approximated-val.stderr | 7 +- src/test/ui/nll/issue-50716.stderr | 6 +- src/test/ui/nll/issue-52113.rs | 4 +- src/test/ui/nll/issue-52113.stderr | 7 +- src/test/ui/nll/issue-52742.stderr | 2 +- src/test/ui/nll/mir_check_cast_reify.rs | 2 +- src/test/ui/nll/mir_check_cast_reify.stderr | 6 +- src/test/ui/nll/mir_check_cast_unsafe_fn.rs | 2 +- .../ui/nll/mir_check_cast_unsafe_fn.stderr | 6 +- src/test/ui/nll/mir_check_cast_unsize.stderr | 2 +- .../ui/nll/relate_tys/hr-fn-aaa-as-aba.stderr | 4 +- .../ui/nll/ty-outlives/impl-trait-outlives.rs | 4 +- .../ty-outlives/impl-trait-outlives.stderr | 12 ++-- .../projection-one-region-closure.stderr | 66 +++++++++---------- ...tion-one-region-trait-bound-closure.stderr | 12 ++-- ...tion-two-region-trait-bound-closure.stderr | 4 +- .../ui/nll/user-annotations/patterns.stderr | 4 +- ...ime-default-from-rptr-box-error.nll.stderr | 6 +- ...-default-from-rptr-struct-error.nll.stderr | 6 +- ...ion-object-lifetime-in-coercion.nll.stderr | 4 +- .../regions/regions-addr-of-self.nll.stderr | 2 +- .../regions-addr-of-upvar-self.nll.stderr | 18 +++-- ...ions-close-object-into-object-2.nll.stderr | 4 +- ...ions-close-object-into-object-4.nll.stderr | 16 ++--- ...ons-free-region-ordering-callee.nll.stderr | 2 +- .../ui/regions/regions-nested-fns.nll.stderr | 30 +++++---- .../regions-trait-object-subtyping.nll.stderr | 2 +- .../dyn-trait-underscore.nll.stderr | 2 +- ...riance-contravariant-arg-object.nll.stderr | 4 +- .../variance-covariant-arg-object.nll.stderr | 4 +- .../variance-invariant-arg-object.nll.stderr | 4 +- 51 files changed, 208 insertions(+), 177 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 b61ea27ebe19..044a3f70b4a6 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 2f632fec17e9..10f70b525e05 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 971448997e3f..1cb687856942 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 63e1f665005c..2329adb5deab 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 3019e3aa1f73..485d35662445 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(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 4bc8876c232e..7e9aa90c6c50 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 { | - 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 + '_ { @@ -16,7 +16,7 @@ error: unsatisfied lifetime constraints LL | fn iter_values<'a>(&'a self) -> impl Iterator { | -- 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 + '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 3c2c86fffded..18258ef1f9dc 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(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 d19c4d880c7c..201a3b3d54a3 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:: 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:: 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 017c3e977475..e4aafd7b66e4 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 b8e1b483081b..934cdcd2ef28 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 4b7352fe2249..cbfd9d478091 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 53a2fef48067..4f0efe24cf70 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 1a5f788e1436..fc1fab7aab5b 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 d098354d9839..8100fa89c2d0 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 17a70aa85bee..1c4a8b665893 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 2ebdedddc507..2a4c5a685f16 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 72b60188c4c6..1f9cb6d050fb 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 1af96b97e73b..2e1249a5e812 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 9de9e21ba43d..9f1d9d21d11c 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 6acb67500554..4e72fe4bb28a 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 e0902ca1ddbe..de60b23ef6b9 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 f12ab9b4f960..eddad056995a 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 e484c249d84a..af577e8499b0 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 b21539361e66..45a192de454e 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 515ba55cf6f5..83a594941c0a 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 332ec7a7da28..c878be9e2a2d 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 fa5c4100c91e..fdb71b17287d 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 937ab31c3158..be91a946857e 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 82ff71c05515..c14fb93a525e 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 77a2e8311f05..526dfb601338 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 c9195395b878..9a83872b965c 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 436663658922..64eb73536386 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) -> 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) -> impl Debug + 'a @@ -30,11 +30,11 @@ where } fn wrong_region<'a, 'b, T>(x: Box) -> 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) -> 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 05b674f8a9db..61d2d2d6d82d 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) -> 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) -> 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 a91761f3ece2..4bd96ab4e713 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,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 | 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 0064393f271c..ccf70a77bffc 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 19dcb5f93dac..372b803082f1 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 563de1a9e02e..f359608462d1 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 e62b9b070213..a6bfcf1d3699 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, 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 803f9d3fd7e5..396ff1302b15 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, 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 e8c1d7e74a03..53d3b2d5323c 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 { | ----- help: add explicit lifetime `'static` to the type of `v`: `&'static [u8]` LL | let x: Box = 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 a85822e48fa6..0e38abef668c 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 9d6301af0fbe..6e4bf26047e4 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 e619431ddbbc..c073e3728e70 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>) -> Box { | -- lifetime `'a` defined here LL | box B(&*v) as Box //~ 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 1de1cdc9807f..4b47b951d771 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 //~ 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>) -> Box { + | -- lifetime `'a` defined here +LL | box B(&*v) as Box //~ 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 //~ 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>) -> Box { - | -- lifetime `'a` defined here -LL | box B(&*v) as Box //~ 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 98a4dc29ae7e..d06062957131 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 9e6c57f67332..4bb602d572fa 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:: 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 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 d4140242c01d..0a9bcee1ce29 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 745c65c54df4..7adb195b7d02 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(items: &[T]) -> Box> { | - 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 4ef45edc2424..a30720dc6ba8 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>) | 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>) | 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 3105ebaf0311..26699a537e81 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>) | 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>) | 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 54ad4f4c5fbe..20ab64859861 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>) | 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>) | 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