Skip to content

Commit 634df06

Browse files
committed
Generalize the ToPredicate trait
Its name is now not accurate anymore, but we'll adjust that later
1 parent 3b91b1a commit 634df06

File tree

2 files changed

+9
-9
lines changed

2 files changed

+9
-9
lines changed

compiler/rustc_borrowck/src/type_check/canonical.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@ impl<'a, 'tcx> TypeChecker<'a, 'tcx> {
122122

123123
pub(super) fn prove_predicates(
124124
&mut self,
125-
predicates: impl IntoIterator<Item = impl ToPredicate<'tcx>>,
125+
predicates: impl IntoIterator<Item = impl ToPredicate<'tcx, ty::Predicate<'tcx>>>,
126126
locations: Locations,
127127
category: ConstraintCategory<'tcx>,
128128
) {

compiler/rustc_middle/src/ty/mod.rs

+8-8
Original file line numberDiff line numberDiff line change
@@ -1125,42 +1125,42 @@ impl<'tcx> ToPolyTraitRef<'tcx> for PolyTraitPredicate<'tcx> {
11251125
}
11261126
}
11271127

1128-
pub trait ToPredicate<'tcx> {
1129-
fn to_predicate(self, tcx: TyCtxt<'tcx>) -> Predicate<'tcx>;
1128+
pub trait ToPredicate<'tcx, Predicate> {
1129+
fn to_predicate(self, tcx: TyCtxt<'tcx>) -> Predicate;
11301130
}
11311131

1132-
impl<'tcx> ToPredicate<'tcx> for Predicate<'tcx> {
1132+
impl<'tcx> ToPredicate<'tcx, Predicate<'tcx>> for Predicate<'tcx> {
11331133
fn to_predicate(self, _tcx: TyCtxt<'tcx>) -> Predicate<'tcx> {
11341134
self
11351135
}
11361136
}
11371137

1138-
impl<'tcx> ToPredicate<'tcx> for Binder<'tcx, PredicateKind<'tcx>> {
1138+
impl<'tcx> ToPredicate<'tcx, Predicate<'tcx>> for Binder<'tcx, PredicateKind<'tcx>> {
11391139
#[inline(always)]
11401140
fn to_predicate(self, tcx: TyCtxt<'tcx>) -> Predicate<'tcx> {
11411141
tcx.mk_predicate(self)
11421142
}
11431143
}
11441144

1145-
impl<'tcx> ToPredicate<'tcx> for PolyTraitPredicate<'tcx> {
1145+
impl<'tcx> ToPredicate<'tcx, Predicate<'tcx>> for PolyTraitPredicate<'tcx> {
11461146
fn to_predicate(self, tcx: TyCtxt<'tcx>) -> Predicate<'tcx> {
11471147
self.map_bound(PredicateKind::Trait).to_predicate(tcx)
11481148
}
11491149
}
11501150

1151-
impl<'tcx> ToPredicate<'tcx> for PolyRegionOutlivesPredicate<'tcx> {
1151+
impl<'tcx> ToPredicate<'tcx, Predicate<'tcx>> for PolyRegionOutlivesPredicate<'tcx> {
11521152
fn to_predicate(self, tcx: TyCtxt<'tcx>) -> Predicate<'tcx> {
11531153
self.map_bound(PredicateKind::RegionOutlives).to_predicate(tcx)
11541154
}
11551155
}
11561156

1157-
impl<'tcx> ToPredicate<'tcx> for PolyTypeOutlivesPredicate<'tcx> {
1157+
impl<'tcx> ToPredicate<'tcx, Predicate<'tcx>> for PolyTypeOutlivesPredicate<'tcx> {
11581158
fn to_predicate(self, tcx: TyCtxt<'tcx>) -> Predicate<'tcx> {
11591159
self.map_bound(PredicateKind::TypeOutlives).to_predicate(tcx)
11601160
}
11611161
}
11621162

1163-
impl<'tcx> ToPredicate<'tcx> for PolyProjectionPredicate<'tcx> {
1163+
impl<'tcx> ToPredicate<'tcx, Predicate<'tcx>> for PolyProjectionPredicate<'tcx> {
11641164
fn to_predicate(self, tcx: TyCtxt<'tcx>) -> Predicate<'tcx> {
11651165
self.map_bound(PredicateKind::Projection).to_predicate(tcx)
11661166
}

0 commit comments

Comments
 (0)