Skip to content

Commit 53056bd

Browse files
committed
Use insert_same in insert_evaluation_cache
1 parent da897df commit 53056bd

File tree

2 files changed

+3
-6
lines changed
  • compiler
    • rustc_data_structures/src
    • rustc_trait_selection/src/traits/select

2 files changed

+3
-6
lines changed

compiler/rustc_data_structures/src/sync.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -423,8 +423,8 @@ pub fn assert_send_val<T: ?Sized + Send>(_t: &T) {}
423423
pub fn assert_send_sync_val<T: ?Sized + Sync + Send>(_t: &T) {}
424424

425425
pub trait HashMapExt<K, V> {
426-
/// Same as HashMap::insert, but it may panic if there's already an
427-
/// entry for `key` with a value not equal to `value`
426+
/// Same as [HashMap::insert], but it may panic if there's already an
427+
/// entry for `key` with a value not equal to `value`.
428428
fn insert_same(&mut self, key: K, value: V);
429429
}
430430

compiler/rustc_trait_selection/src/traits/select/mod.rs

+1-4
Original file line numberDiff line numberDiff line change
@@ -906,10 +906,7 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
906906
trait_ref, result,
907907
);
908908
// This may overwrite the cache with the same value
909-
// FIXME: Due to #50507 this overwrites the different values
910-
// This should be changed to use HashMapExt::insert_same
911-
// when that is fixed
912-
self.tcx().evaluation_cache.insert(param_env.and(trait_ref), dep_node, result);
909+
self.tcx().evaluation_cache.insert_same(param_env.and(trait_ref), dep_node, result);
913910
return;
914911
}
915912
}

0 commit comments

Comments
 (0)