Skip to content

Commit

Permalink
Stabilize RefCell::try_borrow_unguarded
Browse files Browse the repository at this point in the history
Servo has been using this since servo/servo#23196 to add a runtime check to some unsafe code, as discussed in PR #59211. Stabilizing would help do more of the same in libraries that also have users on Stable.
  • Loading branch information
SimonSapin committed May 15, 2019
1 parent c84a7ab commit 9fd4d48
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 9 deletions.
7 changes: 0 additions & 7 deletions src/doc/unstable-book/src/library-features/borrow-state.md

This file was deleted.

3 changes: 1 addition & 2 deletions src/libcore/cell.rs
Expand Up @@ -969,7 +969,6 @@ impl<T: ?Sized> RefCell<T> {
/// # Examples
///
/// ```
/// #![feature(borrow_state)]
/// use std::cell::RefCell;
///
/// let c = RefCell::new(5);
Expand All @@ -984,7 +983,7 @@ impl<T: ?Sized> RefCell<T> {
/// assert!(unsafe { c.try_borrow_unguarded() }.is_ok());
/// }
/// ```
#[unstable(feature = "borrow_state", issue = "27733")]
#[stable(feature = "borrow_state", since = "1.37.0")]
#[inline]
pub unsafe fn try_borrow_unguarded(&self) -> Result<&T, BorrowError> {
if !is_writing(self.borrow.get()) {
Expand Down

0 comments on commit 9fd4d48

Please sign in to comment.