@@ -833,17 +833,11 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
833
833
) -> Option < EvaluationResult > {
834
834
let tcx = self . tcx ( ) ;
835
835
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) ;
839
838
}
840
839
}
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)
847
841
}
848
842
849
843
fn insert_evaluation_cache (
@@ -869,21 +863,13 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
869
863
// FIXME: Due to #50507 this overwrites the different values
870
864
// This should be changed to use HashMapExt::insert_same
871
865
// 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) ;
877
867
return ;
878
868
}
879
869
}
880
870
881
871
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) ;
887
873
}
888
874
889
875
/// For various reasons, it's possible for a subobligation
@@ -1180,17 +1166,11 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
1180
1166
let tcx = self . tcx ( ) ;
1181
1167
let trait_ref = & cache_fresh_trait_pred. skip_binder ( ) . trait_ref ;
1182
1168
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) ;
1186
1171
}
1187
1172
}
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)
1194
1174
}
1195
1175
1196
1176
/// Determines whether can we safely cache the result
@@ -1248,10 +1228,7 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
1248
1228
trait_ref, candidate,
1249
1229
) ;
1250
1230
// 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) ;
1255
1232
return ;
1256
1233
}
1257
1234
}
@@ -1261,11 +1238,7 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
1261
1238
"insert_candidate_cache(trait_ref={:?}, candidate={:?}) local" ,
1262
1239
trait_ref, candidate,
1263
1240
) ;
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) ;
1269
1242
}
1270
1243
1271
1244
fn match_projection_obligation_against_definition_bounds (
0 commit comments