Skip to content
This repository was archived by the owner on May 28, 2025. It is now read-only.
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 026dd26

Browse files
committedSep 4, 2024·
Auto merge of rust-lang#129658 - saethlin:spare-a-crumb, r=<try>
Add some track_caller info to precondition panics r? `@ghost` Thought of this while looking at rust-lang#129642 (comment)
2 parents d6c8169 + ea2521c commit 026dd26

File tree

67 files changed

+123
-112
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

67 files changed

+123
-112
lines changed
 

‎compiler/rustc_codegen_ssa/src/mir/block.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -790,13 +790,15 @@ impl<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> {
790790
let (fn_abi, llfn, instance) =
791791
common::build_langcall(bx, Some(source_info.span), LangItem::PanicNounwind);
792792

793+
let location = self.get_caller_location(bx, source_info).immediate();
794+
793795
// Codegen the actual panic invoke/call.
794796
helper.do_call(
795797
self,
796798
bx,
797799
fn_abi,
798800
llfn,
799-
&[msg.0, msg.1],
801+
&[msg.0, msg.1, location],
800802
target.as_ref().map(|bb| (ReturnDest::Nothing, *bb)),
801803
unwind,
802804
&[],

‎compiler/rustc_codegen_ssa/src/size_of_val.rs

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,12 +72,20 @@ pub fn size_and_align_of_dst<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>>(
7272
// (But we are in good company, this code is duplicated plenty of times.)
7373
let fn_ty = bx.fn_decl_backend_type(fn_abi);
7474

75+
let const_loc = bx.tcx().span_as_caller_location(rustc_span::DUMMY_SP);
76+
let location = crate::mir::operand::OperandRef::from_const(
77+
bx,
78+
const_loc,
79+
bx.tcx().caller_location_ty(),
80+
)
81+
.immediate();
82+
7583
bx.call(
7684
fn_ty,
7785
/* fn_attrs */ None,
7886
Some(fn_abi),
7987
llfn,
80-
&[msg.0, msg.1],
88+
&[msg.0, msg.1, location],
8189
None,
8290
None,
8391
);

0 commit comments

Comments
 (0)
This repository has been archived.