summary refs log tree commit diff
path: root/src/test/ui/object-lifetime/object-lifetime-default-elision.stderr
blob: 79ded5fc875a2d41c97b53c761bf26d9efb5b10b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
error[E0495]: cannot infer an appropriate lifetime for automatic coercion due to conflicting requirements
  --> $DIR/object-lifetime-default-elision.rs:71:5
   |
LL |     ss
   |     ^^
   |
note: first, the lifetime cannot outlive the lifetime `'a` as defined on the function body at 54:10...
  --> $DIR/object-lifetime-default-elision.rs:54:10
   |
LL | fn load3<'a,'b>(ss: &'a dyn SomeTrait) -> &'b dyn SomeTrait {
   |          ^^
note: ...so that reference does not outlive borrowed content
  --> $DIR/object-lifetime-default-elision.rs:71:5
   |
LL |     ss
   |     ^^
note: but, the lifetime must be valid for the lifetime `'b` as defined on the function body at 54:13...
  --> $DIR/object-lifetime-default-elision.rs:54:13
   |
LL | fn load3<'a,'b>(ss: &'a dyn SomeTrait) -> &'b dyn SomeTrait {
   |             ^^
note: ...so that the expression is assignable
  --> $DIR/object-lifetime-default-elision.rs:71:5
   |
LL |     ss
   |     ^^
   = note: expected `&'b (dyn SomeTrait + 'b)`
              found `&dyn SomeTrait`

error[E0495]: cannot infer an appropriate lifetime due to conflicting requirements
  --> $DIR/object-lifetime-default-elision.rs:71:5
   |
LL |     ss
   |     ^^
   |
note: first, the lifetime cannot outlive the lifetime `'a` as defined on the function body at 54:10...
  --> $DIR/object-lifetime-default-elision.rs:54:10
   |
LL | fn load3<'a,'b>(ss: &'a dyn SomeTrait) -> &'b dyn SomeTrait {
   |          ^^
note: ...so that the declared lifetime parameter bounds are satisfied
  --> $DIR/object-lifetime-default-elision.rs:71:5
   |
LL |     ss
   |     ^^
note: but, the lifetime must be valid for the lifetime `'b` as defined on the function body at 54:13...
  --> $DIR/object-lifetime-default-elision.rs:54:13
   |
LL | fn load3<'a,'b>(ss: &'a dyn SomeTrait) -> &'b dyn SomeTrait {
   |             ^^
note: ...so that the expression is assignable
  --> $DIR/object-lifetime-default-elision.rs:71:5
   |
LL |     ss
   |     ^^
   = note: expected `&'b (dyn SomeTrait + 'b)`
              found `&dyn SomeTrait`

error: aborting due to 2 previous errors

For more information about this error, try `rustc --explain E0495`.