fork/rust

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

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

master
1.5 KiB34 linesraw
1error: lifetime may not live long enough
2  --> $DIR/regions-trait-object-subtyping.rs:15:5
3   |
4LL | fn foo3<'a,'b>(x: &'a mut dyn Dummy) -> &'b mut dyn Dummy {
5   |         -- -- lifetime `'b` defined here
6   |         |
7   |         lifetime `'a` defined here
8LL |     // Without knowing 'a:'b, we can't coerce
9LL |     x
10   |     ^ function was supposed to return data with lifetime `'b` but it is returning data with lifetime `'a`
11   |
12   = help: consider adding the following bound: `'a: 'b`
13   = note: requirement occurs because of a mutable reference to `dyn Dummy`
14   = note: mutable references are invariant over their type parameter
15   = help: see <https://doc.rust-lang.org/nomicon/subtyping.html> for more information about variance
16
17error: lifetime may not live long enough
18  --> $DIR/regions-trait-object-subtyping.rs:22:5
19   |
20LL | fn foo4<'a:'b,'b>(x: Wrapper<&'a mut dyn Dummy>) -> Wrapper<&'b mut dyn Dummy> {
21   |         --    -- lifetime `'b` defined here
22   |         |
23   |         lifetime `'a` defined here
24LL |     // We can't coerce because it is packed in `Wrapper`
25LL |     x
26   |     ^ function was supposed to return data with lifetime `'a` but it is returning data with lifetime `'b`
27   |
28   = help: consider adding the following bound: `'b: 'a`
29   = note: requirement occurs because of a mutable reference to `dyn Dummy`
30   = note: mutable references are invariant over their type parameter
31   = help: see <https://doc.rust-lang.org/nomicon/subtyping.html> for more information about variance
32
33error: aborting due to 2 previous errors
34