about summary refs log tree commit diff
path: root/src/liballoc
diff options
context:
space:
mode:
authorkennytm <kennytm@gmail.com>2018-01-30 17:10:58 +0800
committerGitHub <noreply@github.com>2018-01-30 17:10:58 +0800
commit95572df8ebe7d7ae8b2e46e8b62b8f41bc1ee9a1 (patch)
tree2cf40206058b1fd2af639154aad2c27f5120b6d1 /src/liballoc
parente8868bdc5613de10f83247094be8bbd84a053773 (diff)
parent7b4cbbd12d88c8e64d9c7aa1e326c7c78f2a7ed9 (diff)
downloadrust-95572df8ebe7d7ae8b2e46e8b62b8f41bc1ee9a1.tar.gz
rust-95572df8ebe7d7ae8b2e46e8b62b8f41bc1ee9a1.zip
Rollup merge of #47839 - frewsxcv:frewsxcv-map-index, r=QuietMisdreavus
Document that `Index` ops can panic on `HashMap` & `BTreeMap`.

Fixes https://github.com/rust-lang/rust/issues/47011.
Diffstat (limited to 'src/liballoc')
-rw-r--r--src/liballoc/btree/map.rs5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/liballoc/btree/map.rs b/src/liballoc/btree/map.rs
index b114dc640fb..b320bed5432 100644
--- a/src/liballoc/btree/map.rs
+++ b/src/liballoc/btree/map.rs
@@ -1748,6 +1748,11 @@ impl<'a, K: Ord, Q: ?Sized, V> Index<&'a Q> for BTreeMap<K, V>
 {
     type Output = V;
 
+    /// Returns a reference to the value corresponding to the supplied key.
+    ///
+    /// # Panics
+    ///
+    /// Panics if the key is not present in the `BTreeMap`.
     #[inline]
     fn index(&self, key: &Q) -> &V {
         self.get(key).expect("no entry found for key")