Skip to content

Commit 313aab8

Browse files
committed
Remove RefCell::borrow_state
[unstable, deprecated since 1.15.0]
1 parent cc605c8 commit 313aab8

File tree

4 files changed

+0
-55
lines changed

4 files changed

+0
-55
lines changed

src/doc/unstable-book/src/SUMMARY.md

-1
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,6 @@
103103
- [as_c_str](library-features/as-c-str.md)
104104
- [ascii_ctype](library-features/ascii-ctype.md)
105105
- [binary_heap_peek_mut_pop](library-features/binary-heap-peek-mut-pop.md)
106-
- [borrow_state](library-features/borrow-state.md)
107106
- [box_heap](library-features/box-heap.md)
108107
- [c_void_variant](library-features/c-void-variant.md)
109108
- [char_escape_debug](library-features/char-escape-debug.md)

src/doc/unstable-book/src/library-features/borrow-state.md

-7
This file was deleted.

src/libcore/cell.rs

-46
Original file line numberDiff line numberDiff line change
@@ -460,20 +460,6 @@ pub struct RefCell<T: ?Sized> {
460460
value: UnsafeCell<T>,
461461
}
462462

463-
/// An enumeration of values returned from the `state` method on a `RefCell<T>`.
464-
#[derive(Copy, Clone, PartialEq, Eq, Debug)]
465-
#[unstable(feature = "borrow_state", issue = "27733")]
466-
#[rustc_deprecated(since = "1.15.0", reason = "use `try_borrow` instead")]
467-
#[allow(deprecated)]
468-
pub enum BorrowState {
469-
/// The cell is currently being read, there is at least one active `borrow`.
470-
Reading,
471-
/// The cell is currently being written to, there is an active `borrow_mut`.
472-
Writing,
473-
/// There are no outstanding borrows on this cell.
474-
Unused,
475-
}
476-
477463
/// An error returned by [`RefCell::try_borrow`](struct.RefCell.html#method.try_borrow).
478464
#[stable(feature = "try_borrow", since = "1.13.0")]
479465
pub struct BorrowError {
@@ -562,38 +548,6 @@ impl<T> RefCell<T> {
562548
}
563549

564550
impl<T: ?Sized> RefCell<T> {
565-
/// Query the current state of this `RefCell`
566-
///
567-
/// The returned value can be dispatched on to determine if a call to
568-
/// `borrow` or `borrow_mut` would succeed.
569-
///
570-
/// # Examples
571-
///
572-
/// ```
573-
/// #![feature(borrow_state)]
574-
///
575-
/// use std::cell::{BorrowState, RefCell};
576-
///
577-
/// let c = RefCell::new(5);
578-
///
579-
/// match c.borrow_state() {
580-
/// BorrowState::Writing => println!("Cannot be borrowed"),
581-
/// BorrowState::Reading => println!("Cannot be borrowed mutably"),
582-
/// BorrowState::Unused => println!("Can be borrowed (mutably as well)"),
583-
/// }
584-
/// ```
585-
#[unstable(feature = "borrow_state", issue = "27733")]
586-
#[rustc_deprecated(since = "1.15.0", reason = "use `try_borrow` instead")]
587-
#[allow(deprecated)]
588-
#[inline]
589-
pub fn borrow_state(&self) -> BorrowState {
590-
match self.borrow.get() {
591-
WRITING => BorrowState::Writing,
592-
UNUSED => BorrowState::Unused,
593-
_ => BorrowState::Reading,
594-
}
595-
}
596-
597551
/// Immutably borrows the wrapped value.
598552
///
599553
/// The borrow lasts until the returned `Ref` exits scope. Multiple

src/libstd/lib.rs

-1
Original file line numberDiff line numberDiff line change
@@ -248,7 +248,6 @@
248248
#![feature(allow_internal_unstable)]
249249
#![feature(asm)]
250250
#![feature(associated_consts)]
251-
#![feature(borrow_state)]
252251
#![feature(box_syntax)]
253252
#![feature(cfg_target_has_atomic)]
254253
#![feature(cfg_target_thread_local)]

0 commit comments

Comments
 (0)