]> git.lizzy.rs Git - rust.git/commitdiff
Stabilize entry-or-default
authorGuillaume Gomez <guillaume1.gomez@gmail.com>
Sat, 26 May 2018 09:11:17 +0000 (11:11 +0200)
committerGuillaume Gomez <guillaume1.gomez@gmail.com>
Sun, 10 Jun 2018 10:59:12 +0000 (12:59 +0200)
src/doc/unstable-book/src/library-features/entry-or-default.md [deleted file]
src/liballoc/btree/map.rs
src/librustc/lib.rs
src/libstd/collections/hash/map.rs

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 (file)
index f8c8a2a..0000000
+++ /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.
index 9b6f91c039feaa471360c47a83fa452d2cd95694..e6e454446e232de826fe5a77a4837d4d5a2679e1 100644 (file)
@@ -2184,14 +2184,13 @@ pub fn and_modify<F>(self, f: F) -> Self
 }
 
 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;
     ///
index a006856f58b7dac16624f573b1b253a06b9380cf..102efe2bef3f750077e02e4fa67be742bdccf89d 100644 (file)
@@ -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)]
index 5cbd8891364dd0f0d15c73d2a7df085fceed21c5..9c77acb83ecb1c27904752d826339857fd8d3ee7 100644 (file)
@@ -2161,14 +2161,13 @@ pub fn and_modify<F>(self, f: F) -> Self
 }
 
 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 @@ pub fn or_default(self) -> &'a mut V {
             Vacant(entry) => entry.insert(Default::default()),
         }
     }
-
 }
 
 impl<'a, K, V> OccupiedEntry<'a, K, V> {