]> git.lizzy.rs Git - rust.git/blob - src/test/ui/associated-types/cache/project-fn-ret-invariant.oneuse.stderr
Rollup merge of #105567 - TimNN:kcfi16, r=nikic
[rust.git] / src / test / ui / associated-types / cache / project-fn-ret-invariant.oneuse.stderr
1 error: lifetime may not live long enough
2   --> $DIR/project-fn-ret-invariant.rs:40:13
3    |
4 LL | fn baz<'a, 'b>(x: Type<'a>, y: Type<'b>) -> (Type<'a>, Type<'b>) {
5    |        --  -- lifetime `'b` defined here
6    |        |
7    |        lifetime `'a` defined here
8 LL |     let f = foo; // <-- No consistent type can be inferred for `f` here.
9 LL |     let a = bar(f, x);
10    |             ^^^^^^^^^ argument requires that `'a` must outlive `'b`
11    |
12    = help: consider adding the following bound: `'a: 'b`
13    = note: requirement occurs because of the type `Type<'_>`, which makes the generic argument `'_` invariant
14    = note: the struct `Type<'a>` is invariant over the parameter `'a`
15    = help: see <https://doc.rust-lang.org/nomicon/subtyping.html> for more information about variance
16
17 error: lifetime may not live long enough
18   --> $DIR/project-fn-ret-invariant.rs:42:13
19    |
20 LL | fn baz<'a, 'b>(x: Type<'a>, y: Type<'b>) -> (Type<'a>, Type<'b>) {
21    |        --  -- lifetime `'b` defined here
22    |        |
23    |        lifetime `'a` defined here
24 ...
25 LL |     let b = bar(f, y);
26    |             ^^^^^^^^^ argument requires that `'b` must outlive `'a`
27    |
28    = help: consider adding the following bound: `'b: 'a`
29    = note: requirement occurs because of the type `Type<'_>`, which makes the generic argument `'_` invariant
30    = note: the struct `Type<'a>` is invariant over the parameter `'a`
31    = help: see <https://doc.rust-lang.org/nomicon/subtyping.html> for more information about variance
32
33 help: `'a` and `'b` must be the same: replace one with the other
34
35 error: aborting due to 2 previous errors
36