1
Fork 0

Don't drop region constraints that come from plugging infer regions with placeholders

This commit is contained in:
Michael Goulet 2023-11-20 18:39:44 +00:00
parent 46ecc10c69
commit 19a5e1dfc6
4 changed files with 13 additions and 9 deletions

View file

@ -415,13 +415,6 @@ fn impl_intersection_has_negative_obligation(
return false;
};
plug_infer_with_placeholders(
infcx,
root_universe,
(impl1_header.impl_args, impl2_header.impl_args),
);
let param_env = infcx.resolve_vars_if_possible(param_env);
// FIXME(with_negative_coherence): the infcx has constraints from equating
// the impl headers. We should use these constraints as assumptions, not as
// requirements, when proving the negated where clauses below.
@ -429,6 +422,13 @@ fn impl_intersection_has_negative_obligation(
drop(infcx.take_registered_region_obligations());
drop(infcx.take_and_reset_region_constraints());
plug_infer_with_placeholders(
infcx,
root_universe,
(impl1_header.impl_args, impl2_header.impl_args),
);
let param_env = infcx.resolve_vars_if_possible(param_env);
util::elaborate(tcx, tcx.predicates_of(impl2_def_id).instantiate(tcx, impl2_header.impl_args))
.any(|(clause, _)| try_prove_negated_where_clause(infcx, clause, param_env))
}