From 641d3b09f41b441f2c2618de32983ad3d13ea3f8 Mon Sep 17 00:00:00 2001 From: Alex Crichton Date: Mon, 3 May 2021 11:39:10 -0700 Subject: std: Attempt again to inline thread-local-init across crates Issue #25088 has been part of `thread_local!` for quite some time now. Historical attempts have been made to add `#[inline]` to `__getit` in #43931, #50252, and #59720, but these attempts ended up not landing at the time due to segfaults on Windows. In the interim though with `const`-initialized thread locals AFAIK this is the only remaining bug which is why you might want to use `#[thread_local]` over `thread_local!`. As a result I figured it was time to resubmit this and see how it fares on CI and if I can help debugging any issues that crop up. Closes #25088 --- src/test/codegen/auxiliary/thread_local_aux.rs | 6 ++++++ 1 file changed, 6 insertions(+) create mode 100644 src/test/codegen/auxiliary/thread_local_aux.rs (limited to 'src/test/codegen/auxiliary') diff --git a/src/test/codegen/auxiliary/thread_local_aux.rs b/src/test/codegen/auxiliary/thread_local_aux.rs new file mode 100644 index 00000000000..29b5e3ca244 --- /dev/null +++ b/src/test/codegen/auxiliary/thread_local_aux.rs @@ -0,0 +1,6 @@ +#![crate_type = "lib"] +#![feature(thread_local_const_init)] + +use std::cell::Cell; + +thread_local!(pub static A: Cell = const { Cell::new(0) }); -- cgit 1.4.1-3-g733a5