diff options
| author | bors <bors@rust-lang.org> | 2022-12-29 08:06:03 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2022-12-29 08:06:03 +0000 |
| commit | 11a338ab6644cf454c45d2b41651900610a55b07 (patch) | |
| tree | 648b80e1deca9f72c62d397fa0373e88fcfb1c29 /compiler/rustc_mir_transform/src | |
| parent | 6ad83834515912c5e529e0e9fe326d5060d937cf (diff) | |
| parent | edc73f97190b4ee9c47933282c416d492f089dab (diff) | |
| download | rust-11a338ab6644cf454c45d2b41651900610a55b07.tar.gz rust-11a338ab6644cf454c45d2b41651900610a55b07.zip | |
Auto merge of #106139 - cjgillot:mir-inline-location, r=eholk
Give the correct track-caller location with MIR inlining. Fixes https://github.com/rust-lang/rust/issues/105538
Diffstat (limited to 'compiler/rustc_mir_transform/src')
| -rw-r--r-- | compiler/rustc_mir_transform/src/inline.rs | 11 |
1 files changed, 3 insertions, 8 deletions
diff --git a/compiler/rustc_mir_transform/src/inline.rs b/compiler/rustc_mir_transform/src/inline.rs index 9d560f5c837..8bdd965deb2 100644 --- a/compiler/rustc_mir_transform/src/inline.rs +++ b/compiler/rustc_mir_transform/src/inline.rs @@ -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 }); } } |
