std: Deprecate RefCell::{try_borrow, try_borrow_mut}#21854
std: Deprecate RefCell::{try_borrow, try_borrow_mut}#21854bors merged 1 commit intorust-lang:masterfrom
Conversation
The existence of these two functions is at odds with our current [error conventions][conventions] which recommend that panicking and `Result`-like variants should not be provided together. [conventions]: https://github.com/rust-lang/rfcs/blob/master/text/0236-error-conventions.md#do-not-provide-both-result-and-fail-variants This commit adds a new `borrow_state` function returning a `BorrowState` enum to `RefCell` which serves as a replacemnt for the `try_borrow` and `try_borrow_mut` functions.
|
r? @aturon (rust_highfive has picked a reviewer for you, use r? to override) |
|
@bors: r+ deed093 |
The existence of these two functions is at odds with our current [error conventions][conventions] which recommend that panicking and `Result`-like variants should not be provided together. [conventions]: https://github.com/rust-lang/rfcs/blob/master/text/0236-error-conventions.md#do-not-provide-both-result-and-fail-variants This commit adds a new `borrow_state` function returning a `BorrowState` enum to `RefCell` which serves as a replacemnt for the `try_borrow` and `try_borrow_mut` functions.
|
This makes it a lot more unergonic to use and is not mentioned in the linked-to RFC. In the RFC it says that |
|
@tbu- we've been backpedaling on there being any exceptions to the rule by moving channel methods entirely to |
|
I'm sad, it makes RefCell even more cumbersome to use, and it's for example harder to provide a custom panic message. I'd opt for just using This is not like channel because there is no option- or result-returning method left. |
…rgan internal: Remove clone_for_update from apply_demorgan
The existence of these two functions is at odds with our current error
conventions which recommend that panicking and
Result-likevariants should not be provided together.
This commit adds a new
borrow_statefunction returning aBorrowStateenum toRefCellwhich serves as a replacemnt for thetry_borrowandtry_borrow_mutfunctions.