about summary refs log tree commit diff
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2018-06-10 12:46:14 +0000
committerbors <bors@rust-lang.org>2018-06-10 12:46:14 +0000
commit900037e3c35d822a0487f74d2866433a7ca2f19c (patch)
tree9a454d89228f81d60213bf64001c53242bf1e3de
parent684b8d3d7b5eb42c00cba7e14342c5cb3b6f292b (diff)
parent861c7cb9fd37fc171f80a9f0b58f995ad67c6df0 (diff)
downloadrust-900037e3c35d822a0487f74d2866433a7ca2f19c.tar.gz
rust-900037e3c35d822a0487f74d2866433a7ca2f19c.zip
Auto merge of #51079 - GuillaumeGomez:stabilize-entry-or-default, r=SimonSapin
Stabilize entry-or-default

Fixes #44324.

cc @SimonSapin
-rw-r--r--src/doc/unstable-book/src/library-features/entry-or-default.md13
-rw-r--r--src/liballoc/btree/map.rs3
-rw-r--r--src/librustc/lib.rs1
-rw-r--r--src/libstd/collections/hash/map.rs4
4 files changed, 2 insertions, 19 deletions
diff --git a/src/doc/unstable-book/src/library-features/entry-or-default.md b/src/doc/unstable-book/src/library-features/entry-or-default.md
deleted file mode 100644
index f8c8a2a7a71..00000000000
--- a/src/doc/unstable-book/src/library-features/entry-or-default.md
+++ /dev/null
@@ -1,13 +0,0 @@
-# `entry_or_default`
-
-The tracking issue for this feature is: [#44324]
-
-[#44324]: https://github.com/rust-lang/rust/issues/44324
-
-------------------------
-
-The `entry_or_default` feature adds a new method to `hash_map::Entry`
-and `btree_map::Entry`, `or_default`, when `V: Default`. This method is
-semantically identical to `or_insert_with(Default::default)`, and will
-insert the default value for the type if no entry exists for the current
-key.
diff --git a/src/liballoc/btree/map.rs b/src/liballoc/btree/map.rs
index 9b6f91c039f..e6e454446e2 100644
--- a/src/liballoc/btree/map.rs
+++ b/src/liballoc/btree/map.rs
@@ -2184,14 +2184,13 @@ impl<'a, K: Ord, V> Entry<'a, K, V> {
 }
 
 impl<'a, K: Ord, V: Default> Entry<'a, K, V> {
-    #[unstable(feature = "entry_or_default", issue = "44324")]
+    #[stable(feature = "entry_or_default", since = "1.28.0")]
     /// Ensures a value is in the entry by inserting the default value if empty,
     /// and returns a mutable reference to the value in the entry.
     ///
     /// # Examples
     ///
     /// ```
-    /// #![feature(entry_or_default)]
     /// # fn main() {
     /// use std::collections::BTreeMap;
     ///
diff --git a/src/librustc/lib.rs b/src/librustc/lib.rs
index a006856f58b..102efe2bef3 100644
--- a/src/librustc/lib.rs
+++ b/src/librustc/lib.rs
@@ -45,7 +45,6 @@
 #![feature(const_fn)]
 #![feature(core_intrinsics)]
 #![feature(drain_filter)]
-#![feature(entry_or_default)]
 #![feature(from_ref)]
 #![feature(fs_read_write)]
 #![feature(iterator_find_map)]
diff --git a/src/libstd/collections/hash/map.rs b/src/libstd/collections/hash/map.rs
index 5cbd8891364..9c77acb83ec 100644
--- a/src/libstd/collections/hash/map.rs
+++ b/src/libstd/collections/hash/map.rs
@@ -2161,14 +2161,13 @@ impl<'a, K, V> Entry<'a, K, V> {
 }
 
 impl<'a, K, V: Default> Entry<'a, K, V> {
-    #[unstable(feature = "entry_or_default", issue = "44324")]
+    #[stable(feature = "entry_or_default", since = "1.28.0")]
     /// Ensures a value is in the entry by inserting the default value if empty,
     /// and returns a mutable reference to the value in the entry.
     ///
     /// # Examples
     ///
     /// ```
-    /// #![feature(entry_or_default)]
     /// # fn main() {
     /// use std::collections::HashMap;
     ///
@@ -2184,7 +2183,6 @@ impl<'a, K, V: Default> Entry<'a, K, V> {
             Vacant(entry) => entry.insert(Default::default()),
         }
     }
-
 }
 
 impl<'a, K, V> OccupiedEntry<'a, K, V> {