diff options
| author | ouz-a <ouz.agz@gmail.com> | 2023-09-28 19:43:28 +0300 |
|---|---|---|
| committer | ouz-a <ouz.agz@gmail.com> | 2023-09-28 19:43:28 +0300 |
| commit | 8c41cd0d78caed65ebd2f057d5209fc564f9cc10 (patch) | |
| tree | 49ed3168140ce4cf5e6d0cc445f30d5868a862c7 | |
| parent | 9f2e15d2328df0d32c5515c7b9a922b810403982 (diff) | |
| download | rust-8c41cd0d78caed65ebd2f057d5209fc564f9cc10.tar.gz rust-8c41cd0d78caed65ebd2f057d5209fc564f9cc10.zip | |
simplify fold
| -rw-r--r-- | compiler/stable_mir/src/fold.rs | 37 |
1 files changed, 3 insertions, 34 deletions
diff --git a/compiler/stable_mir/src/fold.rs b/compiler/stable_mir/src/fold.rs index 90853c104bb..65b743811ce 100644 --- a/compiler/stable_mir/src/fold.rs +++ b/compiler/stable_mir/src/fold.rs @@ -1,9 +1,6 @@ use std::ops::ControlFlow; -use crate::{ - ty::{self, BoundRegion, BoundRegionKind}, - Opaque, -}; +use crate::Opaque; use super::ty::{ Allocation, Binder, Const, ConstDef, ConstantKind, ExistentialPredicate, FnSig, GenericArgKind, @@ -116,36 +113,8 @@ impl Foldable for Region { fn fold<V: Folder>(&self, folder: &mut V) -> ControlFlow<V::Break, Self> { folder.fold_reg(self) } - fn super_fold<V: Folder>(&self, folder: &mut V) -> ControlFlow<V::Break, Self> { - let mut kind = self.kind.clone(); - match &mut kind { - crate::ty::RegionKind::ReEarlyBound(_) => {} - crate::ty::RegionKind::ReLateBound(_, bound_reg) => { - *bound_reg = bound_reg.fold(folder)? - } - crate::ty::RegionKind::ReStatic => {} - crate::ty::RegionKind::RePlaceholder(bound_reg) => { - bound_reg.bound = bound_reg.bound.fold(folder)? - } - crate::ty::RegionKind::ReErased => {} - } - ControlFlow::Continue(ty::Region { kind: kind }.into()) - } -} - -impl Foldable for BoundRegion { - fn super_fold<V: Folder>(&self, folder: &mut V) -> ControlFlow<V::Break, Self> { - ControlFlow::Continue(BoundRegion { var: self.var, kind: self.kind.fold(folder)? }) - } -} - -impl Foldable for BoundRegionKind { - fn super_fold<V: Folder>(&self, _folder: &mut V) -> ControlFlow<V::Break, Self> { - match self { - BoundRegionKind::BrAnon => ControlFlow::Continue(self.clone()), - BoundRegionKind::BrNamed(_, _) => ControlFlow::Continue(self.clone()), - BoundRegionKind::BrEnv => ControlFlow::Continue(self.clone()), - } + fn super_fold<V: Folder>(&self, _: &mut V) -> ControlFlow<V::Break, Self> { + ControlFlow::Continue(self.clone()) } } |
