diff options
Diffstat (limited to 'src/test/ui/nll/ty-outlives')
9 files changed, 43 insertions, 156 deletions
diff --git a/src/test/ui/nll/ty-outlives/impl-trait-captures.stderr b/src/test/ui/nll/ty-outlives/impl-trait-captures.stderr index 330c6fafa..737cb3584 100644 --- a/src/test/ui/nll/ty-outlives/impl-trait-captures.stderr +++ b/src/test/ui/nll/ty-outlives/impl-trait-captures.stderr @@ -1,14 +1,14 @@ -error[E0700]: hidden type for `Opaque(DefId(0:11 ~ impl_trait_captures[1afc]::foo::{opaque#0}), [ReStatic, T, ReEarlyBound(0, 'a)])` captures lifetime that does not appear in bounds +error[E0700]: hidden type for `Opaque(DefId(0:13 ~ impl_trait_captures[1afc]::foo::{opaque#0}), [ReStatic, T, ReEarlyBound(0, 'a)])` captures lifetime that does not appear in bounds --> $DIR/impl-trait-captures.rs:11:5 | LL | fn foo<'a, T>(x: &T) -> impl Foo<'a> { - | -- hidden type `&ReFree(DefId(0:8 ~ impl_trait_captures[1afc]::foo), BrNamed(DefId(0:13 ~ impl_trait_captures[1afc]::foo::'_), '_)) T` captures the anonymous lifetime defined here + | -- hidden type `&ReFree(DefId(0:8 ~ impl_trait_captures[1afc]::foo), BrNamed(DefId(0:12 ~ impl_trait_captures[1afc]::foo::'_), '_)) T` captures the anonymous lifetime defined here LL | x | ^ | -help: to declare that the `impl Trait` captures `ReFree(DefId(0:8 ~ impl_trait_captures[1afc]::foo), BrNamed(DefId(0:13 ~ impl_trait_captures[1afc]::foo::'_), '_))`, you can add an explicit `ReFree(DefId(0:8 ~ impl_trait_captures[1afc]::foo), BrNamed(DefId(0:13 ~ impl_trait_captures[1afc]::foo::'_), '_))` lifetime bound +help: to declare that `Opaque(DefId(0:13 ~ impl_trait_captures[1afc]::foo::{opaque#0}), [ReEarlyBound(0, 'a), T, ReEarlyBound(2, 'a)])` captures `ReFree(DefId(0:8 ~ impl_trait_captures[1afc]::foo), BrNamed(DefId(0:12 ~ impl_trait_captures[1afc]::foo::'_), '_))`, you can add an explicit `ReFree(DefId(0:8 ~ impl_trait_captures[1afc]::foo), BrNamed(DefId(0:12 ~ impl_trait_captures[1afc]::foo::'_), '_))` lifetime bound | -LL | fn foo<'a, T>(x: &T) -> impl Foo<'a> + ReFree(DefId(0:8 ~ impl_trait_captures[1afc]::foo), BrNamed(DefId(0:13 ~ impl_trait_captures[1afc]::foo::'_), '_)) { +LL | fn foo<'a, T>(x: &T) -> impl Foo<'a> + ReFree(DefId(0:8 ~ impl_trait_captures[1afc]::foo), BrNamed(DefId(0:12 ~ impl_trait_captures[1afc]::foo::'_), '_)) { | ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ error: aborting due to previous error diff --git a/src/test/ui/nll/ty-outlives/projection-no-regions-closure.stderr b/src/test/ui/nll/ty-outlives/projection-no-regions-closure.stderr index feab24769..ee1f7b64b 100644 --- a/src/test/ui/nll/ty-outlives/projection-no-regions-closure.stderr +++ b/src/test/ui/nll/ty-outlives/projection-no-regions-closure.stderr @@ -18,11 +18,7 @@ note: no external requirements LL | / fn no_region<'a, T>(x: Box<T>) -> Box<dyn Anything + 'a> LL | | where LL | | T: Iterator, -LL | | { -LL | | with_signature(x, |mut y| Box::new(y.next())) -LL | | -LL | | } - | |_^ + | |________________^ | = note: defining type: no_region::<'_#1r, T> @@ -55,10 +51,7 @@ note: no external requirements LL | / fn correct_region<'a, T>(x: Box<T>) -> Box<dyn Anything + 'a> LL | | where LL | | T: 'a + Iterator, -LL | | { -LL | | with_signature(x, |mut y| Box::new(y.next())) -LL | | } - | |_^ + | |_____________________^ | = note: defining type: correct_region::<'_#1r, T> @@ -82,11 +75,7 @@ note: no external requirements LL | / fn wrong_region<'a, 'b, T>(x: Box<T>) -> Box<dyn Anything + 'a> LL | | where LL | | T: 'b + Iterator, -LL | | { -LL | | with_signature(x, |mut y| Box::new(y.next())) -LL | | -LL | | } - | |_^ + | |_____________________^ | = note: defining type: wrong_region::<'_#1r, '_#2r, T> @@ -120,10 +109,7 @@ LL | / fn outlives_region<'a, 'b, T>(x: Box<T>) -> Box<dyn Anything + 'a> LL | | where LL | | T: 'b + Iterator, LL | | 'b: 'a, -LL | | { -LL | | with_signature(x, |mut y| Box::new(y.next())) -LL | | } - | |_^ + | |___________^ | = note: defining type: outlives_region::<'_#1r, '_#2r, T> 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 98063bd0a..4e57dfad7 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 @@ -20,11 +20,7 @@ note: no external requirements LL | / fn no_relationships_late<'a, 'b, T>(cell: Cell<&'a ()>, t: T) LL | | where LL | | T: Anything<'b>, -LL | | { -... | -LL | | -LL | | } - | |_^ + | |____________________^ | = note: defining type: no_relationships_late::<'_#1r, T> @@ -74,10 +70,7 @@ LL | / fn no_relationships_early<'a, 'b, T>(cell: Cell<&'a ()>, t: T) LL | | where LL | | T: Anything<'b>, LL | | 'a: 'a, -... | -LL | | -LL | | } - | |_^ + | |___________^ | = note: defining type: no_relationships_early::<'_#1r, '_#2r, T> @@ -126,10 +119,7 @@ LL | / fn projection_outlives<'a, 'b, T>(cell: Cell<&'a ()>, t: T) LL | | where LL | | T: Anything<'b>, LL | | T::AssocType: 'a, -... | -LL | | with_signature(cell, t, |cell, t| require(cell, t)); -LL | | } - | |_^ + | |_____________________^ | = note: defining type: projection_outlives::<'_#1r, '_#2r, T> @@ -155,10 +145,8 @@ LL | / fn elements_outlive<'a, 'b, T>(cell: Cell<&'a ()>, t: T) LL | | where LL | | T: Anything<'b>, LL | | T: 'a, -... | -LL | | with_signature(cell, t, |cell, t| require(cell, t)); -LL | | } - | |_^ +LL | | 'b: 'a, + | |___________^ | = note: defining type: elements_outlive::<'_#1r, '_#2r, T> 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 45e61bcbd..250c796e2 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 @@ -19,11 +19,7 @@ note: no external requirements LL | / fn no_relationships_late<'a, 'b, T>(cell: Cell<&'a ()>, t: T) LL | | where LL | | T: Anything<'b>, -LL | | { -LL | | with_signature(cell, t, |cell, t| require(cell, t)); -LL | | -LL | | } - | |_^ + | |____________________^ | = note: defining type: no_relationships_late::<'_#1r, T> @@ -61,10 +57,7 @@ LL | / fn no_relationships_early<'a, 'b, T>(cell: Cell<&'a ()>, t: T) LL | | where LL | | T: Anything<'b>, LL | | 'a: 'a, -... | -LL | | -LL | | } - | |_^ + | |___________^ | = note: defining type: no_relationships_early::<'_#1r, '_#2r, T> @@ -102,10 +95,7 @@ LL | / fn projection_outlives<'a, 'b, T>(cell: Cell<&'a ()>, t: T) LL | | where LL | | T: Anything<'b>, LL | | T::AssocType: 'a, -... | -LL | | with_signature(cell, t, |cell, t| require(cell, t)); -LL | | } - | |_^ + | |_____________________^ | = note: defining type: projection_outlives::<'_#1r, '_#2r, T> @@ -130,10 +120,7 @@ LL | / fn elements_outlive<'a, 'b, T>(cell: Cell<&'a ()>, t: T) LL | | where LL | | T: Anything<'b>, LL | | 'b: 'a, -LL | | { -LL | | with_signature(cell, t, |cell, t| require(cell, t)); -LL | | } - | |_^ + | |___________^ | = note: defining type: elements_outlive::<'_#1r, '_#2r, T> @@ -157,11 +144,7 @@ note: no external requirements LL | / fn one_region<'a, T>(cell: Cell<&'a ()>, t: T) LL | | where LL | | T: Anything<'a>, -LL | | { -... | -LL | | with_signature(cell, t, |cell, t| require(cell, t)); -LL | | } - | |_^ + | |____________________^ | = note: defining type: one_region::<'_#1r, T> diff --git a/src/test/ui/nll/ty-outlives/projection-one-region-trait-bound-static-closure.stderr b/src/test/ui/nll/ty-outlives/projection-one-region-trait-bound-static-closure.stderr index f2549205b..b27186b05 100644 --- a/src/test/ui/nll/ty-outlives/projection-one-region-trait-bound-static-closure.stderr +++ b/src/test/ui/nll/ty-outlives/projection-one-region-trait-bound-static-closure.stderr @@ -17,10 +17,7 @@ note: no external requirements LL | / fn no_relationships_late<'a, 'b, T>(cell: Cell<&'a ()>, t: T) LL | | where LL | | T: Anything<'b>, -LL | | { -LL | | with_signature(cell, t, |cell, t| require(cell, t)); -LL | | } - | |_^ + | |____________________^ | = note: defining type: no_relationships_late::<'_#1r, T> @@ -43,10 +40,7 @@ LL | / fn no_relationships_early<'a, 'b, T>(cell: Cell<&'a ()>, t: T) LL | | where LL | | T: Anything<'b>, LL | | 'a: 'a, -LL | | { -LL | | with_signature(cell, t, |cell, t| require(cell, t)); -LL | | } - | |_^ + | |___________^ | = note: defining type: no_relationships_early::<'_#1r, '_#2r, T> @@ -69,10 +63,7 @@ LL | / fn projection_outlives<'a, 'b, T>(cell: Cell<&'a ()>, t: T) LL | | where LL | | T: Anything<'b>, LL | | T::AssocType: 'a, -... | -LL | | with_signature(cell, t, |cell, t| require(cell, t)); -LL | | } - | |_^ + | |_____________________^ | = note: defining type: projection_outlives::<'_#1r, '_#2r, T> @@ -95,10 +86,7 @@ LL | / fn elements_outlive<'a, 'b, T>(cell: Cell<&'a ()>, t: T) LL | | where LL | | T: Anything<'b>, LL | | 'b: 'a, -LL | | { -LL | | with_signature(cell, t, |cell, t| require(cell, t)); -LL | | } - | |_^ + | |___________^ | = note: defining type: elements_outlive::<'_#1r, '_#2r, T> @@ -120,11 +108,7 @@ note: no external requirements LL | / fn one_region<'a, T>(cell: Cell<&'a ()>, t: T) LL | | where LL | | T: Anything<'a>, -LL | | { -... | -LL | | with_signature(cell, t, |cell, t| require(cell, t)); -LL | | } - | |_^ + | |____________________^ | = note: defining type: one_region::<'_#1r, T> 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 8e1b6fa2e..0195a693e 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 @@ -19,11 +19,7 @@ note: no external requirements LL | / fn no_relationships_late<'a, 'b, 'c, T>(cell: Cell<&'a ()>, t: T) LL | | where LL | | T: Anything<'b, 'c>, -LL | | { -LL | | with_signature(cell, t, |cell, t| require(cell, t)); -LL | | -LL | | } - | |_^ + | |________________________^ | = note: defining type: no_relationships_late::<'_#1r, '_#2r, T> @@ -57,10 +53,7 @@ LL | / fn no_relationships_early<'a, 'b, 'c, T>(cell: Cell<&'a ()>, t: T) LL | | where LL | | T: Anything<'b, 'c>, LL | | 'a: 'a, -... | -LL | | -LL | | } - | |_^ + | |___________^ | = note: defining type: no_relationships_early::<'_#1r, '_#2r, '_#3r, T> @@ -94,10 +87,7 @@ LL | / fn projection_outlives<'a, 'b, 'c, T>(cell: Cell<&'a ()>, t: T) LL | | where LL | | T: Anything<'b, 'c>, LL | | T::AssocType: 'a, -... | -LL | | with_signature(cell, t, |cell, t| require(cell, t)); -LL | | } - | |_^ + | |_____________________^ | = note: defining type: projection_outlives::<'_#1r, '_#2r, '_#3r, T> @@ -122,10 +112,7 @@ LL | / fn elements_outlive1<'a, 'b, 'c, T>(cell: Cell<&'a ()>, t: T) LL | | where LL | | T: Anything<'b, 'c>, LL | | 'b: 'a, -LL | | { -LL | | with_signature(cell, t, |cell, t| require(cell, t)); -LL | | } - | |_^ + | |___________^ | = note: defining type: elements_outlive1::<'_#1r, '_#2r, '_#3r, T> @@ -150,10 +137,7 @@ LL | / fn elements_outlive2<'a, 'b, 'c, T>(cell: Cell<&'a ()>, t: T) LL | | where LL | | T: Anything<'b, 'c>, LL | | 'c: 'a, -LL | | { -LL | | with_signature(cell, t, |cell, t| require(cell, t)); -LL | | } - | |_^ + | |___________^ | = note: defining type: elements_outlive2::<'_#1r, '_#2r, '_#3r, T> @@ -178,11 +162,7 @@ note: no external requirements LL | / fn two_regions<'a, 'b, T>(cell: Cell<&'a ()>, t: T) LL | | where LL | | T: Anything<'b, 'b>, -LL | | { -LL | | with_signature(cell, t, |cell, t| require(cell, t)); -LL | | -LL | | } - | |_^ + | |________________________^ | = note: defining type: two_regions::<'_#1r, T> @@ -220,10 +200,7 @@ LL | / fn two_regions_outlive<'a, 'b, T>(cell: Cell<&'a ()>, t: T) LL | | where LL | | T: Anything<'b, 'b>, LL | | 'b: 'a, -LL | | { -LL | | with_signature(cell, t, |cell, t| require(cell, t)); -LL | | } - | |_^ + | |___________^ | = note: defining type: two_regions_outlive::<'_#1r, '_#2r, T> @@ -247,11 +224,7 @@ note: no external requirements LL | / fn one_region<'a, T>(cell: Cell<&'a ()>, t: T) LL | | where LL | | T: Anything<'a, 'a>, -LL | | { -... | -LL | | with_signature(cell, t, |cell, t| require(cell, t)); -LL | | } - | |_^ + | |________________________^ | = note: defining type: one_region::<'_#1r, T> diff --git a/src/test/ui/nll/ty-outlives/ty-param-closure-approximate-lower-bound.stderr b/src/test/ui/nll/ty-outlives/ty-param-closure-approximate-lower-bound.stderr index 12c76d198..61c7d2550 100644 --- a/src/test/ui/nll/ty-outlives/ty-param-closure-approximate-lower-bound.stderr +++ b/src/test/ui/nll/ty-outlives/ty-param-closure-approximate-lower-bound.stderr @@ -6,7 +6,7 @@ LL | twice(cell, value, |a, b| invoke(a, b)); | = note: defining type: generic::<T>::{closure#0} with closure substs [ i16, - for<'r, 's> extern "rust-call" fn((std::option::Option<std::cell::Cell<&'_#1r &ReLateBound(DebruijnIndex(0), BoundRegion { var: 0, kind: BrNamed('r) }) ()>>, &ReLateBound(DebruijnIndex(0), BoundRegion { var: 1, kind: BrNamed('s) }) T)), + for<'a, 'b> extern "rust-call" fn((std::option::Option<std::cell::Cell<&'_#1r &ReLateBound(DebruijnIndex(0), BoundRegion { var: 0, kind: BrNamed('a) }) ()>>, &ReLateBound(DebruijnIndex(0), BoundRegion { var: 1, kind: BrNamed('b) }) T)), (), ] = note: number of external vids: 2 @@ -15,11 +15,8 @@ LL | twice(cell, value, |a, b| invoke(a, b)); note: no external requirements --> $DIR/ty-param-closure-approximate-lower-bound.rs:22:1 | -LL | / fn generic<T>(value: T) { -LL | | let cell = Cell::new(&()); -LL | | twice(cell, value, |a, b| invoke(a, b)); -LL | | } - | |_^ +LL | fn generic<T>(value: T) { + | ^^^^^^^^^^^^^^^^^^^^^^^ | = note: defining type: generic::<T> @@ -31,7 +28,7 @@ LL | twice(cell, value, |a, b| invoke(a, b)); | = note: defining type: generic_fail::<T>::{closure#0} with closure substs [ i16, - for<'r, 's> extern "rust-call" fn((std::option::Option<std::cell::Cell<&'_#1r &ReLateBound(DebruijnIndex(0), BoundRegion { var: 0, kind: BrNamed('r) }) ()>>, &ReLateBound(DebruijnIndex(0), BoundRegion { var: 1, kind: BrNamed('s) }) T)), + for<'a, 'b> extern "rust-call" fn((std::option::Option<std::cell::Cell<&'_#1r &ReLateBound(DebruijnIndex(0), BoundRegion { var: 0, kind: BrNamed('a) }) ()>>, &ReLateBound(DebruijnIndex(0), BoundRegion { var: 1, kind: BrNamed('b) }) T)), (), ] = note: late-bound region is '_#2r @@ -41,11 +38,8 @@ LL | twice(cell, value, |a, b| invoke(a, b)); note: no external requirements --> $DIR/ty-param-closure-approximate-lower-bound.rs:28:1 | -LL | / fn generic_fail<'a, T>(cell: Cell<&'a ()>, value: T) { -LL | | twice(cell, value, |a, b| invoke(a, b)); -LL | | -LL | | } - | |_^ +LL | fn generic_fail<'a, T>(cell: Cell<&'a ()>, value: T) { + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = note: defining type: generic_fail::<T> diff --git a/src/test/ui/nll/ty-outlives/ty-param-closure-outlives-from-return-type.stderr b/src/test/ui/nll/ty-outlives/ty-param-closure-outlives-from-return-type.stderr index 35741859d..50d9e3aab 100644 --- a/src/test/ui/nll/ty-outlives/ty-param-closure-outlives-from-return-type.stderr +++ b/src/test/ui/nll/ty-outlives/ty-param-closure-outlives-from-return-type.stderr @@ -18,11 +18,7 @@ note: no external requirements LL | / fn no_region<'a, T>(x: Box<T>) -> Box<dyn Debug + 'a> LL | | where LL | | T: Debug, -LL | | { -... | -LL | | -LL | | } - | |_^ + | |_____________^ | = note: defining type: no_region::<'_#1r, T> diff --git a/src/test/ui/nll/ty-outlives/ty-param-closure-outlives-from-where-clause.stderr b/src/test/ui/nll/ty-outlives/ty-param-closure-outlives-from-where-clause.stderr index 0261bc39e..14c55e32a 100644 --- a/src/test/ui/nll/ty-outlives/ty-param-closure-outlives-from-where-clause.stderr +++ b/src/test/ui/nll/ty-outlives/ty-param-closure-outlives-from-where-clause.stderr @@ -16,14 +16,8 @@ LL | with_signature(a, b, |x, y| { note: no external requirements --> $DIR/ty-param-closure-outlives-from-where-clause.rs:26:1 | -LL | / fn no_region<'a, T>(a: Cell<&'a ()>, b: T) { -LL | | with_signature(a, b, |x, y| { -LL | | -LL | | // -... | -LL | | }) -LL | | } - | |_^ +LL | fn no_region<'a, T>(a: Cell<&'a ()>, b: T) { + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = note: defining type: no_region::<T> @@ -65,11 +59,7 @@ note: no external requirements LL | / fn correct_region<'a, T>(a: Cell<&'a ()>, b: T) LL | | where LL | | T: 'a, -LL | | { -... | -LL | | }) -LL | | } - | |_^ + | |__________^ | = note: defining type: correct_region::<'_#1r, T> @@ -94,11 +84,7 @@ note: no external requirements LL | / fn wrong_region<'a, 'b, T>(a: Cell<&'a ()>, b: T) LL | | where LL | | T: 'b, -LL | | { -... | -LL | | }) -LL | | } - | |_^ + | |__________^ | = note: defining type: wrong_region::<'_#1r, T> @@ -139,10 +125,7 @@ LL | / fn outlives_region<'a, 'b, T>(a: Cell<&'a ()>, b: T) LL | | where LL | | T: 'b, LL | | 'b: 'a, -... | -LL | | }) -LL | | } - | |_^ + | |___________^ | = note: defining type: outlives_region::<'_#1r, '_#2r, T> |