Skip to content
Permalink
Browse files

Stabilize RefCell::try_borrow_unguarded

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 9fd4d48b5e12494926041bb1a053d5891e661bc4
Showing with 1 addition and 9 deletions.
  1. +0 −7 src/doc/unstable-book/src/library-features/borrow-state.md
  2. +1 −2 src/libcore/cell.rs

This file was deleted.

@@ -969,7 +969,6 @@ impl<T: ?Sized> RefCell<T> {
/// # Examples
///
/// ```
/// #![feature(borrow_state)]
/// use std::cell::RefCell;
///
/// let c = RefCell::new(5);
@@ -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()) {

0 comments on commit 9fd4d48

Please sign in to comment.
You can’t perform that action at this time.