diff options
| author | Michael Goulet <michael@errs.io> | 2023-04-25 06:37:24 +0000 |
|---|---|---|
| committer | Michael Goulet <michael@errs.io> | 2023-05-02 22:36:25 +0000 |
| commit | 03469c3f2e5f7318b9dd47483f5656b321880408 (patch) | |
| tree | 4def76c66dbe513023cae219c41de91c5043fcef /compiler/rustc_infer/src/traits/util.rs | |
| parent | 40a63cb06ff21d7cd38f35c92a29162e43f9aadf (diff) | |
| download | rust-03469c3f2e5f7318b9dd47483f5656b321880408.tar.gz rust-03469c3f2e5f7318b9dd47483f5656b321880408.zip | |
Make negative trait bounds work with the old trait solver
Diffstat (limited to 'compiler/rustc_infer/src/traits/util.rs')
| -rw-r--r-- | compiler/rustc_infer/src/traits/util.rs | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/compiler/rustc_infer/src/traits/util.rs b/compiler/rustc_infer/src/traits/util.rs index ef01d5d513b..f54e5e5e56f 100644 --- a/compiler/rustc_infer/src/traits/util.rs +++ b/compiler/rustc_infer/src/traits/util.rs @@ -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()) |
