Open japaric opened 8 years ago
fn hint_none<R, F: FnOnce() -> R>(_: F) -> Option<T> {None}
...
let mut maybe_foo = hint_none(mk_foo);
Is this blocked on the implemention of rust-lang/rfcs#2071 ?
This isn't a full solution, but the code in the original issue report can be fixed using UFCS: Foo::foo(&f)
works.
STR
This works:
but changes the behaviour of the code.
My first attempt to fix this was:
but:
My second attempt was:
but:
What? They have the same type.
Are
impl Trait
types inlet
statements planned? Or can type inference be ... improved (?) to handle the last case? Or does anyone know how to work around this? :smile:cc @eddyb