summaryrefslogtreecommitdiffstats
path: root/src/test/ui/nll/ty-outlives
diff options
context:
space:
mode:
Diffstat (limited to 'src/test/ui/nll/ty-outlives')
-rw-r--r--src/test/ui/nll/ty-outlives/impl-trait-captures.stderr2
-rw-r--r--src/test/ui/nll/ty-outlives/projection-implied-bounds.stderr4
-rw-r--r--src/test/ui/nll/ty-outlives/projection-no-regions-closure.stderr8
-rw-r--r--src/test/ui/nll/ty-outlives/projection-one-region-closure.stderr8
-rw-r--r--src/test/ui/nll/ty-outlives/projection-two-region-trait-bound-closure.stderr15
-rw-r--r--src/test/ui/nll/ty-outlives/ty-param-closure-approximate-lower-bound.stderr8
-rw-r--r--src/test/ui/nll/ty-outlives/ty-param-closure-outlives-from-return-type.stderr4
-rw-r--r--src/test/ui/nll/ty-outlives/ty-param-closure-outlives-from-where-clause.rs5
-rw-r--r--src/test/ui/nll/ty-outlives/ty-param-closure-outlives-from-where-clause.stderr36
9 files changed, 40 insertions, 50 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 737cb3584..7b9ed171d 100644
--- a/src/test/ui/nll/ty-outlives/impl-trait-captures.stderr
+++ b/src/test/ui/nll/ty-outlives/impl-trait-captures.stderr
@@ -1,4 +1,4 @@
-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
+error[E0700]: hidden type for `Opaque(DefId(0:13 ~ impl_trait_captures[1afc]::foo::{opaque#0}), [ReEarlyBound(0, 'a), 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> {
diff --git a/src/test/ui/nll/ty-outlives/projection-implied-bounds.stderr b/src/test/ui/nll/ty-outlives/projection-implied-bounds.stderr
index 3b9b2956c..d949e29b2 100644
--- a/src/test/ui/nll/ty-outlives/projection-implied-bounds.stderr
+++ b/src/test/ui/nll/ty-outlives/projection-implied-bounds.stderr
@@ -1,8 +1,8 @@
error[E0310]: the parameter type `T` may not live long enough
- --> $DIR/projection-implied-bounds.rs:30:18
+ --> $DIR/projection-implied-bounds.rs:30:36
|
LL | twice(value, |value_ref, item| invoke2(value_ref, item));
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ...so that the type `T` will meet its required lifetime bounds
+ | ^^^^^^^^^^^^^^^^^^^^^^^^ ...so that the type `T` will meet its required lifetime bounds
|
help: consider adding an explicit lifetime bound...
|
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 ee1f7b64b..4933b9348 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
@@ -23,10 +23,10 @@ LL | | T: Iterator,
= note: defining type: no_region::<'_#1r, T>
error[E0309]: the associated type `<T as Iterator>::Item` may not live long enough
- --> $DIR/projection-no-regions-closure.rs:25:23
+ --> $DIR/projection-no-regions-closure.rs:25:31
|
LL | with_signature(x, |mut y| Box::new(y.next()))
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^
+ | ^^^^^^^^^^^^^^^^^^
|
= help: consider adding an explicit lifetime bound `<T as Iterator>::Item: 'a`...
= note: ...so that the type `<T as Iterator>::Item` will meet its required lifetime bounds
@@ -80,10 +80,10 @@ LL | | T: 'b + Iterator,
= note: defining type: wrong_region::<'_#1r, '_#2r, T>
error[E0309]: the associated type `<T as Iterator>::Item` may not live long enough
- --> $DIR/projection-no-regions-closure.rs:42:23
+ --> $DIR/projection-no-regions-closure.rs:42:31
|
LL | with_signature(x, |mut y| Box::new(y.next()))
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^
+ | ^^^^^^^^^^^^^^^^^^
|
= help: consider adding an explicit lifetime bound `<T as Iterator>::Item: 'a`...
= note: ...so that the type `<T as Iterator>::Item` will meet its required lifetime bounds
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 4e57dfad7..dbda04c42 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
@@ -25,10 +25,10 @@ LL | | T: Anything<'b>,
= note: defining type: no_relationships_late::<'_#1r, T>
error[E0309]: the parameter type `T` may not live long enough
- --> $DIR/projection-one-region-closure.rs:45:29
+ --> $DIR/projection-one-region-closure.rs:45:39
|
LL | with_signature(cell, t, |cell, t| require(cell, t));
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^ ...so that the type `T` will meet its required lifetime bounds
+ | ^^^^^^^^^^^^^^^^ ...so that the type `T` will meet its required lifetime bounds
|
help: consider adding an explicit lifetime bound...
|
@@ -75,10 +75,10 @@ LL | | 'a: 'a,
= note: defining type: no_relationships_early::<'_#1r, '_#2r, T>
error[E0309]: the parameter type `T` may not live long enough
- --> $DIR/projection-one-region-closure.rs:56:29
+ --> $DIR/projection-one-region-closure.rs:56:39
|
LL | with_signature(cell, t, |cell, t| require(cell, t));
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^ ...so that the type `T` will meet its required lifetime bounds
+ | ^^^^^^^^^^^^^^^^ ...so that the type `T` will meet its required lifetime bounds
|
help: consider adding an explicit lifetime bound...
|
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 0195a693e..90f049142 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
@@ -24,10 +24,10 @@ LL | | T: Anything<'b, 'c>,
= note: defining type: no_relationships_late::<'_#1r, '_#2r, T>
error[E0309]: the associated type `<T as Anything<ReEarlyBound(0, 'b), ReEarlyBound(1, 'c)>>::AssocType` may not live long enough
- --> $DIR/projection-two-region-trait-bound-closure.rs:38:29
+ --> $DIR/projection-two-region-trait-bound-closure.rs:38:39
|
LL | with_signature(cell, t, |cell, t| require(cell, t));
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^
+ | ^^^^^^^^^^^^^^^^
|
= help: consider adding an explicit lifetime bound `<T as Anything<ReEarlyBound(0, 'b), ReEarlyBound(1, 'c)>>::AssocType: 'a`...
= note: ...so that the type `<T as Anything<ReEarlyBound(0, 'b), ReEarlyBound(1, 'c)>>::AssocType` will meet its required lifetime bounds
@@ -58,10 +58,10 @@ LL | | 'a: 'a,
= note: defining type: no_relationships_early::<'_#1r, '_#2r, '_#3r, T>
error[E0309]: the associated type `<T as Anything<ReEarlyBound(1, 'b), ReEarlyBound(2, 'c)>>::AssocType` may not live long enough
- --> $DIR/projection-two-region-trait-bound-closure.rs:48:29
+ --> $DIR/projection-two-region-trait-bound-closure.rs:48:39
|
LL | with_signature(cell, t, |cell, t| require(cell, t));
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^
+ | ^^^^^^^^^^^^^^^^
|
= help: consider adding an explicit lifetime bound `<T as Anything<ReEarlyBound(1, 'b), ReEarlyBound(2, 'c)>>::AssocType: 'a`...
= note: ...so that the type `<T as Anything<ReEarlyBound(1, 'b), ReEarlyBound(2, 'c)>>::AssocType` will meet its required lifetime bounds
@@ -167,7 +167,7 @@ LL | | T: Anything<'b, 'b>,
= note: defining type: two_regions::<'_#1r, T>
error: lifetime may not live long enough
- --> $DIR/projection-two-region-trait-bound-closure.rs:87:29
+ --> $DIR/projection-two-region-trait-bound-closure.rs:87:5
|
LL | fn two_regions<'a, 'b, T>(cell: Cell<&'a ()>, t: T)
| -- -- lifetime `'b` defined here
@@ -175,9 +175,12 @@ 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));
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^ closure body requires that `'b` must outlive `'a`
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ argument requires that `'b` must outlive `'a`
|
= help: consider adding the following bound: `'b: 'a`
+ = note: requirement occurs because of the type `Cell<&'_#8r ()>`, which makes the generic argument `&'_#8r ()` invariant
+ = note: the struct `Cell<T>` is invariant over the parameter `T`
+ = help: see <https://doc.rust-lang.org/nomicon/subtyping.html> for more information about variance
note: external requirements
--> $DIR/projection-two-region-trait-bound-closure.rs:97:29
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 61c7d2550..a442cf12d 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<'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)),
+ for<Region(BrAnon(0, None)), Region(BrAnon(1, None))> extern "rust-call" fn((std::option::Option<std::cell::Cell<&'_#1r &ReLateBound(DebruijnIndex(0), BoundRegion { var: 0, kind: BrAnon(0, None) }) ()>>, &ReLateBound(DebruijnIndex(0), BoundRegion { var: 1, kind: BrAnon(1, None) }) T)),
(),
]
= note: number of external vids: 2
@@ -28,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<'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)),
+ for<Region(BrAnon(0, None)), Region(BrAnon(1, None))> extern "rust-call" fn((std::option::Option<std::cell::Cell<&'_#1r &ReLateBound(DebruijnIndex(0), BoundRegion { var: 0, kind: BrAnon(0, None) }) ()>>, &ReLateBound(DebruijnIndex(0), BoundRegion { var: 1, kind: BrAnon(1, None) }) T)),
(),
]
= note: late-bound region is '_#2r
@@ -44,10 +44,10 @@ LL | fn generic_fail<'a, T>(cell: Cell<&'a ()>, value: T) {
= note: defining type: generic_fail::<T>
error[E0309]: the parameter type `T` may not live long enough
- --> $DIR/ty-param-closure-approximate-lower-bound.rs:29:24
+ --> $DIR/ty-param-closure-approximate-lower-bound.rs:29:31
|
LL | twice(cell, value, |a, b| invoke(a, b));
- | ^^^^^^^^^^^^^^^^^^^ ...so that the type `T` will meet its required lifetime bounds
+ | ^^^^^^^^^^^^ ...so that the type `T` will meet its required lifetime bounds
|
help: consider adding an explicit lifetime bound...
|
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 50d9e3aab..35979c8bf 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
@@ -23,10 +23,10 @@ LL | | T: Debug,
= note: defining type: no_region::<'_#1r, T>
error[E0309]: the parameter type `T` may not live long enough
- --> $DIR/ty-param-closure-outlives-from-return-type.rs:26:23
+ --> $DIR/ty-param-closure-outlives-from-return-type.rs:26:27
|
LL | with_signature(x, |y| y)
- | ^^^^^ ...so that the type `T` will meet its required lifetime bounds
+ | ^ ...so that the type `T` will meet its required lifetime bounds
|
help: consider adding an explicit lifetime bound...
|
diff --git a/src/test/ui/nll/ty-outlives/ty-param-closure-outlives-from-where-clause.rs b/src/test/ui/nll/ty-outlives/ty-param-closure-outlives-from-where-clause.rs
index d7702def3..b80287610 100644
--- a/src/test/ui/nll/ty-outlives/ty-param-closure-outlives-from-where-clause.rs
+++ b/src/test/ui/nll/ty-outlives/ty-param-closure-outlives-from-where-clause.rs
@@ -25,13 +25,12 @@ where
#[rustc_regions]
fn no_region<'a, T>(a: Cell<&'a ()>, b: T) {
with_signature(a, b, |x, y| {
- //~^ ERROR the parameter type `T` may not live long enough
- //
// See `correct_region`, which explains the point of this
// test. The only difference is that, in the case of this
// function, there is no where clause *anywhere*, and hence we
// get an error (but reported by the closure creator).
require(&x, &y)
+ //~^ ERROR the parameter type `T` may not live long enough
})
}
@@ -62,9 +61,9 @@ where
T: 'b,
{
with_signature(a, b, |x, y| {
- //~^ ERROR the parameter type `T` may not live long enough
// See `correct_region`
require(&x, &y)
+ //~^ ERROR the parameter type `T` may not live long enough
})
}
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 14c55e32a..4c97db58c 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
@@ -22,17 +22,10 @@ LL | fn no_region<'a, T>(a: Cell<&'a ()>, b: T) {
= note: defining type: no_region::<T>
error[E0309]: the parameter type `T` may not live long enough
- --> $DIR/ty-param-closure-outlives-from-where-clause.rs:27:26
+ --> $DIR/ty-param-closure-outlives-from-where-clause.rs:32:9
|
-LL | with_signature(a, b, |x, y| {
- | __________________________^
-LL | |
-LL | | //
-LL | | // See `correct_region`, which explains the point of this
-... |
-LL | | require(&x, &y)
-LL | | })
- | |_____^ ...so that the type `T` will meet its required lifetime bounds
+LL | require(&x, &y)
+ | ^^^^^^^^^^^^^^^ ...so that the type `T` will meet its required lifetime bounds
|
help: consider adding an explicit lifetime bound...
|
@@ -40,7 +33,7 @@ LL | fn no_region<'a, T: 'a>(a: Cell<&'a ()>, b: T) {
| ++++
note: external requirements
- --> $DIR/ty-param-closure-outlives-from-where-clause.rs:43:26
+ --> $DIR/ty-param-closure-outlives-from-where-clause.rs:42:26
|
LL | with_signature(a, b, |x, y| {
| ^^^^^^
@@ -54,7 +47,7 @@ LL | with_signature(a, b, |x, y| {
= note: where T: '_#2r
note: no external requirements
- --> $DIR/ty-param-closure-outlives-from-where-clause.rs:39:1
+ --> $DIR/ty-param-closure-outlives-from-where-clause.rs:38:1
|
LL | / fn correct_region<'a, T>(a: Cell<&'a ()>, b: T)
LL | | where
@@ -64,7 +57,7 @@ LL | | T: 'a,
= note: defining type: correct_region::<'_#1r, T>
note: external requirements
- --> $DIR/ty-param-closure-outlives-from-where-clause.rs:64:26
+ --> $DIR/ty-param-closure-outlives-from-where-clause.rs:63:26
|
LL | with_signature(a, b, |x, y| {
| ^^^^^^
@@ -79,7 +72,7 @@ LL | with_signature(a, b, |x, y| {
= note: where T: '_#2r
note: no external requirements
- --> $DIR/ty-param-closure-outlives-from-where-clause.rs:60:1
+ --> $DIR/ty-param-closure-outlives-from-where-clause.rs:59:1
|
LL | / fn wrong_region<'a, 'b, T>(a: Cell<&'a ()>, b: T)
LL | | where
@@ -89,15 +82,10 @@ LL | | T: 'b,
= note: defining type: wrong_region::<'_#1r, T>
error[E0309]: the parameter type `T` may not live long enough
- --> $DIR/ty-param-closure-outlives-from-where-clause.rs:64:26
+ --> $DIR/ty-param-closure-outlives-from-where-clause.rs:65:9
|
-LL | with_signature(a, b, |x, y| {
- | __________________________^
-LL | |
-LL | | // See `correct_region`
-LL | | require(&x, &y)
-LL | | })
- | |_____^ ...so that the type `T` will meet its required lifetime bounds
+LL | require(&x, &y)
+ | ^^^^^^^^^^^^^^^ ...so that the type `T` will meet its required lifetime bounds
|
help: consider adding an explicit lifetime bound...
|
@@ -105,7 +93,7 @@ LL | T: 'b + 'a,
| ++++
note: external requirements
- --> $DIR/ty-param-closure-outlives-from-where-clause.rs:77:26
+ --> $DIR/ty-param-closure-outlives-from-where-clause.rs:76:26
|
LL | with_signature(a, b, |x, y| {
| ^^^^^^
@@ -119,7 +107,7 @@ LL | with_signature(a, b, |x, y| {
= note: where T: '_#3r
note: no external requirements
- --> $DIR/ty-param-closure-outlives-from-where-clause.rs:72:1
+ --> $DIR/ty-param-closure-outlives-from-where-clause.rs:71:1
|
LL | / fn outlives_region<'a, 'b, T>(a: Cell<&'a ()>, b: T)
LL | | where