mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-23 23:34:48 +00:00
11 lines
187 B
Rust
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);
|
|
}
|