@@ -1889,14 +1889,24 @@ impl<K: Debug, V> Debug for VacantEntry<'_, K, V> {
1889
1889
///
1890
1890
/// Contains the occupied entry, and the value that was not inserted.
1891
1891
#[ unstable( feature = "map_try_insert" , issue = "none" ) ]
1892
- #[ derive( Debug ) ]
1893
1892
pub struct OccupiedError < ' a , K : ' a , V : ' a > {
1894
1893
/// The entry in the map that was already occupied.
1895
1894
pub entry : OccupiedEntry < ' a , K , V > ,
1896
1895
/// The value which was not inserted, because the entry was already occupied.
1897
1896
pub value : V ,
1898
1897
}
1899
1898
1899
+ #[ unstable( feature = "map_try_insert" , issue = "none" ) ]
1900
+ impl < K : Debug , V : Debug > Debug for OccupiedError < ' _ , K , V > {
1901
+ fn fmt ( & self , f : & mut fmt:: Formatter < ' _ > ) -> fmt:: Result {
1902
+ f. debug_struct ( "OccupiedError" )
1903
+ . field ( "key" , self . entry . key ( ) )
1904
+ . field ( "old_value" , self . entry . get ( ) )
1905
+ . field ( "new_value" , & self . value )
1906
+ . finish ( )
1907
+ }
1908
+ }
1909
+
1900
1910
#[ stable( feature = "rust1" , since = "1.0.0" ) ]
1901
1911
impl < ' a , K , V , S > IntoIterator for & ' a HashMap < K , V , S > {
1902
1912
type Item = ( & ' a K , & ' a V ) ;
0 commit comments