diff options
| author | Ben Reeves <benwolverine2019@gmail.com> | 2022-11-10 12:56:09 -0600 |
|---|---|---|
| committer | Ben Reeves <benwolverine2019@gmail.com> | 2022-11-10 12:56:33 -0600 |
| commit | fe53cacff9f1e2aaeaeea4116d99cfa24d1f460f (patch) | |
| tree | 7a2cdb34d0746ddea367c0b50bf48371dcdc6357 /compiler | |
| parent | c0ae62ee955712c96dec17170d4d63fd2b34f504 (diff) | |
| download | rust-fe53cacff9f1e2aaeaeea4116d99cfa24d1f460f.tar.gz rust-fe53cacff9f1e2aaeaeea4116d99cfa24d1f460f.zip | |
Apply PR feedback.
Diffstat (limited to 'compiler')
| -rw-r--r-- | compiler/rustc_hir_analysis/src/impl_wf_check/min_specialization.rs | 19 |
1 files changed, 9 insertions, 10 deletions
diff --git a/compiler/rustc_hir_analysis/src/impl_wf_check/min_specialization.rs b/compiler/rustc_hir_analysis/src/impl_wf_check/min_specialization.rs index f3cb558ef70..55cca0cd2d7 100644 --- a/compiler/rustc_hir_analysis/src/impl_wf_check/min_specialization.rs +++ b/compiler/rustc_hir_analysis/src/impl_wf_check/min_specialization.rs @@ -426,15 +426,13 @@ fn trait_predicates_eq<'tcx>( predicate2: ty::Predicate<'tcx>, span: Span, ) -> bool { - let pred1_kind = predicate1.kind().no_bound_vars(); - let pred2_kind = predicate2.kind().no_bound_vars(); + let pred1_kind = predicate1.kind().skip_binder(); + let pred2_kind = predicate2.kind().skip_binder(); let (trait_pred1, trait_pred2) = match (pred1_kind, pred2_kind) { - (Some(ty::PredicateKind::Trait(pred1)), Some(ty::PredicateKind::Trait(pred2))) => { - (pred1, pred2) - } + (ty::PredicateKind::Trait(pred1), ty::PredicateKind::Trait(pred2)) => (pred1, pred2), // Just use plain syntactic equivalence if either of the predicates aren't // trait predicates or have bound vars. - _ => return pred1_kind == pred2_kind, + _ => return predicate1 == predicate2, }; let predicates_equal_modulo_constness = { @@ -451,10 +449,11 @@ fn trait_predicates_eq<'tcx>( // Check that the predicate on the specializing impl is at least as const as // the one on the base. - if trait_pred2.constness == ty::BoundConstness::ConstIfConst - && trait_pred1.constness == ty::BoundConstness::NotConst - { - tcx.sess.struct_span_err(span, "missing `~const` qualifier").emit(); + match (trait_pred2.constness, trait_pred1.constness) { + (ty::BoundConstness::ConstIfConst, ty::BoundConstness::NotConst) => { + tcx.sess.struct_span_err(span, "missing `~const` qualifier for specialization").emit(); + } + _ => {} } true |
