@@ -315,7 +315,7 @@ impl<'a, K: Ord, V> VacantEntry<'a, K, V> {
315
315
pub fn insert ( self , value : V ) -> & ' a mut V {
316
316
let out_ptr = match self . handle {
317
317
None => {
318
- // SAFETY: We have consumed self.handle and the reference returned .
318
+ // SAFETY: There is no tree yet so no reference to it exists .
319
319
let map = unsafe { self . dormant_map . awaken ( ) } ;
320
320
let mut root = NodeRef :: new_leaf ( ) ;
321
321
let val_ptr = root. borrow_mut ( ) . push ( self . key , value) as * mut V ;
@@ -325,16 +325,17 @@ impl<'a, K: Ord, V> VacantEntry<'a, K, V> {
325
325
}
326
326
Some ( handle) => match handle. insert_recursing ( self . key , value) {
327
327
( None , val_ptr) => {
328
- // SAFETY: We have consumed self.handle and the handle returned .
328
+ // SAFETY: We have consumed self.handle.
329
329
let map = unsafe { self . dormant_map . awaken ( ) } ;
330
330
map. length += 1 ;
331
331
val_ptr
332
332
}
333
333
( Some ( ins) , val_ptr) => {
334
334
drop ( ins. left ) ;
335
- // SAFETY: We have consumed self.handle and the reference returned.
335
+ // SAFETY: We have consumed self.handle and dropped the
336
+ // remaining reference to the tree, ins.left.
336
337
let map = unsafe { self . dormant_map . awaken ( ) } ;
337
- let root = map. root . as_mut ( ) . unwrap ( ) ;
338
+ let root = map. root . as_mut ( ) . unwrap ( ) ; // same as ins.left
338
339
root. push_internal_level ( ) . push ( ins. kv . 0 , ins. kv . 1 , ins. right ) ;
339
340
map. length += 1 ;
340
341
val_ptr
0 commit comments