@@ -2235,35 +2235,40 @@ impl<'o, 'tcx> dyn AstConv<'tcx> + 'o {
2235
2235
let mut applicable_candidates: Vec < _ > = candidates
2236
2236
. iter ( )
2237
2237
. filter_map ( |& ( impl_, ( assoc_item, def_scope) ) | {
2238
- let ocx = ObligationCtxt :: new ( & infcx) ;
2238
+ infcx. probe ( |_| {
2239
+ let ocx = ObligationCtxt :: new_in_snapshot ( & infcx) ;
2239
2240
2240
- let impl_ty = tcx. type_of ( impl_) ;
2241
- let impl_substs = self . fresh_item_substs ( impl_, & infcx) ;
2242
- let impl_ty = impl_ty. subst ( tcx, impl_substs) ;
2243
- let impl_ty = ocx. normalize ( & cause, param_env, impl_ty) ;
2241
+ let impl_ty = tcx. type_of ( impl_) ;
2242
+ let impl_substs = self . fresh_item_substs ( impl_, & infcx) ;
2243
+ let impl_ty = impl_ty. subst ( tcx, impl_substs) ;
2244
+ let impl_ty = ocx. normalize ( & cause, param_env, impl_ty) ;
2244
2245
2245
- // Check that the Self-types can be related.
2246
- // FIXME(fmease): Should we use `eq` here?
2247
- ocx. sup ( & ObligationCause :: dummy ( ) , param_env, impl_ty, self_ty) . ok ( ) ?;
2246
+ // Check that the Self-types can be related.
2247
+ // FIXME(fmease): Should we use `eq` here?
2248
+ ocx. sup ( & ObligationCause :: dummy ( ) , param_env, impl_ty, self_ty) . ok ( ) ?;
2248
2249
2249
- // Check whether the impl imposes obligations we have to worry about.
2250
- let impl_bounds = tcx. predicates_of ( impl_) ;
2251
- let impl_bounds = impl_bounds. instantiate ( tcx, impl_substs) ;
2250
+ // Check whether the impl imposes obligations we have to worry about.
2251
+ let impl_bounds = tcx. predicates_of ( impl_) ;
2252
+ let impl_bounds = impl_bounds. instantiate ( tcx, impl_substs) ;
2252
2253
2253
- let impl_bounds = ocx. normalize ( & cause, param_env, impl_bounds) ;
2254
+ let impl_bounds = ocx. normalize ( & cause, param_env, impl_bounds) ;
2254
2255
2255
- let impl_obligations =
2256
- traits:: predicates_for_generics ( |_, _| cause. clone ( ) , param_env, impl_bounds) ;
2256
+ let impl_obligations = traits:: predicates_for_generics (
2257
+ |_, _| cause. clone ( ) ,
2258
+ param_env,
2259
+ impl_bounds,
2260
+ ) ;
2257
2261
2258
- ocx. register_obligations ( impl_obligations) ;
2262
+ ocx. register_obligations ( impl_obligations) ;
2259
2263
2260
- let errors = ocx. select_where_possible ( ) ;
2261
- if !errors. is_empty ( ) {
2262
- fulfillment_errors = errors;
2263
- return None ;
2264
- }
2264
+ let errors = ocx. select_where_possible ( ) ;
2265
+ if !errors. is_empty ( ) {
2266
+ fulfillment_errors = errors;
2267
+ return None ;
2268
+ }
2265
2269
2266
- Some ( ( assoc_item, def_scope) )
2270
+ Some ( ( assoc_item, def_scope) )
2271
+ } )
2267
2272
} )
2268
2273
. collect ( ) ;
2269
2274
0 commit comments