]> git.lizzy.rs Git - rust.git/blob - src/test/ui/suggestions/impl-on-dyn-trait-with-implicit-static-bound-needing-more-suggestions.nll.stderr
Add warning when whitespace is not skipped after an escaped newline.
[rust.git] / src / test / ui / suggestions / impl-on-dyn-trait-with-implicit-static-bound-needing-more-suggestions.nll.stderr
1 error[E0597]: `val` does not live long enough
2   --> $DIR/impl-on-dyn-trait-with-implicit-static-bound-needing-more-suggestions.rs:21:9
3    |
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`
6 LL |         val.use_self()
7    |         ^^^ borrowed value does not live long enough
8 LL |     }
9    |     - `val` dropped here while still borrowed
10    |
11 help: you can add a bound to the opaque type to make it last less than `'static` and match `'a`
12    |
13 LL |     fn use_it<'a>(val: Box<dyn ObjectTrait<Assoc = i32>>) -> impl OtherTrait<'a> + 'a {
14    |                                                                                  ^^^^
15
16 error[E0515]: cannot return value referencing function parameter `val`
17   --> $DIR/impl-on-dyn-trait-with-implicit-static-bound-needing-more-suggestions.rs:43:9
18    |
19 LL |         val.use_self()
20    |         ---^^^^^^^^^^^
21    |         |
22    |         returns a value referencing data owned by the current function
23    |         `val` is borrowed here
24
25 error[E0515]: cannot return value referencing function parameter `val`
26   --> $DIR/impl-on-dyn-trait-with-implicit-static-bound-needing-more-suggestions.rs:109:9
27    |
28 LL |         val.use_self()
29    |         ---^^^^^^^^^^^
30    |         |
31    |         returns a value referencing data owned by the current function
32    |         `val` is borrowed here
33
34 error: aborting due to 3 previous errors
35
36 Some errors have detailed explanations: E0515, E0597.
37 For more information about an error, try `rustc --explain E0515`.