Closed
Description
There seems to be no way to use a ~fn inside an Option without rewriting the type every time you use it. This line:
let _:Option<~fn()> = Some(|| { });
gives this error message:
error: mismatched types: expected `std::option::Option<~fn:Send()>` but found `std::option::Option<&fn<no-bounds>()>` (expected ~ closure, found & closure)
The problem is that the function inside the Some
is interpreted to be a &fn rather than a ~fn, and then the compiler complains about a type mismatch. The only way to make it work is this to make it Some::<~fn()>(|| { })
instead. But when the function isn't just ~fn()
and has parameters and a return type, that becomes extremely annoying.
Metadata
Metadata
Assignees
Labels
No labels