]> git.lizzy.rs Git - rust.git/commitdiff
Remove RefCell::borrow_state
authorJosh Stone <jistone@redhat.com>
Thu, 20 Apr 2017 21:10:22 +0000 (14:10 -0700)
committerJosh Stone <jistone@redhat.com>
Fri, 21 Apr 2017 04:16:31 +0000 (21:16 -0700)
[unstable, deprecated since 1.15.0]

src/doc/unstable-book/src/SUMMARY.md
src/doc/unstable-book/src/library-features/borrow-state.md [deleted file]
src/libcore/cell.rs
src/libstd/lib.rs

index 2a932e342f6a702966d1c66ebaa0e0b8b54ec96b..ae3b23a33b24ee09f99b0279a2086af71d0f2d53 100644 (file)
     - [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)
diff --git a/src/doc/unstable-book/src/library-features/borrow-state.md b/src/doc/unstable-book/src/library-features/borrow-state.md
deleted file mode 100644 (file)
index 304b8df..0000000
+++ /dev/null
@@ -1,7 +0,0 @@
-# `borrow_state`
-
-The tracking issue for this feature is: [#27733]
-
-[#27733]: https://github.com/rust-lang/rust/issues/27733
-
-------------------------
index a5dda5625bd3a8c5c6a7eeffafe0dc7e4cc2e395..ba04cbb0543cd6de56de80d2412cda33e8525bfc 100644 (file)
@@ -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 @@ pub fn into_inner(self) -> 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
index 367779bb701c858f95f29fc28d39c510962f33e6..6c3abf99d11fa4644662c9ffe20932908bc7ab35 100644 (file)
 #![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)]