rust/tests/ui/issues/issue-16922.rs

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

11 lines
187 B
Rust
Raw Normal View History

use std::any::Any;
2019-05-28 18:46:13 +00:00
fn foo<T: Any>(value: &T) -> Box<dyn Any> {
2022-05-22 05:02:55 +00:00
Box::new(value) as Box<dyn Any>
2022-04-01 17:13:25 +00:00
//~^ ERROR lifetime may not live long enough
}
fn main() {
let _ = foo(&5);
}