@@ -116,15 +116,16 @@ impl<'a, K: Ord, V> Entry<'a, K, V> {
116116 }
117117 }
118118
119- #[ unstable( feature = "or_insert_with_key" , issue = "71024" ) ]
120- /// Ensures a value is in the entry by inserting, if empty, the result of the default function,
121- /// which takes the key as its argument, and returns a mutable reference to the value in the
122- /// entry.
119+ /// Ensures a value is in the entry by inserting, if empty, the result of the default function.
120+ /// This method allows for generating key-derived values for insertion by providing the default
121+ /// function a reference to the key that was moved during the `.entry(key)` method call.
122+ ///
123+ /// The reference to the moved key is provided so that cloning or copying the key is
124+ /// unnecessary, unlike with `.or_insert_with(|| ... )`.
123125 ///
124126 /// # Examples
125127 ///
126128 /// ```
127- /// #![feature(or_insert_with_key)]
128129 /// use std::collections::BTreeMap;
129130 ///
130131 /// let mut map: BTreeMap<&str, usize> = BTreeMap::new();
@@ -134,6 +135,7 @@ impl<'a, K: Ord, V> Entry<'a, K, V> {
134135 /// assert_eq!(map["poneyland"], 9);
135136 /// ```
136137 #[ inline]
138+ #[ stable( feature = "or_insert_with_key" , since = "1.50.0" ) ]
137139 pub fn or_insert_with_key < F : FnOnce ( & K ) -> V > ( self , default : F ) -> & ' a mut V {
138140 match self {
139141 Occupied ( entry) => entry. into_mut ( ) ,
0 commit comments