]> git.lizzy.rs Git - rust.git/blob - tests/ui/regions/regions-infer-not-param.stderr
internally change regions to be covariant
[rust.git] / tests / ui / regions / regions-infer-not-param.stderr
1 error: lifetime may not live long enough
2   --> $DIR/regions-infer-not-param.rs:15:54
3    |
4 LL | fn take_direct<'a,'b>(p: Direct<'a>) -> Direct<'b> { p }
5    |                -- -- lifetime `'b` defined here      ^ function was supposed to return data with lifetime `'b` but it is returning data with lifetime `'a`
6    |                |
7    |                lifetime `'a` defined here
8    |
9    = help: consider adding the following bound: `'a: 'b`
10
11 error: lifetime may not live long enough
12   --> $DIR/regions-infer-not-param.rs:20:63
13    |
14 LL | fn take_indirect2<'a,'b>(p: Indirect2<'a>) -> Indirect2<'b> { p }
15    |                   -- -- lifetime `'b` defined here            ^ function was supposed to return data with lifetime `'a` but it is returning data with lifetime `'b`
16    |                   |
17    |                   lifetime `'a` defined here
18    |
19    = help: consider adding the following bound: `'b: 'a`
20    = note: requirement occurs because of the type `Indirect2<'_>`, which makes the generic argument `'_` invariant
21    = note: the struct `Indirect2<'a>` is invariant over the parameter `'a`
22    = help: see <https://doc.rust-lang.org/nomicon/subtyping.html> for more information about variance
23
24 error: lifetime may not live long enough
25   --> $DIR/regions-infer-not-param.rs:20:63
26    |
27 LL | fn take_indirect2<'a,'b>(p: Indirect2<'a>) -> Indirect2<'b> { p }
28    |                   -- -- lifetime `'b` defined here            ^ function was supposed to return data with lifetime `'b` but it is returning data with lifetime `'a`
29    |                   |
30    |                   lifetime `'a` defined here
31    |
32    = help: consider adding the following bound: `'a: 'b`
33    = note: requirement occurs because of the type `Indirect2<'_>`, which makes the generic argument `'_` invariant
34    = note: the struct `Indirect2<'a>` is invariant over the parameter `'a`
35    = help: see <https://doc.rust-lang.org/nomicon/subtyping.html> for more information about variance
36
37 help: `'b` and `'a` must be the same: replace one with the other
38
39 error: aborting due to 3 previous errors
40