Skip to content

Commit 465309a

Browse files
committed
remove unneeded ToPredicate impls
1 parent ec08a03 commit 465309a

File tree

2 files changed

+4
-42
lines changed

2 files changed

+4
-42
lines changed

compiler/rustc_infer/src/infer/canonical/query_response.rs

+4-3
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ use rustc_middle::arena::ArenaAllocatable;
2525
use rustc_middle::mir::ConstraintCategory;
2626
use rustc_middle::ty::fold::TypeFoldable;
2727
use rustc_middle::ty::relate::TypeRelation;
28-
use rustc_middle::ty::{self, BoundVar, ToPredicate, Ty, TyCtxt};
28+
use rustc_middle::ty::{self, BoundVar, Ty, TyCtxt};
2929
use rustc_middle::ty::{GenericArg, GenericArgKind};
3030
use rustc_span::{Span, Symbol};
3131
use std::fmt::Debug;
@@ -739,8 +739,9 @@ impl<'tcx> TypeRelatingDelegate<'tcx> for QueryTypeRelatingDelegate<'_, 'tcx> {
739739
self.obligations.push(Obligation {
740740
cause: self.cause.clone(),
741741
param_env: self.param_env,
742-
predicate: ty::ClauseKind::RegionOutlives(ty::OutlivesPredicate(sup, sub))
743-
.to_predicate(self.infcx.tcx),
742+
predicate: self.infcx.tcx.mk_predicate(ty::Binder::dummy(ty::PredicateKind::Clause(
743+
ty::ClauseKind::RegionOutlives(ty::OutlivesPredicate(sup, sub)),
744+
))),
744745
recursion_depth: 0,
745746
});
746747
}

compiler/rustc_middle/src/ty/mod.rs

-39
Original file line numberDiff line numberDiff line change
@@ -1196,13 +1196,6 @@ impl<'tcx> ToPredicate<'tcx> for Binder<'tcx, PredicateKind<'tcx>> {
11961196
}
11971197
}
11981198

1199-
impl<'tcx> ToPredicate<'tcx> for ClauseKind<'tcx> {
1200-
#[inline(always)]
1201-
fn to_predicate(self, tcx: TyCtxt<'tcx>) -> Predicate<'tcx> {
1202-
tcx.mk_predicate(ty::Binder::dummy(ty::PredicateKind::Clause(self)))
1203-
}
1204-
}
1205-
12061199
impl<'tcx> ToPredicate<'tcx> for Binder<'tcx, ClauseKind<'tcx>> {
12071200
#[inline(always)]
12081201
fn to_predicate(self, tcx: TyCtxt<'tcx>) -> Predicate<'tcx> {
@@ -1253,14 +1246,6 @@ impl<'tcx> ToPredicate<'tcx, Clause<'tcx>> for TraitRef<'tcx> {
12531246
}
12541247
}
12551248

1256-
impl<'tcx> ToPredicate<'tcx, Clause<'tcx>> for TraitPredicate<'tcx> {
1257-
#[inline(always)]
1258-
fn to_predicate(self, tcx: TyCtxt<'tcx>) -> Clause<'tcx> {
1259-
let p: Predicate<'tcx> = self.to_predicate(tcx);
1260-
p.expect_clause()
1261-
}
1262-
}
1263-
12641249
impl<'tcx> ToPredicate<'tcx> for Binder<'tcx, TraitRef<'tcx>> {
12651250
#[inline(always)]
12661251
fn to_predicate(self, tcx: TyCtxt<'tcx>) -> Predicate<'tcx> {
@@ -1287,18 +1272,6 @@ impl<'tcx> ToPredicate<'tcx, PolyTraitPredicate<'tcx>> for Binder<'tcx, TraitRef
12871272
}
12881273
}
12891274

1290-
impl<'tcx> ToPredicate<'tcx, PolyTraitPredicate<'tcx>> for TraitRef<'tcx> {
1291-
fn to_predicate(self, tcx: TyCtxt<'tcx>) -> PolyTraitPredicate<'tcx> {
1292-
ty::Binder::dummy(self).to_predicate(tcx)
1293-
}
1294-
}
1295-
1296-
impl<'tcx> ToPredicate<'tcx, PolyTraitPredicate<'tcx>> for TraitPredicate<'tcx> {
1297-
fn to_predicate(self, _tcx: TyCtxt<'tcx>) -> PolyTraitPredicate<'tcx> {
1298-
ty::Binder::dummy(self)
1299-
}
1300-
}
1301-
13021275
impl<'tcx> ToPredicate<'tcx> for PolyTraitPredicate<'tcx> {
13031276
fn to_predicate(self, tcx: TyCtxt<'tcx>) -> Predicate<'tcx> {
13041277
self.map_bound(|p| PredicateKind::Clause(ClauseKind::Trait(p))).to_predicate(tcx)
@@ -1312,12 +1285,6 @@ impl<'tcx> ToPredicate<'tcx, Clause<'tcx>> for PolyTraitPredicate<'tcx> {
13121285
}
13131286
}
13141287

1315-
impl<'tcx> ToPredicate<'tcx> for OutlivesPredicate<ty::Region<'tcx>, ty::Region<'tcx>> {
1316-
fn to_predicate(self, tcx: TyCtxt<'tcx>) -> Predicate<'tcx> {
1317-
ty::Binder::dummy(PredicateKind::Clause(ClauseKind::RegionOutlives(self))).to_predicate(tcx)
1318-
}
1319-
}
1320-
13211288
impl<'tcx> ToPredicate<'tcx> for PolyRegionOutlivesPredicate<'tcx> {
13221289
fn to_predicate(self, tcx: TyCtxt<'tcx>) -> Predicate<'tcx> {
13231290
self.map_bound(|p| PredicateKind::Clause(ClauseKind::RegionOutlives(p))).to_predicate(tcx)
@@ -1330,12 +1297,6 @@ impl<'tcx> ToPredicate<'tcx> for OutlivesPredicate<Ty<'tcx>, ty::Region<'tcx>> {
13301297
}
13311298
}
13321299

1333-
impl<'tcx> ToPredicate<'tcx> for PolyTypeOutlivesPredicate<'tcx> {
1334-
fn to_predicate(self, tcx: TyCtxt<'tcx>) -> Predicate<'tcx> {
1335-
self.map_bound(|p| PredicateKind::Clause(ClauseKind::TypeOutlives(p))).to_predicate(tcx)
1336-
}
1337-
}
1338-
13391300
impl<'tcx> ToPredicate<'tcx> for ProjectionPredicate<'tcx> {
13401301
fn to_predicate(self, tcx: TyCtxt<'tcx>) -> Predicate<'tcx> {
13411302
ty::Binder::dummy(PredicateKind::Clause(ClauseKind::Projection(self))).to_predicate(tcx)

0 commit comments

Comments
 (0)