2015-03-15 13:30:37 -07:00
|
|
|
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
|
2015-03-15 13:30:37 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
fn main() {
|
|
|
|
let _ = foo(&5);
|
|
|
|
}
|