@@ -1889,14 +1889,24 @@ impl<K: Debug, V> Debug for VacantEntry<'_, K, V> {
18891889///
18901890/// Contains the occupied entry, and the value that was not inserted.
18911891#[ unstable( feature = "map_try_insert" , issue = "none" ) ]
1892- #[ derive( Debug ) ]
18931892pub struct OccupiedError < ' a , K : ' a , V : ' a > {
18941893 /// The entry in the map that was already occupied.
18951894 pub entry : OccupiedEntry < ' a , K , V > ,
18961895 /// The value which was not inserted, because the entry was already occupied.
18971896 pub value : V ,
18981897}
18991898
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+
19001910#[ stable( feature = "rust1" , since = "1.0.0" ) ]
19011911impl < ' a , K , V , S > IntoIterator for & ' a HashMap < K , V , S > {
19021912 type Item = ( & ' a K , & ' a V ) ;
0 commit comments