@@ -355,6 +355,17 @@ pub mod linear {
355355 }
356356 }
357357
358+ /// Return a mutable reference to the value corresponding to the key
359+ fn find_mut(&mut self, k: &K) -> Option<&'self mut V> {
360+ let idx = match self.bucket_for_key(k) {
361+ FoundEntry(idx) => idx,
362+ TableFull | FoundHole(_) => return None
363+ };
364+ unsafe { // FIXME(#4903)---requires flow-sensitive borrow checker
365+ Some(::cast::transmute_mut_region(self.mut_value_for_bucket(idx)))
366+ }
367+ }
368+
358369 /// Insert a key-value pair into the map. An existing value for a
359370 /// key is replaced by the new value. Return true if the key did
360371 /// not already exist in the map.
@@ -419,17 +430,6 @@ pub mod linear {
419430 old_value
420431 }
421432
422- /// Return a mutable reference to the value corresponding to the key
423- fn find_mut(&mut self, k: &K) -> Option<&'self mut V> {
424- let idx = match self.bucket_for_key(k) {
425- FoundEntry(idx) => idx,
426- TableFull | FoundHole(_) => return None
427- };
428- unsafe { // FIXME(#4903)---requires flow-sensitive borrow checker
429- Some(::cast::transmute_mut_region(self.mut_value_for_bucket(idx)))
430- }
431- }
432-
433433 /// Return the value corresponding to the key in the map, or insert
434434 /// and return the value if it doesn't exist.
435435 fn find_or_insert(&mut self, k: K, v: V) -> &'self V {
0 commit comments