Skip to content

Commit e940f84

Browse files
drive-by: Default param for ToPredicate
1 parent d144956 commit e940f84

File tree

3 files changed

+12
-14
lines changed

3 files changed

+12
-14
lines changed

compiler/rustc_borrowck/src/type_check/canonical.rs

+2-4
Original file line numberDiff line numberDiff line change
@@ -121,9 +121,7 @@ impl<'a, 'tcx> TypeChecker<'a, 'tcx> {
121121

122122
pub(super) fn prove_predicates(
123123
&mut self,
124-
predicates: impl IntoIterator<
125-
Item = impl ToPredicate<'tcx, ty::Predicate<'tcx>> + std::fmt::Debug,
126-
>,
124+
predicates: impl IntoIterator<Item = impl ToPredicate<'tcx> + std::fmt::Debug>,
127125
locations: Locations,
128126
category: ConstraintCategory<'tcx>,
129127
) {
@@ -135,7 +133,7 @@ impl<'a, 'tcx> TypeChecker<'a, 'tcx> {
135133
#[instrument(skip(self), level = "debug")]
136134
pub(super) fn prove_predicate(
137135
&mut self,
138-
predicate: impl ToPredicate<'tcx, ty::Predicate<'tcx>> + std::fmt::Debug,
136+
predicate: impl ToPredicate<'tcx> + std::fmt::Debug,
139137
locations: Locations,
140138
category: ConstraintCategory<'tcx>,
141139
) {

compiler/rustc_middle/src/ty/mod.rs

+9-9
Original file line numberDiff line numberDiff line change
@@ -1150,8 +1150,8 @@ impl<'tcx> ToPolyTraitRef<'tcx> for PolyTraitPredicate<'tcx> {
11501150
}
11511151
}
11521152

1153-
pub trait ToPredicate<'tcx, Predicate> {
1154-
fn to_predicate(self, tcx: TyCtxt<'tcx>) -> Predicate;
1153+
pub trait ToPredicate<'tcx, P = Predicate<'tcx>> {
1154+
fn to_predicate(self, tcx: TyCtxt<'tcx>) -> P;
11551155
}
11561156

11571157
impl<'tcx, T> ToPredicate<'tcx, T> for T {
@@ -1160,21 +1160,21 @@ impl<'tcx, T> ToPredicate<'tcx, T> for T {
11601160
}
11611161
}
11621162

1163-
impl<'tcx> ToPredicate<'tcx, Predicate<'tcx>> for Binder<'tcx, PredicateKind<'tcx>> {
1163+
impl<'tcx> ToPredicate<'tcx> for Binder<'tcx, PredicateKind<'tcx>> {
11641164
#[inline(always)]
11651165
fn to_predicate(self, tcx: TyCtxt<'tcx>) -> Predicate<'tcx> {
11661166
tcx.mk_predicate(self)
11671167
}
11681168
}
11691169

1170-
impl<'tcx> ToPredicate<'tcx, Predicate<'tcx>> for Clause<'tcx> {
1170+
impl<'tcx> ToPredicate<'tcx> for Clause<'tcx> {
11711171
#[inline(always)]
11721172
fn to_predicate(self, tcx: TyCtxt<'tcx>) -> Predicate<'tcx> {
11731173
tcx.mk_predicate(ty::Binder::dummy(ty::PredicateKind::Clause(self)))
11741174
}
11751175
}
11761176

1177-
impl<'tcx> ToPredicate<'tcx, Predicate<'tcx>> for Binder<'tcx, TraitRef<'tcx>> {
1177+
impl<'tcx> ToPredicate<'tcx> for Binder<'tcx, TraitRef<'tcx>> {
11781178
#[inline(always)]
11791179
fn to_predicate(self, tcx: TyCtxt<'tcx>) -> Predicate<'tcx> {
11801180
let pred: PolyTraitPredicate<'tcx> = self.to_predicate(tcx);
@@ -1193,25 +1193,25 @@ impl<'tcx> ToPredicate<'tcx, PolyTraitPredicate<'tcx>> for Binder<'tcx, TraitRef
11931193
}
11941194
}
11951195

1196-
impl<'tcx> ToPredicate<'tcx, Predicate<'tcx>> for PolyTraitPredicate<'tcx> {
1196+
impl<'tcx> ToPredicate<'tcx> for PolyTraitPredicate<'tcx> {
11971197
fn to_predicate(self, tcx: TyCtxt<'tcx>) -> Predicate<'tcx> {
11981198
self.map_bound(|p| PredicateKind::Clause(Clause::Trait(p))).to_predicate(tcx)
11991199
}
12001200
}
12011201

1202-
impl<'tcx> ToPredicate<'tcx, Predicate<'tcx>> for PolyRegionOutlivesPredicate<'tcx> {
1202+
impl<'tcx> ToPredicate<'tcx> for PolyRegionOutlivesPredicate<'tcx> {
12031203
fn to_predicate(self, tcx: TyCtxt<'tcx>) -> Predicate<'tcx> {
12041204
self.map_bound(|p| PredicateKind::Clause(Clause::RegionOutlives(p))).to_predicate(tcx)
12051205
}
12061206
}
12071207

1208-
impl<'tcx> ToPredicate<'tcx, Predicate<'tcx>> for PolyTypeOutlivesPredicate<'tcx> {
1208+
impl<'tcx> ToPredicate<'tcx> for PolyTypeOutlivesPredicate<'tcx> {
12091209
fn to_predicate(self, tcx: TyCtxt<'tcx>) -> Predicate<'tcx> {
12101210
self.map_bound(|p| PredicateKind::Clause(Clause::TypeOutlives(p))).to_predicate(tcx)
12111211
}
12121212
}
12131213

1214-
impl<'tcx> ToPredicate<'tcx, Predicate<'tcx>> for PolyProjectionPredicate<'tcx> {
1214+
impl<'tcx> ToPredicate<'tcx> for PolyProjectionPredicate<'tcx> {
12151215
fn to_predicate(self, tcx: TyCtxt<'tcx>) -> Predicate<'tcx> {
12161216
self.map_bound(|p| PredicateKind::Clause(Clause::Projection(p))).to_predicate(tcx)
12171217
}

compiler/rustc_trait_selection/src/traits/mod.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,7 @@ pub fn type_known_to_meet_bound_modulo_regions<'tcx>(
150150
fn pred_known_to_hold_modulo_regions<'tcx>(
151151
infcx: &InferCtxt<'tcx>,
152152
param_env: ty::ParamEnv<'tcx>,
153-
pred: impl ToPredicate<'tcx, ty::Predicate<'tcx>> + TypeVisitable<'tcx>,
153+
pred: impl ToPredicate<'tcx> + TypeVisitable<'tcx>,
154154
span: Span,
155155
) -> bool {
156156
let has_non_region_infer = pred.has_non_region_infer();

0 commit comments

Comments
 (0)