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

allow rvalue temporaries to be borrowed as &mut #5967

Closed
thestinger opened this issue Apr 20, 2013 · 1 comment
Closed

allow rvalue temporaries to be borrowed as &mut #5967

thestinger opened this issue Apr 20, 2013 · 1 comment
Labels
C-enhancement Category: An issue proposing an enhancement or a PR with one.

Comments

@thestinger
Copy link
Contributor

You can currently borrow an rvalue as & or move out of it, but can't borrow it as &mut.

The use case for this is making external iterators more convenient to use by not requiring a temporary. Instead of let mut it = x.chain(y).zip(z); for it.advance |x| { ... } it could just be for x.chain(y).zip(z).advance |x| { ... }.

I've run into this in a few other places but I didn't think twice about it and just did the temporary workaround - but after some thought this seems like an unnecessary restriction.

@thestinger
Copy link
Contributor Author

Fixed by #6473.

flip1995 pushed a commit to flip1995/rust that referenced this issue Aug 28, 2020
…ay, r=ebroto

Fix FP in `to_string_in_display`

Don't emit a lint when `.to_string()` on anything that is not `self`

Fix rust-lang#5967

changelog: Fix FP in `to_string_in_display` when calling `.to_string()` on anything that is not `self`
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-enhancement Category: An issue proposing an enhancement or a PR with one.
Projects
None yet
Development

No branches or pull requests

1 participant