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

Add Mutex methods that ignore poisoning #35092

Closed
brson opened this issue Jul 28, 2016 · 7 comments
Closed

Add Mutex methods that ignore poisoning #35092

brson opened this issue Jul 28, 2016 · 7 comments
Labels
C-enhancement Category: An issue proposing an enhancement or a PR with one. T-libs-api Relevant to the library API team, which will review and decide on the PR/issue.

Comments

@brson
Copy link
Contributor

brson commented Jul 28, 2016

Scenarios where one wants to ignore poisoning happen. Having to type extra incantations to ignore the poisoning can be quite unpleasant, makes Rust less ergonomic, and is a source of complaints. Let's please consider adding conveniences for cases where poisoning is not desired, either additional methods, or new types that do not poison.

@brson brson added I-papercut C-enhancement Category: An issue proposing an enhancement or a PR with one. T-libs-api Relevant to the library API team, which will review and decide on the PR/issue. labels Jul 28, 2016
@brson
Copy link
Contributor Author

brson commented Jul 28, 2016

For reference, this is what you type when you need to ignore poisoning: mutex.lock().unwrap_or_else(|e| e.into_inner())

@brson
Copy link
Contributor Author

brson commented Jul 28, 2016

Would be worthwhile to survey existing code bases to see how common it is to ignore poisoning.

@sfackler
Copy link
Member

I made a wrapper crate over the standard library types to do this: https://crates.io/crates/antidote

I have needed to poison a data structure exactly once in my career (Rust and not-Rust).

@alexcrichton
Copy link
Member

The libs team discussed this yesterday and the conclusion was that a change like this would require an RFC, so as a result we're going to close this in favor of a future incarnation in the rust-lang/rfcs repo.

@Ericson2314
Copy link
Contributor

Relatedly, I'd like PoisonError to turn into an empty type with panic=abort.

@glaebhoerl
Copy link
Contributor

@Ericson2314 Wouldn't that break source compatibility? (Am I right to assume that panic=abort is not supposed to?)

@Ericson2314
Copy link
Contributor

Ericson2314 commented Sep 2, 2016

@glaebhoerl sorry this would be a scenario thing where one can be portable/parametric wrt panic strategy, or rely on one and not work with the other.

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. T-libs-api Relevant to the library API team, which will review and decide on the PR/issue.
Projects
None yet
Development

No branches or pull requests

5 participants