about summary refs log tree commit diff
path: root/compiler/rustc_parse/src
diff options
context:
space:
mode:
authorMatthias Krüger <476013+matthiaskrgr@users.noreply.github.com>2025-07-04 16:22:36 +0200
committerGitHub <noreply@github.com>2025-07-04 16:22:36 +0200
commit2faf66d091b071a0c3ceb510a184b33f2214a7b2 (patch)
treed4787f6cf323111142d8f0a13e6fb93dbd2a239a /compiler/rustc_parse/src
parent18b374d5a7d947ef4c817280991da8d0ce207d31 (diff)
parent2b22d0f0d2b9d0d71025065db93058e34f846600 (diff)
downloadrust-2faf66d091b071a0c3ceb510a184b33f2214a7b2.tar.gz
rust-2faf66d091b071a0c3ceb510a184b33f2214a7b2.zip
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`
Diffstat (limited to 'compiler/rustc_parse/src')
0 files changed, 0 insertions, 0 deletions