Skip to content

Commit

Permalink
Remove Rc::would_wrap
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 df86cec commit f4aaae9
Show file tree
Hide file tree
Showing 3 changed files with 0 additions and 19 deletions.
1 change: 0 additions & 1 deletion src/doc/unstable-book/src/SUMMARY.md
Expand Up @@ -185,7 +185,6 @@
- [rand](library-features/rand.md)
- [range_contains](library-features/range-contains.md)
- [raw](library-features/raw.md)
- [rc_would_unwrap](library-features/rc-would-unwrap.md)
- [retain_hash_collection](library-features/retain-hash-collection.md)
- [reverse_cmp_key](library-features/reverse-cmp-key.md)
- [rt](library-features/rt.md)
Expand Down
5 changes: 0 additions & 5 deletions src/doc/unstable-book/src/library-features/rc-would-unwrap.md

This file was deleted.

13 changes: 0 additions & 13 deletions src/liballoc/rc.rs
Expand Up @@ -341,19 +341,6 @@ impl<T> Rc<T> {
}
}

/// Checks whether [`Rc::try_unwrap`][try_unwrap] would return
/// [`Ok`].
///
/// [try_unwrap]: struct.Rc.html#method.try_unwrap
/// [`Ok`]: ../../std/result/enum.Result.html#variant.Ok
#[unstable(feature = "rc_would_unwrap",
reason = "just added for niche usecase",
issue = "28356")]
#[rustc_deprecated(since = "1.15.0", reason = "too niche; use `strong_count` instead")]
pub fn would_unwrap(this: &Self) -> bool {
Rc::strong_count(&this) == 1
}

/// Consumes the `Rc`, returning the wrapped pointer.
///
/// To avoid a memory leak the pointer must be converted back to an `Rc` using
Expand Down

0 comments on commit f4aaae9

Please sign in to comment.