Require foldability part of interner item bounds, remove redundant where clauses
This commit is contained in:
parent
08c7ff2264
commit
6439c7fe23
@ -296,10 +296,7 @@ fn fold_region(&mut self, r: I::Region) -> I::Region {
|
||||
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 @@ fn fold_ty(&mut self, t: I::Ty) -> I::Ty
|
||||
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.
|
||||
|
@ -136,31 +136,21 @@ fn fold_binder<T>(&mut self, t: I::Binder<T>) -> I::Binder<T>
|
||||
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 @@ fn try_fold_binder<T>(&mut self, t: I::Binder<T>) -> Result<I::Binder<T>, Self::
|
||||
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 @@ fn try_fold_binder<T>(&mut self, t: I::Binder<T>) -> Result<I::Binder<T>, Never>
|
||||
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 @@ fn try_fold_region(&mut self, r: I::Region) -> Result<I::Region, Never> {
|
||||
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))
|
||||
}
|
||||
}
|
||||
|
@ -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;
|
||||
|
Loading…
Reference in New Issue
Block a user