fork/rust

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

borsAuto merge of #68568 - pietroalbini:stable-next, r=pietroalbini5e1a799842b

1.41.0
2.1 KiB61 linesraw
1error[E0495]: cannot infer an appropriate lifetime for automatic coercion due to conflicting requirements
2  --> $DIR/object-lifetime-default-elision.rs:71:5
3   |
4LL |     ss
5   |     ^^
6   |
7note: first, the lifetime cannot outlive the lifetime `'a` as defined on the function body at 54:10...
8  --> $DIR/object-lifetime-default-elision.rs:54:10
9   |
10LL | fn load3<'a,'b>(ss: &'a dyn SomeTrait) -> &'b dyn SomeTrait {
11   |          ^^
12note: ...so that reference does not outlive borrowed content
13  --> $DIR/object-lifetime-default-elision.rs:71:5
14   |
15LL |     ss
16   |     ^^
17note: but, the lifetime must be valid for the lifetime `'b` as defined on the function body at 54:13...
18  --> $DIR/object-lifetime-default-elision.rs:54:13
19   |
20LL | fn load3<'a,'b>(ss: &'a dyn SomeTrait) -> &'b dyn SomeTrait {
21   |             ^^
22note: ...so that the expression is assignable
23  --> $DIR/object-lifetime-default-elision.rs:71:5
24   |
25LL |     ss
26   |     ^^
27   = note: expected  `&'b (dyn SomeTrait + 'b)`
28              found  `&dyn SomeTrait`
29
30error[E0495]: cannot infer an appropriate lifetime due to conflicting requirements
31  --> $DIR/object-lifetime-default-elision.rs:71:5
32   |
33LL |     ss
34   |     ^^
35   |
36note: first, the lifetime cannot outlive the lifetime `'a` as defined on the function body at 54:10...
37  --> $DIR/object-lifetime-default-elision.rs:54:10
38   |
39LL | fn load3<'a,'b>(ss: &'a dyn SomeTrait) -> &'b dyn SomeTrait {
40   |          ^^
41note: ...so that the declared lifetime parameter bounds are satisfied
42  --> $DIR/object-lifetime-default-elision.rs:71:5
43   |
44LL |     ss
45   |     ^^
46note: but, the lifetime must be valid for the lifetime `'b` as defined on the function body at 54:13...
47  --> $DIR/object-lifetime-default-elision.rs:54:13
48   |
49LL | fn load3<'a,'b>(ss: &'a dyn SomeTrait) -> &'b dyn SomeTrait {
50   |             ^^
51note: ...so that the expression is assignable
52  --> $DIR/object-lifetime-default-elision.rs:71:5
53   |
54LL |     ss
55   |     ^^
56   = note: expected  `&'b (dyn SomeTrait + 'b)`
57              found  `&dyn SomeTrait`
58
59error: aborting due to 2 previous errors
60
61For more information about this error, try `rustc --explain E0495`.