Skip to content

Commit 5b2ad6e

Browse files
authored
Rollup merge of #100007 - ChrisDenton:dtor-inline-never, r=michaelwoerister
Never inline Windows dtor access Inlining can cause problem If used in a Rust dylib. See #44391. r? `@Mark-Simulacrum`
2 parents 72d0be4 + 847f461 commit 5b2ad6e

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

library/std/src/sys/windows/thread_local_dtor.rs

+4
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,14 @@
88
#[thread_local]
99
static mut DESTRUCTORS: Vec<(*mut u8, unsafe extern "C" fn(*mut u8))> = Vec::new();
1010

11+
// Ensure this can never be inlined because otherwise this may break in dylibs.
12+
// See #44391.
13+
#[inline(never)]
1114
pub unsafe fn register_dtor(t: *mut u8, dtor: unsafe extern "C" fn(*mut u8)) {
1215
DESTRUCTORS.push((t, dtor));
1316
}
1417

18+
#[inline(never)] // See comment above
1519
/// Runs destructors. This should not be called until thread exit.
1620
pub unsafe fn run_keyless_dtors() {
1721
// Drop all the destructors.

0 commit comments

Comments
 (0)