@@ -342,10 +342,8 @@ fn equate<'cx, 'tcx>(
342
342
} ;
343
343
344
344
let selcx = & mut SelectionContext :: new ( & infcx) ;
345
- let opt_failing_obligation = obligations
346
- . into_iter ( )
347
- . chain ( more_obligations)
348
- . find ( |o| negative_impl_exists ( selcx, impl_env, o) ) ;
345
+ let opt_failing_obligation =
346
+ obligations. into_iter ( ) . chain ( more_obligations) . find ( |o| negative_impl_exists ( selcx, o) ) ;
349
347
350
348
if let Some ( failing_obligation) = opt_failing_obligation {
351
349
debug ! ( "overlap: obligation unsatisfiable {:?}" , failing_obligation) ;
@@ -359,18 +357,15 @@ fn equate<'cx, 'tcx>(
359
357
#[ instrument( level = "debug" , skip( selcx) ) ]
360
358
fn negative_impl_exists < ' cx , ' tcx > (
361
359
selcx : & SelectionContext < ' cx , ' tcx > ,
362
- param_env : ty:: ParamEnv < ' tcx > ,
363
360
o : & PredicateObligation < ' tcx > ,
364
361
) -> bool {
365
- let infcx = & selcx. infcx ( ) . fork ( ) ;
366
-
367
- if resolve_negative_obligation ( infcx, param_env, o) {
362
+ if resolve_negative_obligation ( selcx. infcx ( ) . fork ( ) , o) {
368
363
return true ;
369
364
}
370
365
371
366
// Try to prove a negative obligation exists for super predicates
372
- for o in util:: elaborate_predicates ( infcx . tcx , iter:: once ( o. predicate ) ) {
373
- if resolve_negative_obligation ( infcx, param_env , & o) {
367
+ for o in util:: elaborate_predicates ( selcx . tcx ( ) , iter:: once ( o. predicate ) ) {
368
+ if resolve_negative_obligation ( selcx . infcx ( ) . fork ( ) , & o) {
374
369
return true ;
375
370
}
376
371
}
@@ -380,8 +375,7 @@ fn negative_impl_exists<'cx, 'tcx>(
380
375
381
376
#[ instrument( level = "debug" , skip( infcx) ) ]
382
377
fn resolve_negative_obligation < ' cx , ' tcx > (
383
- infcx : & InferCtxt < ' cx , ' tcx > ,
384
- param_env : ty:: ParamEnv < ' tcx > ,
378
+ infcx : InferCtxt < ' cx , ' tcx > ,
385
379
o : & PredicateObligation < ' tcx > ,
386
380
) -> bool {
387
381
let tcx = infcx. tcx ;
@@ -390,7 +384,8 @@ fn resolve_negative_obligation<'cx, 'tcx>(
390
384
return false ;
391
385
} ;
392
386
393
- let errors = super :: fully_solve_obligation ( infcx, o) ;
387
+ let param_env = o. param_env ;
388
+ let errors = super :: fully_solve_obligation ( & infcx, o) ;
394
389
if !errors. is_empty ( ) {
395
390
return false ;
396
391
}
0 commit comments