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

RFC: Cell::with_{mut_,}ref() should use finally #7975

Closed
bblum opened this issue Jul 22, 2013 · 2 comments
Closed

RFC: Cell::with_{mut_,}ref() should use finally #7975

bblum opened this issue Jul 22, 2013 · 2 comments
Labels
C-cleanup Category: PRs that clean code up or issues documenting cleanup.

Comments

@bblum
Copy link
Contributor

bblum commented Jul 22, 2013

currently if the closure passed to with_ref/with_mut_ref fails, the cell will not put back the value that was taken from it. Is this desired? Or should it put it back?

@brson
Copy link
Contributor

brson commented Jul 22, 2013

I think it should put the value back.

@bblum
Copy link
Contributor Author

bblum commented Jul 22, 2013

I'm inclined to agree. The possible argument against is analogous to the reason for poisoning in mutexARC and RWARC -- that failure somehow means the data is in a logically-invalid (though typechecker-valid) state. The idea of poisoning arcs has shrunk on me too, though.

@ghost ghost assigned bblum Aug 8, 2013
@bblum bblum closed this as completed in 31f9b51 Aug 13, 2013
@bblum bblum removed their assignment Jun 16, 2014
flip1995 pushed a commit to flip1995/rust that referenced this issue Nov 23, 2021
Still needs to generalize to other mixes of let bindings, `map` method calls, etc.
flip1995 pushed a commit to flip1995/rust that referenced this issue Nov 23, 2021
Fix `needless_collect`'s tendency to suggest code requiring multiple mutable borrows of the same value.

Fixes error specified in rust-lang#7975.

changelog: [`needless_collect`] no longer suggests removal of `collect` when removal would create code requiring mutably borrowing a value multiple times.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-cleanup Category: PRs that clean code up or issues documenting cleanup.
Projects
None yet
Development

No branches or pull requests

2 participants