Skip to content

Commit ad4c4f4

Browse files
committed
Remove _tls_used trickery unless needed
1 parent 2fc091f commit ad4c4f4

File tree

1 file changed

+2
-5
lines changed

1 file changed

+2
-5
lines changed

library/std/src/sys/pal/windows/thread_local_key.rs

+2-5
Original file line numberDiff line numberDiff line change
@@ -295,16 +295,13 @@ unsafe extern "system" fn on_tls_callback(_h: c::LPVOID, dwReason: c::DWORD, _pv
295295

296296
// See comments above for what this is doing. Note that we don't need this
297297
// trickery on GNU windows, just on MSVC.
298-
reference_tls_used();
299-
#[cfg(target_env = "msvc")]
300-
unsafe fn reference_tls_used() {
298+
#[cfg(all(target_env = "msvc", not(target_thread_local)))]
299+
{
301300
extern "C" {
302301
static _tls_used: u8;
303302
}
304303
crate::intrinsics::volatile_load(&_tls_used);
305304
}
306-
#[cfg(not(target_env = "msvc"))]
307-
unsafe fn reference_tls_used() {}
308305
}
309306

310307
#[cfg(not(target_thread_local))]

0 commit comments

Comments
 (0)