1 error[E0597]: `val` does not live long enough
2 --> $DIR/impl-on-dyn-trait-with-implicit-static-bound-needing-more-suggestions.rs:22:9
4 LL | fn use_it<'a>(val: Box<dyn ObjectTrait<Assoc = i32>>) -> impl OtherTrait<'a> {
5 | -- lifetime `'a` defined here ------------------- opaque type requires that `val` is borrowed for `'a`
7 | ^^^ borrowed value does not live long enough
9 | - `val` dropped here while still borrowed
11 help: you can add a bound to the opaque type to make it last less than `'static` and match `'a`
13 LL | fn use_it<'a>(val: Box<dyn ObjectTrait<Assoc = i32>>) -> impl OtherTrait<'a> + 'a {
16 error[E0515]: cannot return value referencing function parameter `val`
17 --> $DIR/impl-on-dyn-trait-with-implicit-static-bound-needing-more-suggestions.rs:44:9
22 | returns a value referencing data owned by the current function
23 | `val` is borrowed here
25 error[E0515]: cannot return value referencing function parameter `val`
26 --> $DIR/impl-on-dyn-trait-with-implicit-static-bound-needing-more-suggestions.rs:110:9
31 | returns a value referencing data owned by the current function
32 | `val` is borrowed here
34 error[E0767]: `val` has lifetime `'a` but calling `use_self` introduces an implicit `'static` lifetime requirement
35 --> $DIR/impl-on-dyn-trait-with-implicit-static-bound-needing-more-suggestions.rs:67:13
37 LL | fn use_it<'a>(val: Box<dyn ObjectTrait<Assoc = i32> + 'a>) -> &'a () {
38 | -------------------------------------- this data with lifetime `'a`...
40 | ^^^^^^^^ ...is captured and required to live as long as `'static` here
42 note: the used `impl` has a `'static` requirement
43 --> $DIR/impl-on-dyn-trait-with-implicit-static-bound-needing-more-suggestions.rs:61:30
45 LL | impl MyTrait for Box<dyn ObjectTrait<Assoc = i32>> {
46 | ^^^^^^^^^^^^^^^^^^^^^^^^ this has an implicit `'static` lifetime requirement
47 LL | fn use_self(&self) -> &() { panic!() }
48 | -------- calling this method introduces the `impl`'s 'static` requirement
49 help: consider relaxing the implicit `'static` requirement
51 LL | impl MyTrait for Box<dyn ObjectTrait<Assoc = i32> + '_> {
54 error: aborting due to 4 previous errors
56 Some errors have detailed explanations: E0515, E0597.
57 For more information about an error, try `rustc --explain E0515`.