// `_ => else_block` where `else_block` is `{}` if there's `None`:
let else_pat = self.pat_wild(span);
let (else_expr, contains_else_clause) = match else_opt {
- None => (self.expr_block_empty(span), false),
+ None => (self.expr_block_empty(span.shrink_to_hi()), false),
Some(els) => (self.lower_expr(els), true),
};
let else_arm = self.arm(else_pat, else_expr);
// Handle then + scrutinee:
- let then_expr = self.lower_block_expr(then);
let (then_pat, scrutinee, desugar) = match cond.kind {
// `<pat> => <then>`:
ExprKind::Let(ref pat, ref scrutinee) => {
(pat, cond, hir::MatchSource::IfDesugar { contains_else_clause })
}
};
+ let then_expr = self.lower_block_expr(then);
let then_arm = self.arm(then_pat, self.arena.alloc(then_expr));
hir::ExprKind::Match(scrutinee, arena_vec![self; then_arm, else_arm], desugar)
};
// Handle then + scrutinee:
- let then_expr = self.lower_block_expr(body);
let (then_pat, scrutinee, desugar, source) = match cond.kind {
ExprKind::Let(ref pat, ref scrutinee) => {
// to:
(pat, cond, hir::MatchSource::WhileDesugar, hir::LoopSource::While)
}
};
+ let then_expr = self.lower_block_expr(body);
let then_arm = self.arm(then_pat, self.arena.alloc(then_expr));
// `match <scrutinee> { ... }`
hir::InlineAsmOperand::Sym { expr: self.lower_expr_mut(expr) }
}
};
- Some(op)
+ Some((op, *op_sp))
})
.collect();
} = *p
{
let op_sp = asm.operands[operand_idx].1;
- match &operands[operand_idx] {
+ match &operands[operand_idx].0 {
hir::InlineAsmOperand::In { reg, .. }
| hir::InlineAsmOperand::Out { reg, .. }
| hir::InlineAsmOperand::InOut { reg, .. }
let mut used_input_regs = FxHashMap::default();
let mut used_output_regs = FxHashMap::default();
let mut required_features: Vec<&str> = vec![];
- for (idx, op) in operands.iter().enumerate() {
- let op_sp = asm.operands[idx].1;
+ for (idx, &(ref op, op_sp)) in operands.iter().enumerate() {
if let Some(reg) = op.reg() {
// Make sure we don't accidentally carry features from the
// previous iteration.
skip = true;
let idx2 = *o.get();
- let op2 = &operands[idx2];
- let op_sp2 = asm.operands[idx2].1;
+ let &(ref op2, op_sp2) = &operands[idx2];
let reg2 = match op2.reg() {
Some(asm::InlineAsmRegOrRegClass::Reg(r)) => r,
_ => unreachable!(),