Skip to content

Commit

Permalink
ast_lowering: Introduce lower_span for catching all spans entering HIR
Browse files Browse the repository at this point in the history
  • Loading branch information
petrochenkov committed Aug 29, 2021
1 parent 757a65b commit 59013cd
Show file tree
Hide file tree
Showing 6 changed files with 330 additions and 169 deletions.
13 changes: 9 additions & 4 deletions compiler/rustc_ast_lowering/src/asm.rs
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> {
hir::InlineAsmOperand::Sym { expr: self.lower_expr_mut(expr) }
}
};
(op, *op_sp)
(op, self.lower_span(*op_sp))
})
.collect();

Expand Down Expand Up @@ -384,16 +384,21 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> {
late: true,
expr: None,
},
abi_span,
self.lower_span(abi_span),
));
}
}
}

let operands = self.arena.alloc_from_iter(operands);
let template = self.arena.alloc_from_iter(asm.template.iter().cloned());
let template_strs = self.arena.alloc_from_iter(asm.template_strs.iter().cloned());
let line_spans = self.arena.alloc_slice(&asm.line_spans[..]);
let template_strs = self.arena.alloc_from_iter(
asm.template_strs
.iter()
.map(|(sym, snippet, span)| (*sym, *snippet, self.lower_span(*span))),
);
let line_spans =
self.arena.alloc_from_iter(asm.line_spans.iter().map(|span| self.lower_span(*span)));
let hir_asm =
hir::InlineAsm { template, template_strs, operands, options: asm.options, line_spans };
self.arena.alloc(hir_asm)
Expand Down
Loading

0 comments on commit 59013cd

Please sign in to comment.