@@ -162,8 +162,8 @@ fn overlap_within_probe<'cx, 'tcx>(
162
162
let infcx = selcx. infcx ( ) ;
163
163
164
164
if overlap_mode. use_negative_impl ( ) {
165
- if negative_impl ( selcx , impl1_def_id, impl2_def_id)
166
- || negative_impl ( selcx , impl2_def_id, impl1_def_id)
165
+ if negative_impl ( infcx . tcx , impl1_def_id, impl2_def_id)
166
+ || negative_impl ( infcx . tcx , impl2_def_id, impl1_def_id)
167
167
{
168
168
return None ;
169
169
}
@@ -279,13 +279,8 @@ fn implicit_negative<'cx, 'tcx>(
279
279
280
280
/// Given impl1 and impl2 check if both impls are never satisfied by a common type (including
281
281
/// where-clauses) If so, return true, they are disjoint and false otherwise.
282
- fn negative_impl < ' cx , ' tcx > (
283
- selcx : & mut SelectionContext < ' cx , ' tcx > ,
284
- impl1_def_id : DefId ,
285
- impl2_def_id : DefId ,
286
- ) -> bool {
282
+ fn negative_impl < ' tcx > ( tcx : TyCtxt < ' tcx > , impl1_def_id : DefId , impl2_def_id : DefId ) -> bool {
287
283
debug ! ( "negative_impl(impl1_def_id={:?}, impl2_def_id={:?})" , impl1_def_id, impl2_def_id) ;
288
- let tcx = selcx. infcx ( ) . tcx ;
289
284
290
285
// Create an infcx, taking the predicates of impl1 as assumptions:
291
286
let infcx = tcx. infer_ctxt ( ) . build ( ) ;
@@ -332,11 +327,10 @@ fn equate<'tcx>(
332
327
return true ;
333
328
} ;
334
329
335
- let selcx = & mut SelectionContext :: new ( & infcx) ;
336
330
let opt_failing_obligation = obligations
337
331
. into_iter ( )
338
332
. chain ( more_obligations)
339
- . find ( |o| negative_impl_exists ( selcx , o, body_def_id) ) ;
333
+ . find ( |o| negative_impl_exists ( infcx , o, body_def_id) ) ;
340
334
341
335
if let Some ( failing_obligation) = opt_failing_obligation {
342
336
debug ! ( "overlap: obligation unsatisfiable {:?}" , failing_obligation) ;
@@ -347,19 +341,19 @@ fn equate<'tcx>(
347
341
}
348
342
349
343
/// Try to prove that a negative impl exist for the given obligation and its super predicates.
350
- #[ instrument( level = "debug" , skip( selcx ) ) ]
351
- fn negative_impl_exists < ' cx , ' tcx > (
352
- selcx : & SelectionContext < ' cx , ' tcx > ,
344
+ #[ instrument( level = "debug" , skip( infcx ) ) ]
345
+ fn negative_impl_exists < ' tcx > (
346
+ infcx : & InferCtxt < ' tcx > ,
353
347
o : & PredicateObligation < ' tcx > ,
354
348
body_def_id : DefId ,
355
349
) -> bool {
356
- if resolve_negative_obligation ( selcx . infcx ( ) . fork ( ) , o, body_def_id) {
350
+ if resolve_negative_obligation ( infcx. fork ( ) , o, body_def_id) {
357
351
return true ;
358
352
}
359
353
360
354
// Try to prove a negative obligation exists for super predicates
361
- for o in util:: elaborate_predicates ( selcx . tcx ( ) , iter:: once ( o. predicate ) ) {
362
- if resolve_negative_obligation ( selcx . infcx ( ) . fork ( ) , & o, body_def_id) {
355
+ for o in util:: elaborate_predicates ( infcx . tcx , iter:: once ( o. predicate ) ) {
356
+ if resolve_negative_obligation ( infcx. fork ( ) , & o, body_def_id) {
363
357
return true ;
364
358
}
365
359
}
0 commit comments