@@ -181,7 +181,7 @@ macro_rules! thread_local {
181181macro_rules! __thread_local_inner {
182182 // used to generate the `LocalKey` value for const-initialized thread locals
183183 ( @key $t: ty, const $init: expr) => { {
184- #[ cfg_attr( not( windows ) , inline) ] // see comments below
184+ #[ cfg_attr( not( bootstrap ) , inline) ]
185185 #[ deny( unsafe_op_in_unsafe_fn) ]
186186 unsafe fn __getit(
187187 _init: $crate:: option:: Option <& mut $crate:: option:: Option <$t>>,
@@ -293,29 +293,7 @@ macro_rules! __thread_local_inner {
293293 #[ inline]
294294 fn __init( ) -> $t { $init }
295295
296- // When reading this function you might ask "why is this inlined
297- // everywhere other than Windows?", and that's a very reasonable
298- // question to ask. The short story is that it segfaults rustc if
299- // this function is inlined. The longer story is that Windows looks
300- // to not support `extern` references to thread locals across DLL
301- // boundaries. This appears to at least not be supported in the ABI
302- // that LLVM implements.
303- //
304- // Because of this we never inline on Windows, but we do inline on
305- // other platforms (where external references to thread locals
306- // across DLLs are supported). A better fix for this would be to
307- // inline this function on Windows, but only for "statically linked"
308- // components. For example if two separately compiled rlibs end up
309- // getting linked into a DLL then it's fine to inline this function
310- // across that boundary. It's only not fine to inline this function
311- // across a DLL boundary. Unfortunately rustc doesn't currently
312- // have this sort of logic available in an attribute, and it's not
313- // clear that rustc is even equipped to answer this (it's more of a
314- // Cargo question kinda). This means that, unfortunately, Windows
315- // gets the pessimistic path for now where it's never inlined.
316- //
317- // The issue of "should enable on Windows sometimes" is #84933
318- #[ cfg_attr( not( windows) , inline) ]
296+ #[ cfg_attr( not( bootstrap) , inline) ]
319297 unsafe fn __getit(
320298 init: $crate:: option:: Option <& mut $crate:: option:: Option <$t>>,
321299 ) -> $crate:: option:: Option <& ' static $t> {
0 commit comments