1
Fork 0

introduce mir::Unevaluated

This commit is contained in:
b-naber 2022-09-19 19:46:53 +02:00
parent 3e50038a2d
commit 9f3784df89
32 changed files with 166 additions and 132 deletions

View file

@ -831,13 +831,13 @@ impl<'tcx> TypeVisitable<'tcx> for InferConst<'tcx> {
impl<'tcx> TypeFoldable<'tcx> for ty::Unevaluated<'tcx> {
fn try_fold_with<F: FallibleTypeFolder<'tcx>>(self, folder: &mut F) -> Result<Self, F::Error> {
folder.try_fold_unevaluated(self)
folder.try_fold_ty_unevaluated(self)
}
}
impl<'tcx> TypeVisitable<'tcx> for ty::Unevaluated<'tcx> {
fn visit_with<V: TypeVisitor<'tcx>>(&self, visitor: &mut V) -> ControlFlow<V::BreakTy> {
visitor.visit_unevaluated(*self)
visitor.visit_ty_unevaluated(*self)
}
}
@ -846,11 +846,7 @@ impl<'tcx> TypeSuperFoldable<'tcx> for ty::Unevaluated<'tcx> {
self,
folder: &mut F,
) -> Result<Self, F::Error> {
Ok(ty::Unevaluated {
def: self.def,
substs: self.substs.try_fold_with(folder)?,
promoted: self.promoted,
})
Ok(ty::Unevaluated { def: self.def, substs: self.substs.try_fold_with(folder)? })
}
}
@ -859,15 +855,3 @@ impl<'tcx> TypeSuperVisitable<'tcx> for ty::Unevaluated<'tcx> {
self.substs.visit_with(visitor)
}
}
impl<'tcx> TypeFoldable<'tcx> for ty::Unevaluated<'tcx, ()> {
fn try_fold_with<F: FallibleTypeFolder<'tcx>>(self, folder: &mut F) -> Result<Self, F::Error> {
Ok(self.expand().try_fold_with(folder)?.shrink())
}
}
impl<'tcx> TypeVisitable<'tcx> for ty::Unevaluated<'tcx, ()> {
fn visit_with<V: TypeVisitor<'tcx>>(&self, visitor: &mut V) -> ControlFlow<V::BreakTy> {
self.expand().visit_with(visitor)
}
}