fork/rust

git clone https://git.julia.blue/fork/rust

borsAuto merge of #103046 - JanBeh:PR_clarify_cmp_terminology, r=workingjubilee3bcad65fbf6

master
2.0 KiB40 linesraw
1error: lifetime may not live long enough
2  --> $DIR/regions-infer-not-param.rs:15:54
3   |
4LL | 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
11error: lifetime may not live long enough
12  --> $DIR/regions-infer-not-param.rs:20:63
13   |
14LL | 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
24error: lifetime may not live long enough
25  --> $DIR/regions-infer-not-param.rs:20:63
26   |
27LL | 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
37help: `'b` and `'a` must be the same: replace one with the other
38
39error: aborting due to 3 previous errors
40