diff options
Diffstat (limited to 'compiler')
| -rw-r--r-- | compiler/rustc_next_trait_solver/src/canonicalizer.rs | 10 | ||||
| -rw-r--r-- | compiler/rustc_type_ir/src/fold.rs | 51 | ||||
| -rw-r--r-- | compiler/rustc_type_ir/src/interner.rs | 8 |
3 files changed, 20 insertions, 49 deletions
diff --git a/compiler/rustc_next_trait_solver/src/canonicalizer.rs b/compiler/rustc_next_trait_solver/src/canonicalizer.rs index a7148c88864..1899517c0e2 100644 --- a/compiler/rustc_next_trait_solver/src/canonicalizer.rs +++ b/compiler/rustc_next_trait_solver/src/canonicalizer.rs @@ -296,10 +296,7 @@ impl<Infcx: InferCtxtLike<Interner = I>, I: Interner> TypeFolder<I> Region::new_anon_bound(self.interner(), self.binder_index, var) } - fn fold_ty(&mut self, t: I::Ty) -> I::Ty - where - I::Ty: TypeSuperFoldable<I>, - { + fn fold_ty(&mut self, t: I::Ty) -> I::Ty { let kind = match t.kind() { ty::Infer(i) => match i { ty::TyVar(vid) => { @@ -378,10 +375,7 @@ impl<Infcx: InferCtxtLike<Interner = I>, I: Interner> TypeFolder<I> Ty::new_anon_bound(self.interner(), self.binder_index, var) } - fn fold_const(&mut self, c: I::Const) -> I::Const - where - I::Const: TypeSuperFoldable<I>, - { + fn fold_const(&mut self, c: I::Const) -> I::Const { // We could canonicalize all consts with static types, but the only ones we // *really* need to worry about are the ones that we end up putting into `CanonicalVarKind` // since canonical vars can't reference other canonical vars. diff --git a/compiler/rustc_type_ir/src/fold.rs b/compiler/rustc_type_ir/src/fold.rs index 8d402588398..01bb3d73dbd 100644 --- a/compiler/rustc_type_ir/src/fold.rs +++ b/compiler/rustc_type_ir/src/fold.rs @@ -136,31 +136,21 @@ pub trait TypeFolder<I: Interner>: FallibleTypeFolder<I, Error = Never> { t.super_fold_with(self) } - fn fold_ty(&mut self, t: I::Ty) -> I::Ty - where - I::Ty: TypeSuperFoldable<I>, - { + fn fold_ty(&mut self, t: I::Ty) -> I::Ty { t.super_fold_with(self) } // The default region folder is a no-op because `Region` is non-recursive - // and has no `super_fold_with` method to call. That also explains the - // lack of `I::Region: TypeSuperFoldable<I>` bound on this method. + // and has no `super_fold_with` method to call. fn fold_region(&mut self, r: I::Region) -> I::Region { r } - fn fold_const(&mut self, c: I::Const) -> I::Const - where - I::Const: TypeSuperFoldable<I>, - { + fn fold_const(&mut self, c: I::Const) -> I::Const { c.super_fold_with(self) } - fn fold_predicate(&mut self, p: I::Predicate) -> I::Predicate - where - I::Predicate: TypeSuperFoldable<I>, - { + fn fold_predicate(&mut self, p: I::Predicate) -> I::Predicate { p.super_fold_with(self) } } @@ -185,31 +175,21 @@ pub trait FallibleTypeFolder<I: Interner>: Sized { t.try_super_fold_with(self) } - fn try_fold_ty(&mut self, t: I::Ty) -> Result<I::Ty, Self::Error> - where - I::Ty: TypeSuperFoldable<I>, - { + fn try_fold_ty(&mut self, t: I::Ty) -> Result<I::Ty, Self::Error> { t.try_super_fold_with(self) } // The default region folder is a no-op because `Region` is non-recursive - // and has no `super_fold_with` method to call. That also explains the - // lack of `I::Region: TypeSuperFoldable<I>` bound on this method. + // and has no `super_fold_with` method to call. fn try_fold_region(&mut self, r: I::Region) -> Result<I::Region, Self::Error> { Ok(r) } - fn try_fold_const(&mut self, c: I::Const) -> Result<I::Const, Self::Error> - where - I::Const: TypeSuperFoldable<I>, - { + fn try_fold_const(&mut self, c: I::Const) -> Result<I::Const, Self::Error> { c.try_super_fold_with(self) } - fn try_fold_predicate(&mut self, p: I::Predicate) -> Result<I::Predicate, Self::Error> - where - I::Predicate: TypeSuperFoldable<I>, - { + fn try_fold_predicate(&mut self, p: I::Predicate) -> Result<I::Predicate, Self::Error> { p.try_super_fold_with(self) } } @@ -234,10 +214,7 @@ where Ok(self.fold_binder(t)) } - fn try_fold_ty(&mut self, t: I::Ty) -> Result<I::Ty, Never> - where - I::Ty: TypeSuperFoldable<I>, - { + fn try_fold_ty(&mut self, t: I::Ty) -> Result<I::Ty, Never> { Ok(self.fold_ty(t)) } @@ -245,17 +222,11 @@ where Ok(self.fold_region(r)) } - fn try_fold_const(&mut self, c: I::Const) -> Result<I::Const, Never> - where - I::Const: TypeSuperFoldable<I>, - { + fn try_fold_const(&mut self, c: I::Const) -> Result<I::Const, Never> { Ok(self.fold_const(c)) } - fn try_fold_predicate(&mut self, p: I::Predicate) -> Result<I::Predicate, Never> - where - I::Predicate: TypeSuperFoldable<I>, - { + fn try_fold_predicate(&mut self, p: I::Predicate) -> Result<I::Predicate, Never> { Ok(self.fold_predicate(p)) } } diff --git a/compiler/rustc_type_ir/src/interner.rs b/compiler/rustc_type_ir/src/interner.rs index d941195eecc..7a2885dd3bb 100644 --- a/compiler/rustc_type_ir/src/interner.rs +++ b/compiler/rustc_type_ir/src/interner.rs @@ -85,7 +85,13 @@ pub trait Interner: Sized + Copy { type PlaceholderRegion: Copy + Debug + Hash + Eq + PlaceholderLike; // Predicates - type Predicate: Copy + Debug + Hash + Eq + TypeSuperVisitable<Self> + Flags; + type Predicate: Copy + + Debug + + Hash + + Eq + + TypeSuperVisitable<Self> + + TypeSuperFoldable<Self> + + Flags; type TraitPredicate: Copy + Debug + Hash + Eq; type RegionOutlivesPredicate: Copy + Debug + Hash + Eq; type TypeOutlivesPredicate: Copy + Debug + Hash + Eq; |
