1
Fork 0

Make negative trait bounds work with the old trait solver

This commit is contained in:
Michael Goulet 2023-04-25 06:37:24 +00:00
parent 40a63cb06f
commit 03469c3f2e
5 changed files with 36 additions and 14 deletions

View file

@ -200,6 +200,10 @@ impl<'tcx, O: Elaboratable<'tcx>> Elaborator<'tcx, O> {
let bound_predicate = elaboratable.predicate().kind();
match bound_predicate.skip_binder() {
ty::PredicateKind::Clause(ty::Clause::Trait(data)) => {
// Negative trait bounds do not imply any supertrait bounds
if data.polarity == ty::ImplPolarity::Negative {
return;
}
// Get predicates implied by the trait, or only super predicates if we only care about self predicates.
let predicates = if self.only_self {
tcx.super_predicates_of(data.def_id())