Skip to content

Commit

Permalink
Unrolled build for rust-lang#128005
Browse files Browse the repository at this point in the history
Rollup merge of rust-lang#128005 - ChrisDenton:msvc-include, r=joboet

Remove _tls_used hack

All the MSVC targets use `target_thread_locals` (see the [base spec](https://github.com/rust-lang/rust/blob/1afc5fd042f7583b9668dd62be98325487483d1c/compiler/rustc_target/src/spec/base/windows_msvc.rs#L34)) so this hack is no longer needed. The compiler will ensure that thread locals work properly.
  • Loading branch information
rust-timer authored Jul 21, 2024
2 parents c1a631d + af735f3 commit 3ec2810
Showing 1 changed file with 0 additions and 13 deletions.
13 changes: 0 additions & 13 deletions library/std/src/sys/thread_local/guard/windows.rs
Original file line number Diff line number Diff line change
Expand Up @@ -78,19 +78,6 @@ pub fn enable() {
pub static CALLBACK: unsafe extern "system" fn(*mut c_void, u32, *mut c_void) = tls_callback;

unsafe extern "system" fn tls_callback(_h: *mut c_void, dw_reason: u32, _pv: *mut c_void) {
// See comments above for what this is doing. Note that we don't need this
// trickery on GNU windows, just on MSVC.
#[cfg(all(target_env = "msvc", not(target_thread_local)))]
{
extern "C" {
static _tls_used: u8;
}

unsafe {
ptr::from_ref(&_tls_used).read_volatile();
}
}

if dw_reason == c::DLL_THREAD_DETACH || dw_reason == c::DLL_PROCESS_DETACH {
#[cfg(target_thread_local)]
unsafe {
Expand Down

0 comments on commit 3ec2810

Please sign in to comment.