rust/tests/ui/issues/issue-16922.rs
2023-01-11 09:32:08 +00:00

11 lines
187 B
Rust

use std::any::Any;
fn foo<T: Any>(value: &T) -> Box<dyn Any> {
Box::new(value) as Box<dyn Any>
//~^ ERROR lifetime may not live long enough
}
fn main() {
let _ = foo(&5);
}