Skip to content

Commit

Permalink
Rollup merge of rust-lang#60850 - SimonSapin:unguarded, r=alexcrichton
Browse files Browse the repository at this point in the history
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 rust-lang#59211. Stabilizing would help do more of the same in libraries that also have users on Stable.
  • Loading branch information
Centril authored May 30, 2019
2 parents 1529ea6 + 9fd4d48 commit e707533
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
Original file line number Diff line number Diff line change
Expand Up @@ -967,7 +967,6 @@ impl<T: ?Sized> RefCell<T> {
/// # Examples
///
/// ```
/// #![feature(borrow_state)]
/// use std::cell::RefCell;
///
/// let c = RefCell::new(5);
Expand All @@ -982,7 +981,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 e707533

Please sign in to comment.