rust/library/alloc/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
..
boxed library: Use size_of from the prelude instead of imported 2025-03-06 20:20:38 -08:00
collections BTreeSet: remove duplicated code by reusing from_sorted_iter 2025-06-27 11:12:32 -07:00
ffi Rollup merge of #137268 - bjoernager:c-string-eq-c-str, r=Amanieu 2025-06-24 15:39:37 +02:00
raw_vec Simplify Vec::as_non_null implementation and make it const 2025-05-05 21:56:33 +02:00
vec Auto merge of #143338 - matthiaskrgr:rollup-ykaxh04, r=matthiaskrgr 2025-07-02 23:29:03 +00:00
alloc.rs Make __rust_alloc_error_handler_should_panic a function 2025-07-03 10:52:21 -07:00
borrow.rs Fully test the alloc crate through alloctests 2025-03-07 19:11:13 +00:00
boxed.rs Remove PointerLike trait 2025-07-03 20:03:49 +00:00
bstr.rs Fully test the alloc crate through alloctests 2025-03-07 19:11:13 +00:00
fmt.rs Fix typo in documentation 2025-04-12 22:26:38 +08:00
lib.miri.rs add 'x.py miri', and make it work for 'library/{core,alloc,std}' 2024-04-03 20:27:20 +02:00
lib.rs Remove PointerLike trait 2025-07-03 20:03:49 +00:00
macros.rs Streamline the format macro. 2025-04-28 06:56:13 +10:00
rc.rs Change {Box,Arc,Rc,Weak}::into_raw to only work with A = Global 2025-07-01 18:25:30 +02:00
slice.rs remove extraneous text 2025-06-06 06:39:51 +02:00
str.rs remove extraneous text 2025-06-06 06:39:51 +02:00
string.rs Auto merge of #142728 - kornelski:string-track, r=tgross35 2025-06-22 23:30:10 +00:00
sync.rs Change {Box,Arc,Rc,Weak}::into_raw to only work with A = Global 2025-07-01 18:25:30 +02:00
task.rs Stabilize noop_waker 2024-12-05 14:14:17 -08:00