diff --git a/src/librustc/hir/lowering.rs b/src/librustc/hir/lowering.rs
index 8a39f412aaa..bf3a24de81b 100644
--- a/src/librustc/hir/lowering.rs
+++ b/src/librustc/hir/lowering.rs
@@ -1316,20 +1316,6 @@ impl<'a> LoweringContext<'a> {
}
}
- fn lower_arm(&mut self, arm: &Arm) -> hir::Arm {
- hir::Arm {
- hir_id: self.next_id(),
- attrs: self.lower_attrs(&arm.attrs),
- pats: arm.pats.iter().map(|x| self.lower_pat(x)).collect(),
- guard: match arm.guard {
- Some(ref x) => Some(hir::Guard::If(P(self.lower_expr(x)))),
- _ => None,
- },
- body: P(self.lower_expr(&arm.body)),
- span: arm.span,
- }
- }
-
/// Given an associated type constraint like one of these:
///
/// ```
@@ -4472,17 +4458,6 @@ impl<'a> LoweringContext<'a> {
// Helper methods for building HIR.
- fn arm(&mut self, pats: hir::HirVec
>, expr: P) -> hir::Arm {
- hir::Arm {
- hir_id: self.next_id(),
- attrs: hir_vec![],
- pats,
- guard: None,
- span: expr.span,
- body: expr,
- }
- }
-
fn stmt(&mut self, span: Span, node: hir::StmtKind) -> hir::Stmt {
hir::Stmt { span, node, hir_id: self.next_id() }
}
diff --git a/src/librustc/hir/lowering/expr.rs b/src/librustc/hir/lowering/expr.rs
index 57e7feaedc7..c76d714ffb4 100644
--- a/src/librustc/hir/lowering/expr.rs
+++ b/src/librustc/hir/lowering/expr.rs
@@ -436,6 +436,20 @@ impl LoweringContext<'_> {
P(self.expr_call(e.span, from_err, hir_vec![e]))
}
+ fn lower_arm(&mut self, arm: &Arm) -> hir::Arm {
+ hir::Arm {
+ hir_id: self.next_id(),
+ attrs: self.lower_attrs(&arm.attrs),
+ pats: arm.pats.iter().map(|x| self.lower_pat(x)).collect(),
+ guard: match arm.guard {
+ Some(ref x) => Some(hir::Guard::If(P(self.lower_expr(x)))),
+ _ => None,
+ },
+ body: P(self.lower_expr(&arm.body)),
+ span: arm.span,
+ }
+ }
+
pub(super) fn make_async_expr(
&mut self,
capture_clause: CaptureBy,
@@ -1180,6 +1194,10 @@ impl LoweringContext<'_> {
)
}
+ // =========================================================================
+ // Helper methods for building HIR.
+ // =========================================================================
+
/// Constructs a `true` or `false` literal expression.
pub(super) fn expr_bool(&mut self, span: Span, val: bool) -> hir::Expr {
let lit = Spanned { span, node: LitKind::Bool(val) };
@@ -1360,4 +1378,15 @@ impl LoweringContext<'_> {
is_shorthand: false,
}
}
+
+ fn arm(&mut self, pats: hir::HirVec>, expr: P) -> hir::Arm {
+ hir::Arm {
+ hir_id: self.next_id(),
+ attrs: hir_vec![],
+ pats,
+ guard: None,
+ span: expr.span,
+ body: expr,
+ }
+ }
}