Rollup merge of #91355 - alexcrichton:stabilize-thread-local-const, r=m-ou-se
std: Stabilize the `thread_local_const_init` feature This commit is intended to follow the stabilization disposition of the FCP that has now finished in #84223. This stabilizes the ability to flag thread local initializers as `const` expressions which enables the macro to generate more efficient code for accessing it, notably removing runtime checks for initialization. More information can also be found in #84223 as well as the tests where the feature usage was removed in this PR. Closes #84223
This commit is contained in:
@@ -178,7 +178,6 @@ macro_rules! __thread_local_inner {
|
||||
(@key $t:ty, const $init:expr) => {{
|
||||
#[cfg_attr(not(windows), inline)] // see comments below
|
||||
unsafe fn __getit() -> $crate::option::Option<&'static $t> {
|
||||
const _REQUIRE_UNSTABLE: () = $crate::thread::require_unstable_const_init_thread_local();
|
||||
const INIT_EXPR: $t = $init;
|
||||
|
||||
// wasm without atomics maps directly to `static mut`, and dtors
|
||||
|
||||
@@ -204,13 +204,6 @@ pub use self::local::os::Key as __OsLocalKeyInner;
|
||||
#[doc(hidden)]
|
||||
pub use self::local::statik::Key as __StaticLocalKeyInner;
|
||||
|
||||
// This is only used to make thread locals with `const { .. }` initialization
|
||||
// expressions unstable. If and/or when that syntax is stabilized with thread
|
||||
// locals this will simply be removed.
|
||||
#[doc(hidden)]
|
||||
#[unstable(feature = "thread_local_const_init", issue = "84223")]
|
||||
pub const fn require_unstable_const_init_thread_local() {}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// Builder
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
Reference in New Issue
Block a user