rust/compiler/rustc_session/src
Matthias Krüger 2faf66d091
Rollup merge of #143387 - dpaoliello:shouldpanicfn, r=bjorn3
Make __rust_alloc_error_handler_should_panic a function

Fixes rust-lang/rust#143253

`__rust_alloc_error_handler_should_panic` is a static but was being exported as a function.

For most targets this doesn't matter, but Arm64EC Windows uses different decorations for exported variables vs functions, hence it fails to link when `-Z oom=abort` is enabled.

We've had issues in the past with statics like this (see rust-lang/rust#141061) but the tldr; is that Arm64EC needs symbols correctly exported as either a function or data, and data MUST and MUST ONLY be marked `dllimport` when the symbol is being imported from another binary, which is non-trivial to calculate for these compiler-generated statics.

So, instead, the easiest thing to do is to make `__rust_alloc_error_handler_should_panic` a function instead.

Since `__rust_alloc_error_handler_should_panic` isn't involved in any linking shenanigans, I've marked it as `AlwaysInline` with the hopes that the various backends will see that it is just returning a constant and perform the same optimizations as the previous implementation.

r? `@bjorn3`
2025-07-04 16:22:36 +02:00
..
config Implement the internal feature cfg_target_has_reliable_f16_f128 2025-04-27 19:58:44 +00:00
code_stats.rs Document why CodeStats::type_sizes is public 2025-04-21 17:36:36 +02:00
config.rs Rollup merge of #143387 - dpaoliello:shouldpanicfn, r=bjorn3 2025-07-04 16:22:36 +02:00
cstore.rs Initial support for dynamically linked crates 2025-05-04 22:03:15 +03:00
errors.rs move -Ctarget-feature handling into shared code 2025-06-19 09:44:01 +09:00
filesearch.rs rustc_session: Add a structure for keeping both explicit and default sysroots 2025-06-24 16:00:04 +03:00
lib.rs move -Ctarget-feature handling into shared code 2025-06-19 09:44:01 +09:00
options.rs Rollup merge of #142809 - KMJ-007:ad-type-analysis-flag, r=ZuseZ4 2025-06-25 22:14:55 +02:00
output.rs Initial support for dynamically linked crates 2025-05-04 22:03:15 +03:00
parse.rs Extract SilentEmitter 2025-06-19 13:05:01 -05:00
search_paths.rs Greatly simplify lifetime captures in edition 2024 2025-02-22 22:24:52 +00:00
session.rs setup CI and tidy to use typos for spellchecking and fix few typos 2025-07-03 10:51:06 +03:00
utils.rs session: Cleanup CanonicalizedPath::new 2025-04-26 18:42:15 +03:00