1
Fork 0

Give the correct track-caller location with MIR inlining.

This commit is contained in:
Camille GILLOT 2022-12-25 17:52:42 +00:00
parent d9ee0f468f
commit edc73f9719
11 changed files with 24 additions and 24 deletions

View file

@ -289,7 +289,7 @@ impl<'tcx> Inliner<'tcx> {
) -> Option<CallSite<'tcx>> {
// Only consider direct calls to functions
let terminator = bb_data.terminator();
if let TerminatorKind::Call { ref func, target, .. } = terminator.kind {
if let TerminatorKind::Call { ref func, target, fn_span, .. } = terminator.kind {
let func_ty = func.ty(caller_body, self.tcx);
if let ty::FnDef(def_id, substs) = *func_ty.kind() {
// To resolve an instance its substs have to be fully normalized.
@ -302,14 +302,9 @@ impl<'tcx> Inliner<'tcx> {
}
let fn_sig = self.tcx.bound_fn_sig(def_id).subst(self.tcx, substs);
let source_info = SourceInfo { span: fn_span, ..terminator.source_info };
return Some(CallSite {
callee,
fn_sig,
block: bb,
target,
source_info: terminator.source_info,
});
return Some(CallSite { callee, fn_sig, block: bb, target, source_info });
}
}