diff options
| author | Josh Stone <jistone@redhat.com> | 2017-04-20 14:10:22 -0700 |
|---|---|---|
| committer | Josh Stone <jistone@redhat.com> | 2017-04-20 21:16:31 -0700 |
| commit | 313aab8fbeb98730f8ffa741ccf54f843d5e3525 (patch) | |
| tree | 7adac9021fca20cf1a495cf83da057c8adbf97da /src/libcore | |
| parent | cc605c895e3ac3d19b70da58a683a65200c491fe (diff) | |
Remove RefCell::borrow_state
[unstable, deprecated since 1.15.0]
Diffstat (limited to 'src/libcore')
| -rw-r--r-- | src/libcore/cell.rs | 46 |
1 files changed, 0 insertions, 46 deletions
diff --git a/src/libcore/cell.rs b/src/libcore/cell.rs index a5dda5625bd..ba04cbb0543 100644 --- a/src/libcore/cell.rs +++ b/src/libcore/cell.rs @@ -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 { @@ -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 |
