Skip to content

Commit

Permalink
Remove RefCell::borrow_state
Browse files Browse the repository at this point in the history
[unstable, deprecated since 1.15.0]
  • Loading branch information
cuviper committed Apr 21, 2017
1 parent cc605c8 commit 313aab8
Show file tree
Hide file tree
Showing 4 changed files with 0 additions and 55 deletions.
1 change: 0 additions & 1 deletion src/doc/unstable-book/src/SUMMARY.md
Expand Up @@ -103,7 +103,6 @@
- [as_c_str](library-features/as-c-str.md)
- [ascii_ctype](library-features/ascii-ctype.md)
- [binary_heap_peek_mut_pop](library-features/binary-heap-peek-mut-pop.md)
- [borrow_state](library-features/borrow-state.md)
- [box_heap](library-features/box-heap.md)
- [c_void_variant](library-features/c-void-variant.md)
- [char_escape_debug](library-features/char-escape-debug.md)
Expand Down
7 changes: 0 additions & 7 deletions src/doc/unstable-book/src/library-features/borrow-state.md

This file was deleted.

46 changes: 0 additions & 46 deletions src/libcore/cell.rs
Expand Up @@ -460,20 +460,6 @@ pub struct RefCell<T: ?Sized> {
value: UnsafeCell<T>,
}

/// An enumeration of values returned from the `state` method on a `RefCell<T>`.
#[derive(Copy, Clone, PartialEq, Eq, Debug)]
#[unstable(feature = "borrow_state", issue = "27733")]
#[rustc_deprecated(since = "1.15.0", reason = "use `try_borrow` instead")]
#[allow(deprecated)]
pub enum BorrowState {
/// The cell is currently being read, there is at least one active `borrow`.
Reading,
/// The cell is currently being written to, there is an active `borrow_mut`.
Writing,
/// There are no outstanding borrows on this cell.
Unused,
}

/// An error returned by [`RefCell::try_borrow`](struct.RefCell.html#method.try_borrow).
#[stable(feature = "try_borrow", since = "1.13.0")]
pub struct BorrowError {
Expand Down Expand Up @@ -562,38 +548,6 @@ impl<T> RefCell<T> {
}

impl<T: ?Sized> RefCell<T> {
/// Query the current state of this `RefCell`
///
/// The returned value can be dispatched on to determine if a call to
/// `borrow` or `borrow_mut` would succeed.
///
/// # Examples
///
/// ```
/// #![feature(borrow_state)]
///
/// use std::cell::{BorrowState, RefCell};
///
/// let c = RefCell::new(5);
///
/// match c.borrow_state() {
/// BorrowState::Writing => println!("Cannot be borrowed"),
/// BorrowState::Reading => println!("Cannot be borrowed mutably"),
/// BorrowState::Unused => println!("Can be borrowed (mutably as well)"),
/// }
/// ```
#[unstable(feature = "borrow_state", issue = "27733")]
#[rustc_deprecated(since = "1.15.0", reason = "use `try_borrow` instead")]
#[allow(deprecated)]
#[inline]
pub fn borrow_state(&self) -> BorrowState {
match self.borrow.get() {
WRITING => BorrowState::Writing,
UNUSED => BorrowState::Unused,
_ => BorrowState::Reading,
}
}

/// Immutably borrows the wrapped value.
///
/// The borrow lasts until the returned `Ref` exits scope. Multiple
Expand Down
1 change: 0 additions & 1 deletion src/libstd/lib.rs
Expand Up @@ -248,7 +248,6 @@
#![feature(allow_internal_unstable)]
#![feature(asm)]
#![feature(associated_consts)]
#![feature(borrow_state)]
#![feature(box_syntax)]
#![feature(cfg_target_has_atomic)]
#![feature(cfg_target_thread_local)]
Expand Down

0 comments on commit 313aab8

Please sign in to comment.