Closed
Description
The following does not compile, but I expect it to! If the argument type is changed from &str
to i32
(and the call site adapted), then it compiles. Playground
#![feature(fnbox)]
use std::boxed::FnBox;
struct Func {
out: Box<FnBox(&str)>
}
impl Func {
fn callme(self) {
let s = String::new();
(self.out)(&s);
}
}
error: expected function, found `Box<for<'r> std::boxed::FnBox<(&'r str,), Output=()> + 'static>`
--> <anon>:12:9
12 |> (self.out)(&s);
|> ^^^^^^^^^^^^^^