Skip to content

Function pointers don't seem to be mentioned in the book #26746

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

Closed
niconii opened this issue Jul 3, 2015 · 2 comments
Closed

Function pointers don't seem to be mentioned in the book #26746

niconii opened this issue Jul 3, 2015 · 2 comments

Comments

@niconii
Copy link
Contributor

niconii commented Jul 3, 2015

The fact that function pointers implement the closure traits Fn/FnMut/FnOnce also doesn't seem to be mentioned in either the book or the reference.

@steveklabnik
Copy link
Member

We do mention the type, but not that they implement Fn: http://doc.rust-lang.org/book/primitive-types.html#functions

@arielb1 arielb1 added the A-docs label Jul 4, 2015
@reem
Copy link
Contributor

reem commented Jul 10, 2015

Note that fn items are not actually function pointers, they share the same mechanism as closures of being anonymous types with impls of Fn*; they are only coercible to fn pointers (fn(X) -> Y).

steveklabnik added a commit to steveklabnik/rust that referenced this issue Aug 5, 2015
1. mention them in the function chapter
2. mention their coercion to closures in the closures chapter

Fixes rust-lang#26746
steveklabnik added a commit to steveklabnik/rust that referenced this issue Aug 5, 2015
1. mention them in the function chapter
2. mention their coercion to closures in the closures chapter

Fixes rust-lang#26746
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants
@steveklabnik @arielb1 @reem @niconii and others