1
Fork 0

Split out ImplPolarity and PredicatePolarity

This commit is contained in:
Michael Goulet 2024-03-21 15:45:28 -04:00
parent 1447f9d38c
commit 4b87c0b9c9
30 changed files with 169 additions and 95 deletions

View file

@ -1418,10 +1418,13 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
for candidate in candidates {
if let ImplCandidate(def_id) = candidate {
if ty::ImplPolarity::Reservation == tcx.impl_polarity(def_id)
|| obligation.polarity() == tcx.impl_polarity(def_id)
{
result.push(candidate);
match (tcx.impl_polarity(def_id), obligation.polarity()) {
(ty::ImplPolarity::Reservation, _)
| (ty::ImplPolarity::Positive, ty::PredicatePolarity::Positive)
| (ty::ImplPolarity::Negative, ty::PredicatePolarity::Negative) => {
result.push(candidate);
}
_ => {}
}
} else {
result.push(candidate);