about summary refs log tree commit diff
path: root/library/alloc/src
diff options
context:
space:
mode:
authorStein Somers <git@steinsomers.be>2020-07-23 20:15:47 +0200
committerStein Somers <git@steinsomers.be>2020-09-10 00:25:59 +0200
commitf42dac0ce04e372d413dcc374f2e0cf1e40dff6a (patch)
treed1cd144e8478bf07f36f5a2e56026619e077d4f2 /library/alloc/src
parentd92155bf6ae0b7d79fc83cbeeb0cc0c765353471 (diff)
downloadrust-f42dac0ce04e372d413dcc374f2e0cf1e40dff6a.tar.gz
rust-f42dac0ce04e372d413dcc374f2e0cf1e40dff6a.zip
Document btree's unwrap_unchecked
Diffstat (limited to 'library/alloc/src')
-rw-r--r--library/alloc/src/collections/btree/mod.rs3
1 files changed, 3 insertions, 0 deletions
diff --git a/library/alloc/src/collections/btree/mod.rs b/library/alloc/src/collections/btree/mod.rs
index 6c8a588eb58..1a836f11499 100644
--- a/library/alloc/src/collections/btree/mod.rs
+++ b/library/alloc/src/collections/btree/mod.rs
@@ -13,6 +13,9 @@ trait Recover<Q: ?Sized> {
     fn replace(&mut self, key: Self::Key) -> Option<Self::Key>;
 }
 
+/// Same purpose as `Option::unwrap` but doesn't always guarantee a panic
+/// if the option contains no value.
+/// SAFETY: the caller must ensure that the option contains a value.
 #[inline(always)]
 pub unsafe fn unwrap_unchecked<T>(val: Option<T>) -> T {
     val.unwrap_or_else(|| {