Skip to content
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

librustc: Make bare functions implement the FnMut trait. #15937

Closed
wants to merge 1 commit into from

Conversation

pcwalton
Copy link
Contributor

This is done entirely in the libraries for functions up to 16 arguments.
A macro is used so that more arguments can be easily added if we need.
Note that I had to adjust the overloaded call algorithm to not try
calling the overloaded call operator if the callee is a built-in
function type, to prevent loops.

Closes #15448.

r? @huonw

This is done entirely in the libraries for functions up to 16 arguments.
A macro is used so that more arguments can be easily added if we need.
Note that I had to adjust the overloaded call algorithm to not try
calling the overloaded call operator if the callee is a built-in
function type, to prevent loops.

Closes rust-lang#15448.
@huonw
Copy link
Member

huonw commented Jul 24, 2014

These can implement Fn and FnOnce too, right? (I guess it should be possible to just add those impls to the macro expansion.)

@pcwalton
Copy link
Contributor Author

They could, but it may interact weirdly with overloaded calls.

@lilyball
Copy link
Contributor

I don't suppose this should be #[inline]?

@pcwalton
Copy link
Contributor Author

Thought about it, but it's generic so it will almost certainly be inlined. Can't hurt though.

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

Successfully merging this pull request may close these issues.

fn() does not implement FnMut
4 participants