mirror of
https://github.com/rust-lang/rust.git
synced 2024-12-04 04:39:16 +00:00
13 lines
244 B
Rust
13 lines
244 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)();
|
|
}
|