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 14:46:13 -04:00
fn foo<T: Any>(value: &T) -> Box<dyn Any> {
2022-05-22 01:02:55 -04:00
Box::new(value) as Box<dyn Any>
2022-04-01 13:13:25 -04:00
//~^ ERROR lifetime may not live long enough
}
fn main() {
let _ = foo(&5);
}