@@ -342,10 +342,8 @@ fn equate<'cx, 'tcx>(
342342 } ;
343343
344344 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) ) ;
349347
350348 if let Some ( failing_obligation) = opt_failing_obligation {
351349 debug ! ( "overlap: obligation unsatisfiable {:?}" , failing_obligation) ;
@@ -359,18 +357,15 @@ fn equate<'cx, 'tcx>(
359357#[ instrument( level = "debug" , skip( selcx) ) ]
360358fn negative_impl_exists < ' cx , ' tcx > (
361359 selcx : & SelectionContext < ' cx , ' tcx > ,
362- param_env : ty:: ParamEnv < ' tcx > ,
363360 o : & PredicateObligation < ' tcx > ,
364361) -> 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) {
368363 return true ;
369364 }
370365
371366 // 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) {
374369 return true ;
375370 }
376371 }
@@ -380,8 +375,7 @@ fn negative_impl_exists<'cx, 'tcx>(
380375
381376#[ instrument( level = "debug" , skip( infcx) ) ]
382377fn resolve_negative_obligation < ' cx , ' tcx > (
383- infcx : & InferCtxt < ' cx , ' tcx > ,
384- param_env : ty:: ParamEnv < ' tcx > ,
378+ infcx : InferCtxt < ' cx , ' tcx > ,
385379 o : & PredicateObligation < ' tcx > ,
386380) -> bool {
387381 let tcx = infcx. tcx ;
@@ -390,7 +384,8 @@ fn resolve_negative_obligation<'cx, 'tcx>(
390384 return false ;
391385 } ;
392386
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) ;
394389 if !errors. is_empty ( ) {
395390 return false ;
396391 }
0 commit comments