interpret: call caller_location logic the same way codegen does, and share some code
This commit is contained in:
@@ -1454,14 +1454,7 @@ impl<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> {
|
||||
let tcx = bx.tcx();
|
||||
|
||||
let mut span_to_caller_location = |span: Span| {
|
||||
use rustc_session::RemapFileNameExt;
|
||||
let topmost = span.ctxt().outer_expn().expansion_cause().unwrap_or(span);
|
||||
let caller = tcx.sess.source_map().lookup_char_pos(topmost.lo());
|
||||
let const_loc = tcx.const_caller_location((
|
||||
Symbol::intern(&caller.file.name.for_codegen(self.cx.sess()).to_string_lossy()),
|
||||
caller.line as u32,
|
||||
caller.col_display as u32 + 1,
|
||||
));
|
||||
let const_loc = tcx.span_as_caller_location(span);
|
||||
OperandRef::from_const(bx, const_loc, bx.tcx().caller_location_ty())
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user