about summary refs log tree commit diff
path: root/tests/ui/suggestions/impl-on-dyn-trait-with-implicit-static-bound-needing-more-suggestions.stderr
blob: 505765d2b41f60f428fa923c70c0273650bcc945 (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
62
63
64
65
66
67
68
69
70
71
72
73
74
error[E0515]: cannot return value referencing function parameter `val`
  --> $DIR/impl-on-dyn-trait-with-implicit-static-bound-needing-more-suggestions.rs:21:9
   |
LL |         val.use_self()
   |         ---^^^^^^^^^^^
   |         |
   |         returns a value referencing data owned by the current function
   |         `val` is borrowed here

error[E0515]: cannot return value referencing function parameter `val`
  --> $DIR/impl-on-dyn-trait-with-implicit-static-bound-needing-more-suggestions.rs:43:9
   |
LL |         val.use_self()
   |         ---^^^^^^^^^^^
   |         |
   |         returns a value referencing data owned by the current function
   |         `val` is borrowed here

error[E0515]: cannot return value referencing function parameter `val`
  --> $DIR/impl-on-dyn-trait-with-implicit-static-bound-needing-more-suggestions.rs:112:9
   |
LL |         val.use_self()
   |         ---^^^^^^^^^^^
   |         |
   |         returns a value referencing data owned by the current function
   |         `val` is borrowed here

error[E0521]: borrowed data escapes outside of function
  --> $DIR/impl-on-dyn-trait-with-implicit-static-bound-needing-more-suggestions.rs:66:9
   |
LL |     fn use_it<'a>(val: Box<dyn ObjectTrait<Assoc = i32> + 'a>) -> &'a () {
   |               --  --- `val` is a reference that is only valid in the function body
   |               |
   |               lifetime `'a` defined here
LL |         val.use_self()
   |         ^^^^^^^^^^^^^^
   |         |
   |         `val` escapes the function body here
   |         argument requires that `'a` must outlive `'static`
   |
note: the used `impl` has a `'static` requirement
  --> $DIR/impl-on-dyn-trait-with-implicit-static-bound-needing-more-suggestions.rs:60:30
   |
LL |     impl MyTrait for Box<dyn ObjectTrait<Assoc = i32>> {
   |                              ^^^^^^^^^^^^^^^^^^^^^^^^ this has an implicit `'static` lifetime requirement
LL |         fn use_self(&self) -> &() { panic!() }
   |            -------- calling this method introduces the `impl`'s `'static` requirement
help: consider relaxing the implicit `'static` requirement
   |
LL |     impl MyTrait for Box<dyn ObjectTrait<Assoc = i32> + '_> {
   |                                                       ++++

error[E0515]: cannot return value referencing function parameter `val`
  --> $DIR/impl-on-dyn-trait-with-implicit-static-bound-needing-more-suggestions.rs:66:9
   |
LL |         val.use_self()
   |         ---^^^^^^^^^^^
   |         |
   |         returns a value referencing data owned by the current function
   |         `val` is borrowed here

error[E0515]: cannot return value referencing function parameter `val`
  --> $DIR/impl-on-dyn-trait-with-implicit-static-bound-needing-more-suggestions.rs:90:9
   |
LL |         val.use_self()
   |         ---^^^^^^^^^^^
   |         |
   |         returns a value referencing data owned by the current function
   |         `val` is borrowed here

error: aborting due to 6 previous errors

Some errors have detailed explanations: E0515, E0521.
For more information about an error, try `rustc --explain E0515`.