rust/tests/ui/traits/trait-upcasting/issue-11515-upcast-fn_mut-fn.rs

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

12 lines
214 B
Rust
Raw Normal View History

// run-pass
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)();
}