fork/rust

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

borsAuto merge of #69444 - pietroalbini:stable-next-final-v2-new, r=pietroalbinif3e1a954d2e

1.41.1
1.4 KiB34 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      ^ returning this value requires that `'a` must outlive `'b`
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:19: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
21error: lifetime may not live long enough
22  --> $DIR/regions-infer-not-param.rs:19:63
23   |
24LL | fn take_indirect2<'a,'b>(p: Indirect2<'a>) -> Indirect2<'b> { p }
25   |                   -- -- lifetime `'b` defined here            ^ returning this value requires that `'a` must outlive `'b`
26   |                   |
27   |                   lifetime `'a` defined here
28   |
29   = help: consider adding the following bound: `'a: 'b`
30
31help: `'b` and `'a` must be the same: replace one with the other
32
33error: aborting due to 3 previous errors
34