mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-23 15:23:46 +00:00
75 lines
3.1 KiB
Plaintext
75 lines
3.1 KiB
Plaintext
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`.
|