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

split &fn into &fn and &mut fn #8633

Closed
thestinger opened this issue Aug 20, 2013 · 3 comments
Closed

split &fn into &fn and &mut fn #8633

thestinger opened this issue Aug 20, 2013 · 3 comments

Comments

@thestinger
Copy link
Contributor

An &fn would be copyable, because the environment would be immutable. The limitations would match the ones placed on regular borrowed pointers (&mut is moveable, & is immutable) so I think it would result in a more intuitive system.

This would be required to make #8622 (adding dynamically sized bare function objects) backwards compatible but can be implemented independently and will not be an enormous task. All existing &fn would become &mut fn and it will remain the default since &mut coerces to & by-move.

@thestinger
Copy link
Contributor Author

Nominating for the backwards compatible milestone.

@nikomatsakis
Copy link
Contributor

Current plan, I believe, is roughly what I described here: http://smallcultfollowing.com/babysteps/blog/2013/05/30/removing-procs/. In this case, the only remaining closure type would be fn(...) (note the lack of any sort of ampersand).

@thestinger
Copy link
Contributor Author

This won't actually work as is (discussed in the linked bug) so I'm just closing it for now.

flip1995 pushed a commit to flip1995/rust that referenced this issue Apr 7, 2022
…arth

Escape `mod.rs` file mentions to avoid links in our documentation

As the title says nothing special, still a fun fix :)

Closes: rust-lang#8627

changelog: none
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

2 participants