Open
Description
In the various revisions of src/test/ui/associated-types/cache/project-fn-ret-invariant.rs, we go from
error[E0759]: `x` has lifetime `'a` but it needs to satisfy a `'static` lifetime requirement
--> $DIR/project-fn-ret-invariant.rs:55:9
|
LL | fn baz<'a, 'b>(x: Type<'a>) -> Type<'static> {
| -------- this data with lifetime `'a`...
...
LL | bar(foo, x)
| ^^^ - ...is used and required to live as long as `'static` here
|
note: `'static` lifetime requirement introduced by the return type
--> $DIR/project-fn-ret-invariant.rs:51:37
|
LL | fn baz<'a, 'b>(x: Type<'a>) -> Type<'static> {
| ^^^^^^^ `'static` requirement introduced here
...
LL | bar(foo, x)
| ----------- because of this returned expression
to
error: lifetime may not live long enough
--> $DIR/project-fn-ret-invariant-nll.rs:56:5
|
LL | fn baz<'a, 'b>(x: Type<'a>) -> Type<'static> {
| -- lifetime `'a` defined here
...
LL | bar(foo, x)
| ^^^^^^^^^^^ returning this value requires that `'a` must outlive `'static`
|
= note: requirement occurs because of the type `Type<'_>`, which makes the generic argument `'_` invariant
= note: the struct `Type<'a>` is invariant over the parameter `'a`
= help: see <https://doc.rust-lang.org/nomicon/subtyping.html> for more information about variance
We lose the note, particularly the bit pointing to the return type (it's sort of in the note, but not exactly)