2015-09-10 15:26:19 +00:00
|
|
|
use std::any::Any;
|
|
|
|
|
|
|
|
fn main()
|
|
|
|
{
|
|
|
|
fn h(x:i32) -> i32 {3*x}
|
2019-05-28 18:46:13 +00:00
|
|
|
let mut vfnfer:Vec<Box<dyn Any>> = vec![];
|
2022-07-07 02:36:10 +00:00
|
|
|
vfnfer.push(Box::new(h));
|
2019-05-28 18:46:13 +00:00
|
|
|
println!("{:?}",(vfnfer[0] as dyn Fn)(3));
|
2015-09-10 15:26:19 +00:00
|
|
|
//~^ ERROR the precise format of `Fn`-family traits'
|
2021-01-02 18:45:11 +00:00
|
|
|
//~| ERROR missing generics for trait `Fn`
|
2020-09-02 07:40:56 +00:00
|
|
|
//~| ERROR the value of the associated type `Output` (from trait `FnOnce`)
|
2015-09-10 15:26:19 +00:00
|
|
|
}
|