about summary refs log tree commit diff
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2022-08-15 23:57:44 +0000
committerbors <bors@rust-lang.org>2022-08-15 23:57:44 +0000
commit3694b7d307b7516757651952b30bb97b6ba5c049 (patch)
tree72199a3c9cf7fab6619532203c6392a20b8f7d1f
parent40336865fe7d4a01139a3336639c6971647e885c (diff)
parent847f4613e0a60ce657924439f9339706911bbfab (diff)
downloadrust-3694b7d307b7516757651952b30bb97b6ba5c049.tar.gz
rust-3694b7d307b7516757651952b30bb97b6ba5c049.zip
Auto 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`
-rw-r--r--library/std/src/sys/windows/thread_local_dtor.rs4
1 files changed, 4 insertions, 0 deletions
diff --git a/library/std/src/sys/windows/thread_local_dtor.rs b/library/std/src/sys/windows/thread_local_dtor.rs
index 25d1c6e8e87..9707a95dff2 100644
--- a/library/std/src/sys/windows/thread_local_dtor.rs
+++ b/library/std/src/sys/windows/thread_local_dtor.rs
@@ -8,10 +8,14 @@
 #[thread_local]
 static mut DESTRUCTORS: Vec<(*mut u8, unsafe extern "C" fn(*mut u8))> = Vec::new();
 
+// Ensure this can never be inlined because otherwise this may break in dylibs.
+// See #44391.
+#[inline(never)]
 pub unsafe fn register_dtor(t: *mut u8, dtor: unsafe extern "C" fn(*mut u8)) {
     DESTRUCTORS.push((t, dtor));
 }
 
+#[inline(never)] // See comment above
 /// Runs destructors. This should not be called until thread exit.
 pub unsafe fn run_keyless_dtors() {
     // Drop all the destructors.