fork/rust

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

borsAuto merge of #72883 - Mark-Simulacrum:stable-next, r=Mark-Simulacrum49cae55760d

1.44.0
2.5 KiB69 linesraw
1error[E0478]: lifetime bound not satisfied
2  --> $DIR/regions-trait-object-subtyping.rs:15:5
3   |
4LL |     x
5   |     ^
6   |
7note: lifetime parameter instantiated with the lifetime `'a` as defined on the function body at 13:9
8  --> $DIR/regions-trait-object-subtyping.rs:13:9
9   |
10LL | fn foo3<'a,'b>(x: &'a mut dyn Dummy) -> &'b mut dyn Dummy {
11   |         ^^
12note: but lifetime parameter must outlive the lifetime `'b` as defined on the function body at 13:12
13  --> $DIR/regions-trait-object-subtyping.rs:13:12
14   |
15LL | fn foo3<'a,'b>(x: &'a mut dyn Dummy) -> &'b mut dyn Dummy {
16   |            ^^
17
18error[E0495]: cannot infer an appropriate lifetime for automatic coercion due to conflicting requirements
19  --> $DIR/regions-trait-object-subtyping.rs:15:5
20   |
21LL |     x
22   |     ^
23   |
24note: first, the lifetime cannot outlive the lifetime `'a` as defined on the function body at 13:9...
25  --> $DIR/regions-trait-object-subtyping.rs:13:9
26   |
27LL | fn foo3<'a,'b>(x: &'a mut dyn Dummy) -> &'b mut dyn Dummy {
28   |         ^^
29note: ...so that reference does not outlive borrowed content
30  --> $DIR/regions-trait-object-subtyping.rs:15:5
31   |
32LL |     x
33   |     ^
34note: but, the lifetime must be valid for the lifetime `'b` as defined on the function body at 13:12...
35  --> $DIR/regions-trait-object-subtyping.rs:13:12
36   |
37LL | fn foo3<'a,'b>(x: &'a mut dyn Dummy) -> &'b mut dyn Dummy {
38   |            ^^
39note: ...so that the expression is assignable
40  --> $DIR/regions-trait-object-subtyping.rs:15:5
41   |
42LL |     x
43   |     ^
44   = note: expected  `&'b mut (dyn Dummy + 'b)`
45              found  `&mut (dyn Dummy + 'b)`
46
47error[E0308]: mismatched types
48  --> $DIR/regions-trait-object-subtyping.rs:22:5
49   |
50LL |     x
51   |     ^ lifetime mismatch
52   |
53   = note: expected struct `Wrapper<&'b mut (dyn Dummy + 'b)>`
54              found struct `Wrapper<&'a mut (dyn Dummy + 'a)>`
55note: the lifetime `'b` as defined on the function body at 20:15...
56  --> $DIR/regions-trait-object-subtyping.rs:20:15
57   |
58LL | fn foo4<'a:'b,'b>(x: Wrapper<&'a mut dyn Dummy>) -> Wrapper<&'b mut dyn Dummy> {
59   |               ^^
60note: ...does not necessarily outlive the lifetime `'a` as defined on the function body at 20:9
61  --> $DIR/regions-trait-object-subtyping.rs:20:9
62   |
63LL | fn foo4<'a:'b,'b>(x: Wrapper<&'a mut dyn Dummy>) -> Wrapper<&'b mut dyn Dummy> {
64   |         ^^
65
66error: aborting due to 3 previous errors
67
68Some errors have detailed explanations: E0308, E0478, E0495.
69For more information about an error, try `rustc --explain E0308`.