diff options
| author | Ziru Niu <zirconium.n@gmail.com> | 2023-09-05 07:21:38 +0800 |
|---|---|---|
| committer | Ziru Niu <zirconium.n@gmail.com> | 2023-09-20 04:03:02 +0800 |
| commit | 3c69a107d0149a27c11490a0d67717c555eb1288 (patch) | |
| tree | 7964c0ab9f535dee189a4a7e2fbf4987c9f322b5 /compiler/rustc_middle/src/ty | |
| parent | 2694b84fbf2c49e1cb7583abf6f62db4a972b614 (diff) | |
| download | rust-3c69a107d0149a27c11490a0d67717c555eb1288.tar.gz rust-3c69a107d0149a27c11490a0d67717c555eb1288.zip | |
remove `impl<'tcx> ToPredicate<'tcx, Clause<'tcx>> for PolyProjectionPredicate<'tcx>`
Diffstat (limited to 'compiler/rustc_middle/src/ty')
| -rw-r--r-- | compiler/rustc_middle/src/ty/mod.rs | 12 | ||||
| -rw-r--r-- | compiler/rustc_middle/src/ty/sty.rs | 2 |
2 files changed, 6 insertions, 8 deletions
diff --git a/compiler/rustc_middle/src/ty/mod.rs b/compiler/rustc_middle/src/ty/mod.rs index d9bd9ad5543..0db48f2f7ec 100644 --- a/compiler/rustc_middle/src/ty/mod.rs +++ b/compiler/rustc_middle/src/ty/mod.rs @@ -566,6 +566,11 @@ impl rustc_errors::IntoDiagnosticArg for Clause<'_> { pub struct Clause<'tcx>(Interned<'tcx, WithCachedTypeInfo<ty::Binder<'tcx, PredicateKind<'tcx>>>>); impl<'tcx> Clause<'tcx> { + pub fn from_projection_clause(tcx: TyCtxt<'tcx>, pred: PolyProjectionPredicate<'tcx>) -> Self { + let pred: Predicate<'tcx> = pred.to_predicate(tcx); + pred.expect_clause() + } + pub fn as_predicate(self) -> Predicate<'tcx> { Predicate(self.0) } @@ -1323,13 +1328,6 @@ impl<'tcx> ToPredicate<'tcx, Clause<'tcx>> for ProjectionPredicate<'tcx> { } } -impl<'tcx> ToPredicate<'tcx, Clause<'tcx>> for PolyProjectionPredicate<'tcx> { - fn to_predicate(self, tcx: TyCtxt<'tcx>) -> Clause<'tcx> { - let p: Predicate<'tcx> = self.to_predicate(tcx); - p.expect_clause() - } -} - impl<'tcx> ToPredicate<'tcx> for TraitPredicate<'tcx> { fn to_predicate(self, tcx: TyCtxt<'tcx>) -> Predicate<'tcx> { PredicateKind::Clause(ClauseKind::Trait(self)).to_predicate(tcx) diff --git a/compiler/rustc_middle/src/ty/sty.rs b/compiler/rustc_middle/src/ty/sty.rs index a14d09bbb70..e3e014a3b2a 100644 --- a/compiler/rustc_middle/src/ty/sty.rs +++ b/compiler/rustc_middle/src/ty/sty.rs @@ -725,7 +725,7 @@ impl<'tcx> PolyExistentialPredicate<'tcx> { self.rebind(tr).with_self_ty(tcx, self_ty).to_predicate(tcx) } ExistentialPredicate::Projection(p) => { - self.rebind(p.with_self_ty(tcx, self_ty)).to_predicate(tcx) + ty::Clause::from_projection_clause(tcx, self.rebind(p.with_self_ty(tcx, self_ty))) } ExistentialPredicate::AutoTrait(did) => { let generics = tcx.generics_of(did); |
