diff options
| author | Jules Bertholet <julesbertholet@quoi.xyz> | 2025-09-27 15:47:06 -0400 |
|---|---|---|
| committer | Jules Bertholet <julesbertholet@quoi.xyz> | 2025-09-27 17:05:39 -0400 |
| commit | 4d32b9a1783343d42a9864fe3d2115daa2cb425e (patch) | |
| tree | 508fe80b63530b51d3a6bfbe0a044ec4ac2a1627 /library/std/src/thread | |
| parent | a4e87e940620bc0e61caa7c42b1edc53c0aee7cb (diff) | |
| download | rust-4d32b9a1783343d42a9864fe3d2115daa2cb425e.tar.gz rust-4d32b9a1783343d42a9864fe3d2115daa2cb425e.zip | |
Hoist non-platform-specific code out of `thread_local_inner!`
Diffstat (limited to 'library/std/src/thread')
| -rw-r--r-- | library/std/src/thread/local.rs | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/library/std/src/thread/local.rs b/library/std/src/thread/local.rs index 70df7e724ca..4259a4d1f3b 100644 --- a/library/std/src/thread/local.rs +++ b/library/std/src/thread/local.rs @@ -327,13 +327,17 @@ pub macro thread_local_process_attrs { // process `const` declaration and recurse ([$($align_attrs:tt)*] [$($other_attrs:tt)*]; $vis:vis static $name:ident: $t:ty = const $init:block $(; $($($rest:tt)+)?)?) => ( - $crate::thread::local_impl::thread_local_inner!($($other_attrs)* $vis $name, $t, $($align_attrs)*, const $init); + $($other_attrs)* $vis const $name: $crate::thread::LocalKey<$t> = + $crate::thread::local_impl::thread_local_inner!(@key $t, $($align_attrs)*, const $init); + $($($crate::thread::local_impl::thread_local_process_attrs!([] []; $($rest)+);)?)? ), // process non-`const` declaration and recurse ([$($align_attrs:tt)*] [$($other_attrs:tt)*]; $vis:vis static $name:ident: $t:ty = $init:expr $(; $($($rest:tt)+)?)?) => ( - $crate::thread::local_impl::thread_local_inner!($($other_attrs)* $vis $name, $t, $($align_attrs)*, $init); + $($other_attrs)* $vis const $name: $crate::thread::LocalKey<$t> = + $crate::thread::local_impl::thread_local_inner!(@key $t, $($align_attrs)*, $init); + $($($crate::thread::local_impl::thread_local_process_attrs!([] []; $($rest)+);)?)? ), } |
