Skip to content

Commit 3a4f45d

Browse files
committed
core::panic::Location is a lang item.
For #[track_caller], passing Location as an implicit argument makes it effectively part of the ABI, and type lookup for it must be done for many functions without imports in the file or modifications to the prelude.
1 parent c491875 commit 3a4f45d

File tree

2 files changed

+2
-0
lines changed

2 files changed

+2
-0
lines changed

src/libcore/panic.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -162,6 +162,7 @@ impl fmt::Display for PanicInfo<'_> {
162162
///
163163
/// panic!("Normal panic");
164164
/// ```
165+
#[cfg_attr(not(bootstrap), lang = "panic_location")]
165166
#[derive(Debug)]
166167
#[stable(feature = "panic_hooks", since = "1.10.0")]
167168
pub struct Location<'a> {

src/librustc/middle/lang_items.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -366,6 +366,7 @@ language_item_table! {
366366
PanicFnLangItem, "panic", panic_fn, Target::Fn;
367367
PanicBoundsCheckFnLangItem, "panic_bounds_check", panic_bounds_check_fn, Target::Fn;
368368
PanicInfoLangItem, "panic_info", panic_info, Target::Struct;
369+
PanicLocationLangItem, "panic_location", panic_location, Target::Struct;
369370
PanicImplLangItem, "panic_impl", panic_impl, Target::Fn;
370371
// Libstd panic entry point. Necessary for const eval to be able to catch it
371372
BeginPanicFnLangItem, "begin_panic", begin_panic_fn, Target::Fn;

0 commit comments

Comments
 (0)