Skip to content

Commit 8c41cd0

Browse files
committed
simplify fold
1 parent 9f2e15d commit 8c41cd0

File tree

1 file changed

+3
-34
lines changed

1 file changed

+3
-34
lines changed

compiler/stable_mir/src/fold.rs

+3-34
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,6 @@
11
use std::ops::ControlFlow;
22

3-
use crate::{
4-
ty::{self, BoundRegion, BoundRegionKind},
5-
Opaque,
6-
};
3+
use crate::Opaque;
74

85
use super::ty::{
96
Allocation, Binder, Const, ConstDef, ConstantKind, ExistentialPredicate, FnSig, GenericArgKind,
@@ -116,36 +113,8 @@ impl Foldable for Region {
116113
fn fold<V: Folder>(&self, folder: &mut V) -> ControlFlow<V::Break, Self> {
117114
folder.fold_reg(self)
118115
}
119-
fn super_fold<V: Folder>(&self, folder: &mut V) -> ControlFlow<V::Break, Self> {
120-
let mut kind = self.kind.clone();
121-
match &mut kind {
122-
crate::ty::RegionKind::ReEarlyBound(_) => {}
123-
crate::ty::RegionKind::ReLateBound(_, bound_reg) => {
124-
*bound_reg = bound_reg.fold(folder)?
125-
}
126-
crate::ty::RegionKind::ReStatic => {}
127-
crate::ty::RegionKind::RePlaceholder(bound_reg) => {
128-
bound_reg.bound = bound_reg.bound.fold(folder)?
129-
}
130-
crate::ty::RegionKind::ReErased => {}
131-
}
132-
ControlFlow::Continue(ty::Region { kind: kind }.into())
133-
}
134-
}
135-
136-
impl Foldable for BoundRegion {
137-
fn super_fold<V: Folder>(&self, folder: &mut V) -> ControlFlow<V::Break, Self> {
138-
ControlFlow::Continue(BoundRegion { var: self.var, kind: self.kind.fold(folder)? })
139-
}
140-
}
141-
142-
impl Foldable for BoundRegionKind {
143-
fn super_fold<V: Folder>(&self, _folder: &mut V) -> ControlFlow<V::Break, Self> {
144-
match self {
145-
BoundRegionKind::BrAnon => ControlFlow::Continue(self.clone()),
146-
BoundRegionKind::BrNamed(_, _) => ControlFlow::Continue(self.clone()),
147-
BoundRegionKind::BrEnv => ControlFlow::Continue(self.clone()),
148-
}
116+
fn super_fold<V: Folder>(&self, _: &mut V) -> ControlFlow<V::Break, Self> {
117+
ControlFlow::Continue(self.clone())
149118
}
150119
}
151120

0 commit comments

Comments
 (0)