]> git.proxmox.com Git - rustc.git/blame - src/test/ui/suggestions/impl-on-dyn-trait-with-implicit-static-bound-needing-more-suggestions.nll.stderr
New upstream version 1.56.0~beta.4+dfsg1
[rustc.git] / src / test / ui / suggestions / impl-on-dyn-trait-with-implicit-static-bound-needing-more-suggestions.nll.stderr
CommitLineData
3dfed10e
XL
1error[E0597]: `val` does not live long enough
2 --> $DIR/impl-on-dyn-trait-with-implicit-static-bound-needing-more-suggestions.rs:21:9
3 |
4LL | 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`
6LL | val.use_self()
7 | ^^^ borrowed value does not live long enough
8LL | }
9 | - `val` dropped here while still borrowed
10 |
11help: you can add a bound to the opaque type to make it last less than `'static` and match `'a`
12 |
13LL | fn use_it<'a>(val: Box<dyn ObjectTrait<Assoc = i32>>) -> impl OtherTrait<'a> + 'a {
94222f64 14 | ++++
3dfed10e
XL
15
16error[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 |
19LL | val.use_self()
20 | ---^^^^^^^^^^^
21 | |
22 | returns a value referencing data owned by the current function
23 | `val` is borrowed here
24
25error[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 |
28LL | val.use_self()
29 | ---^^^^^^^^^^^
30 | |
31 | returns a value referencing data owned by the current function
32 | `val` is borrowed here
33
34error: aborting due to 3 previous errors
35
36Some errors have detailed explanations: E0515, E0597.
37For more information about an error, try `rustc --explain E0515`.