fork/rust

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

borsAuto merge of #66089 - Mark-Simulacrum:stable-next, r=Mark-Simulacrum4560ea788cb

1.39.0
2.4 KiB65 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   |            ^^
39   = note: ...so that the expression is assignable:
40           expected &'b mut (dyn Dummy + 'b)
41              found &mut (dyn Dummy + 'b)
42
43error[E0308]: mismatched types
44  --> $DIR/regions-trait-object-subtyping.rs:22:5
45   |
46LL |     x
47   |     ^ lifetime mismatch
48   |
49   = note: expected type `Wrapper<&'b mut (dyn Dummy + 'b)>`
50              found type `Wrapper<&'a mut (dyn Dummy + 'a)>`
51note: the lifetime 'b as defined on the function body at 20:15...
52  --> $DIR/regions-trait-object-subtyping.rs:20:15
53   |
54LL | fn foo4<'a:'b,'b>(x: Wrapper<&'a mut dyn Dummy>) -> Wrapper<&'b mut dyn Dummy> {
55   |               ^^
56note: ...does not necessarily outlive the lifetime 'a as defined on the function body at 20:9
57  --> $DIR/regions-trait-object-subtyping.rs:20:9
58   |
59LL | fn foo4<'a:'b,'b>(x: Wrapper<&'a mut dyn Dummy>) -> Wrapper<&'b mut dyn Dummy> {
60   |         ^^
61
62error: aborting due to 3 previous errors
63
64Some errors have detailed explanations: E0308, E0478.
65For more information about an error, try `rustc --explain E0308`.