@@ -833,17 +833,11 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
833833 ) -> Option < EvaluationResult > {
834834 let tcx = self . tcx ( ) ;
835835 if self . can_use_global_caches ( param_env) {
836- let cache = tcx. evaluation_cache . hashmap . borrow ( ) ;
837- if let Some ( cached) = cache. get ( & param_env. and ( trait_ref) ) {
838- return Some ( cached. get ( tcx) ) ;
836+ if let Some ( res) = tcx. evaluation_cache . get ( & param_env. and ( trait_ref) , tcx) {
837+ return Some ( res) ;
839838 }
840839 }
841- self . infcx
842- . evaluation_cache
843- . hashmap
844- . borrow ( )
845- . get ( & param_env. and ( trait_ref) )
846- . map ( |v| v. get ( tcx) )
840+ self . infcx . evaluation_cache . get ( & param_env. and ( trait_ref) , tcx)
847841 }
848842
849843 fn insert_evaluation_cache (
@@ -869,21 +863,13 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
869863 // FIXME: Due to #50507 this overwrites the different values
870864 // This should be changed to use HashMapExt::insert_same
871865 // when that is fixed
872- self . tcx ( )
873- . evaluation_cache
874- . hashmap
875- . borrow_mut ( )
876- . insert ( param_env. and ( trait_ref) , WithDepNode :: new ( dep_node, result) ) ;
866+ self . tcx ( ) . evaluation_cache . insert ( param_env. and ( trait_ref) , dep_node, result) ;
877867 return ;
878868 }
879869 }
880870
881871 debug ! ( "insert_evaluation_cache(trait_ref={:?}, candidate={:?})" , trait_ref, result, ) ;
882- self . infcx
883- . evaluation_cache
884- . hashmap
885- . borrow_mut ( )
886- . insert ( param_env. and ( trait_ref) , WithDepNode :: new ( dep_node, result) ) ;
872+ self . infcx . evaluation_cache . insert ( param_env. and ( trait_ref) , dep_node, result) ;
887873 }
888874
889875 /// For various reasons, it's possible for a subobligation
@@ -1180,17 +1166,11 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
11801166 let tcx = self . tcx ( ) ;
11811167 let trait_ref = & cache_fresh_trait_pred. skip_binder ( ) . trait_ref ;
11821168 if self . can_use_global_caches ( param_env) {
1183- let cache = tcx. selection_cache . hashmap . borrow ( ) ;
1184- if let Some ( cached) = cache. get ( & param_env. and ( * trait_ref) ) {
1185- return Some ( cached. get ( tcx) ) ;
1169+ if let Some ( res) = tcx. selection_cache . get ( & param_env. and ( * trait_ref) , tcx) {
1170+ return Some ( res) ;
11861171 }
11871172 }
1188- self . infcx
1189- . selection_cache
1190- . hashmap
1191- . borrow ( )
1192- . get ( & param_env. and ( * trait_ref) )
1193- . map ( |v| v. get ( tcx) )
1173+ self . infcx . selection_cache . get ( & param_env. and ( * trait_ref) , tcx)
11941174 }
11951175
11961176 /// Determines whether can we safely cache the result
@@ -1248,10 +1228,7 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
12481228 trait_ref, candidate,
12491229 ) ;
12501230 // This may overwrite the cache with the same value.
1251- tcx. selection_cache
1252- . hashmap
1253- . borrow_mut ( )
1254- . insert ( param_env. and ( trait_ref) , WithDepNode :: new ( dep_node, candidate) ) ;
1231+ tcx. selection_cache . insert ( param_env. and ( trait_ref) , dep_node, candidate) ;
12551232 return ;
12561233 }
12571234 }
@@ -1261,11 +1238,7 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
12611238 "insert_candidate_cache(trait_ref={:?}, candidate={:?}) local" ,
12621239 trait_ref, candidate,
12631240 ) ;
1264- self . infcx
1265- . selection_cache
1266- . hashmap
1267- . borrow_mut ( )
1268- . insert ( param_env. and ( trait_ref) , WithDepNode :: new ( dep_node, candidate) ) ;
1241+ self . infcx . selection_cache . insert ( param_env. and ( trait_ref) , dep_node, candidate) ;
12691242 }
12701243
12711244 fn match_projection_obligation_against_definition_bounds (
0 commit comments