Skip to content

Commit 961ace3

Browse files
committed
lowering: move lower_{unop,binop} -> expr.rs
1 parent e71f6e1 commit 961ace3

File tree

2 files changed

+34
-34
lines changed

2 files changed

+34
-34
lines changed

src/librustc/hir/lowering.rs

Lines changed: 0 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -4114,40 +4114,6 @@ impl<'a> LoweringContext<'a> {
41144114
}
41154115
}
41164116

4117-
fn lower_unop(&mut self, u: UnOp) -> hir::UnOp {
4118-
match u {
4119-
UnOp::Deref => hir::UnDeref,
4120-
UnOp::Not => hir::UnNot,
4121-
UnOp::Neg => hir::UnNeg,
4122-
}
4123-
}
4124-
4125-
fn lower_binop(&mut self, b: BinOp) -> hir::BinOp {
4126-
Spanned {
4127-
node: match b.node {
4128-
BinOpKind::Add => hir::BinOpKind::Add,
4129-
BinOpKind::Sub => hir::BinOpKind::Sub,
4130-
BinOpKind::Mul => hir::BinOpKind::Mul,
4131-
BinOpKind::Div => hir::BinOpKind::Div,
4132-
BinOpKind::Rem => hir::BinOpKind::Rem,
4133-
BinOpKind::And => hir::BinOpKind::And,
4134-
BinOpKind::Or => hir::BinOpKind::Or,
4135-
BinOpKind::BitXor => hir::BinOpKind::BitXor,
4136-
BinOpKind::BitAnd => hir::BinOpKind::BitAnd,
4137-
BinOpKind::BitOr => hir::BinOpKind::BitOr,
4138-
BinOpKind::Shl => hir::BinOpKind::Shl,
4139-
BinOpKind::Shr => hir::BinOpKind::Shr,
4140-
BinOpKind::Eq => hir::BinOpKind::Eq,
4141-
BinOpKind::Lt => hir::BinOpKind::Lt,
4142-
BinOpKind::Le => hir::BinOpKind::Le,
4143-
BinOpKind::Ne => hir::BinOpKind::Ne,
4144-
BinOpKind::Ge => hir::BinOpKind::Ge,
4145-
BinOpKind::Gt => hir::BinOpKind::Gt,
4146-
},
4147-
span: b.span,
4148-
}
4149-
}
4150-
41514117
fn lower_pat(&mut self, p: &Pat) -> P<hir::Pat> {
41524118
let node = match p.node {
41534119
PatKind::Wild => hir::PatKind::Wild,

src/librustc/hir/lowering/expr.rs

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -208,6 +208,40 @@ impl LoweringContext<'_> {
208208
}
209209
}
210210

211+
fn lower_unop(&mut self, u: UnOp) -> hir::UnOp {
212+
match u {
213+
UnOp::Deref => hir::UnDeref,
214+
UnOp::Not => hir::UnNot,
215+
UnOp::Neg => hir::UnNeg,
216+
}
217+
}
218+
219+
fn lower_binop(&mut self, b: BinOp) -> hir::BinOp {
220+
Spanned {
221+
node: match b.node {
222+
BinOpKind::Add => hir::BinOpKind::Add,
223+
BinOpKind::Sub => hir::BinOpKind::Sub,
224+
BinOpKind::Mul => hir::BinOpKind::Mul,
225+
BinOpKind::Div => hir::BinOpKind::Div,
226+
BinOpKind::Rem => hir::BinOpKind::Rem,
227+
BinOpKind::And => hir::BinOpKind::And,
228+
BinOpKind::Or => hir::BinOpKind::Or,
229+
BinOpKind::BitXor => hir::BinOpKind::BitXor,
230+
BinOpKind::BitAnd => hir::BinOpKind::BitAnd,
231+
BinOpKind::BitOr => hir::BinOpKind::BitOr,
232+
BinOpKind::Shl => hir::BinOpKind::Shl,
233+
BinOpKind::Shr => hir::BinOpKind::Shr,
234+
BinOpKind::Eq => hir::BinOpKind::Eq,
235+
BinOpKind::Lt => hir::BinOpKind::Lt,
236+
BinOpKind::Le => hir::BinOpKind::Le,
237+
BinOpKind::Ne => hir::BinOpKind::Ne,
238+
BinOpKind::Ge => hir::BinOpKind::Ge,
239+
BinOpKind::Gt => hir::BinOpKind::Gt,
240+
},
241+
span: b.span,
242+
}
243+
}
244+
211245
/// Emit an error and lower `ast::ExprKind::Let(pats, scrutinee)` into:
212246
/// ```rust
213247
/// match scrutinee { pats => true, _ => false }

0 commit comments

Comments
 (0)