-
Notifications
You must be signed in to change notification settings - Fork 13.3k
Fn is apparently not implemented for fn #20768
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
As far as I know plain #![feature(unboxed_closures)]
fn foo(x: u32) -> u32 { x }
fn main() {
let cl = |&: x| foo(x);
let x = cl.call((42,));
println!("{}", x);
}
|
Bare fns can be used in locations that an implementation of fn foo<F>(_: F) where F: Fn() {}
fn bar() {}
fn main() {
foo(bar)
} I'm not sure how it's implemented. |
@sfackler Oops, I misunderstood what this meant:
The new coercion rules state bare
So, this is perhaps simply because |
This is caused by the fact that the method dispatch path is somewhat different from normal trait dispatch. Bah. |
#![feature(unboxed_closures)]
fn foo(x: u32) -> u32 { x }
fn main() {
let x = Fn::<(u32,),u32>::call(&foo, (42,));
println!("{}", x);
} You can do it this way for soon. |
This appears to have been fixed since being opened. |
http://is.gd/XTrYgZ
The text was updated successfully, but these errors were encountered: