4c2d6de70e
Aka trait_upcasting feature. And also adjust the `deref_into_dyn_supertrait` lint.
12 lines
214 B
Rust
12 lines
214 B
Rust
// 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)();
|
|
}
|