]> git.proxmox.com Git - rustc.git/blame - src/test/ui/issues/issue-16922.stderr
New upstream version 1.56.0~beta.4+dfsg1
[rustc.git] / src / test / ui / issues / issue-16922.stderr
CommitLineData
3dfed10e 1error[E0759]: `value` has an anonymous lifetime `'_` but it needs to satisfy a `'static` lifetime requirement
f9f354fc 2 --> $DIR/issue-16922.rs:4:14
8faf50e0 3 |
dc9dc135 4LL | fn foo<T: Any>(value: &T) -> Box<dyn Any> {
f035d41b 5 | -- this data with an anonymous lifetime `'_`...
dc9dc135 6LL | Box::new(value) as Box<dyn Any>
f035d41b 7 | ^^^^^ ...is captured here, requiring it to live as long as `'static`
f9f354fc 8 |
f035d41b 9help: to declare that the trait object captures data from argument `value`, you can add an explicit `'_` lifetime bound
f9f354fc
XL
10 |
11LL | fn foo<T: Any>(value: &T) -> Box<dyn Any + '_> {
94222f64 12 | ++++
8faf50e0
XL
13
14error: aborting due to previous error
15
f035d41b 16For more information about this error, try `rustc --explain E0759`.