rust/tests/ui/traits/trait-upcasting/issue-11515-upcast-fn_mut-fn.rs
2023-01-11 09:32:08 +00:00

13 lines
243 B
Rust

// run-pass
#![feature(trait_upcasting)]
struct Test {
func: Box<dyn FnMut() + 'static>,
}
fn main() {
let closure: Box<dyn Fn() + 'static> = Box::new(|| ());
let mut test = Box::new(Test { func: closure });
(test.func)();
}