fork/rust

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

borsAuto merge of #67350 - Mark-Simulacrum:stable-next, r=Mark-Simulacrum73528e339aa

1.40.0
2.0 KiB53 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   |             ^^
22   = note: ...so that the expression is assignable:
23           expected &'b (dyn SomeTrait + 'b)
24              found &dyn SomeTrait
25
26error[E0495]: cannot infer an appropriate lifetime due to conflicting requirements
27  --> $DIR/object-lifetime-default-elision.rs:71:5
28   |
29LL |     ss
30   |     ^^
31   |
32note: first, the lifetime cannot outlive the lifetime `'a` as defined on the function body at 54:10...
33  --> $DIR/object-lifetime-default-elision.rs:54:10
34   |
35LL | fn load3<'a,'b>(ss: &'a dyn SomeTrait) -> &'b dyn SomeTrait {
36   |          ^^
37note: ...so that the declared lifetime parameter bounds are satisfied
38  --> $DIR/object-lifetime-default-elision.rs:71:5
39   |
40LL |     ss
41   |     ^^
42note: but, the lifetime must be valid for the lifetime `'b` as defined on the function body at 54:13...
43  --> $DIR/object-lifetime-default-elision.rs:54:13
44   |
45LL | fn load3<'a,'b>(ss: &'a dyn SomeTrait) -> &'b dyn SomeTrait {
46   |             ^^
47   = note: ...so that the expression is assignable:
48           expected &'b (dyn SomeTrait + 'b)
49              found &dyn SomeTrait
50
51error: aborting due to 2 previous errors
52
53For more information about this error, try `rustc --explain E0495`.