Skip to content

Commit 04b4c7c

Browse files
committed
Pass a location to #[track_caller] functions in codegen_call_terminator.
1 parent 61496ee commit 04b4c7c

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

src/librustc_codegen_ssa/mir/block.rs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -762,6 +762,14 @@ impl<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> {
762762
&fn_abi.args[first_args.len()..])
763763
}
764764

765+
let needs_location =
766+
instance.map(|i| i.def.requires_caller_location(self.cx.tcx())).unwrap_or_default();
767+
if needs_location {
768+
let location = self.get_caller_location(&mut bx, span);
769+
let last_arg = &fn_abi.args.last().unwrap();
770+
self.codegen_argument(&mut bx, location, &mut llargs, last_arg);
771+
}
772+
765773
let fn_ptr = match (llfn, instance) {
766774
(Some(llfn), _) => llfn,
767775
(None, Some(instance)) => bx.get_fn_addr(instance),

0 commit comments

Comments
 (0)