Skip to content

Commit 847f461

Browse files
committed
Never inline Windows dtor access
1 parent f9cba63 commit 847f461

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)