@@ -408,14 +408,21 @@ fn impl_intersection_has_negative_obligation(
408
408
409
409
// Equate the headers to find their intersection (the general type, with infer vars,
410
410
// that may apply both impls).
411
- let Some ( _equate_obligations ) =
411
+ let Some ( equate_obligations ) =
412
412
equate_impl_headers ( infcx, param_env, & impl1_header, & impl2_header)
413
413
else {
414
414
return false ;
415
415
} ;
416
416
417
417
plug_infer_with_placeholders ( infcx, universe, ( impl1_header. impl_args , impl2_header. impl_args ) ) ;
418
418
419
+ // FIXME(with_negative_coherence): the infcx has constraints from equating
420
+ // the impl headers. We should use these constraints as assumptions, not as
421
+ // requirements, when proving the negated where clauses below.
422
+ drop ( equate_obligations) ;
423
+ drop ( infcx. take_registered_region_obligations ( ) ) ;
424
+ drop ( infcx. take_and_reset_region_constraints ( ) ) ;
425
+
419
426
util:: elaborate ( tcx, tcx. predicates_of ( impl2_def_id) . instantiate ( tcx, impl2_header. impl_args ) )
420
427
. any ( |( clause, _) | try_prove_negated_where_clause ( infcx, clause, param_env) )
421
428
}
@@ -541,14 +548,6 @@ fn try_prove_negated_where_clause<'tcx>(
541
548
return false ;
542
549
} ;
543
550
544
- // FIXME(with_negative_coherence): the infcx has region contraints from equating
545
- // the impl headers as requirements. Given that the only region constraints we
546
- // get are involving inference regions in the root, it shouldn't matter, but
547
- // still sus.
548
- //
549
- // We probably should just throw away the region obligations registered up until
550
- // now, or ideally use them as assumptions when proving the region obligations
551
- // that we get from proving the negative predicate below.
552
551
let ref infcx = root_infcx. fork ( ) ;
553
552
let ocx = ObligationCtxt :: new ( infcx) ;
554
553
0 commit comments