@@ -133,37 +133,15 @@ macro_rules! thread_local {
133
133
// empty (base case for the recursion)
134
134
( ) => { } ;
135
135
136
- // process multiple declarations where the first one is private
137
- ( $( #[ $attr: meta] ) * static $name: ident: $t: ty = $init: expr; $( $rest: tt) * ) => (
138
- __thread_local_inner!( $( #[ $attr] ) * [ ] $name, $t, $init) ;
136
+ // process multiple declarations
137
+ ( $( #[ $attr: meta] ) * $vis : vis static $name: ident: $t: ty = $init: expr; $( $rest: tt) * ) => (
138
+ __thread_local_inner!( $( #[ $attr] ) * $vis $name, $t, $init) ;
139
139
thread_local!( $( $rest) * ) ;
140
140
) ;
141
141
142
- // handle a single private declaration
143
- ( $( #[ $attr: meta] ) * static $name: ident: $t: ty = $init: expr) => (
144
- __thread_local_inner!( $( #[ $attr] ) * [ ] $name, $t, $init) ;
145
- ) ;
146
-
147
- // handle multiple declarations where the first one is public
148
- ( $( #[ $attr: meta] ) * pub static $name: ident: $t: ty = $init: expr; $( $rest: tt) * ) => (
149
- __thread_local_inner!( $( #[ $attr] ) * [ pub ] $name, $t, $init) ;
150
- thread_local!( $( $rest) * ) ;
151
- ) ;
152
-
153
- // handle a single public declaration
154
- ( $( #[ $attr: meta] ) * pub static $name: ident: $t: ty = $init: expr) => (
155
- __thread_local_inner!( $( #[ $attr] ) * [ pub ] $name, $t, $init) ;
156
- ) ;
157
-
158
- // handle multiple declarations where the first one is restricted public
159
- ( $( #[ $attr: meta] ) * pub $vis: tt static $name: ident: $t: ty = $init: expr; $( $rest: tt) * ) => (
160
- __thread_local_inner!( $( #[ $attr] ) * [ pub $vis] $name, $t, $init) ;
161
- thread_local!( $( $rest) * ) ;
162
- ) ;
163
-
164
- // handle a single restricted public declaration
165
- ( $( #[ $attr: meta] ) * pub $vis: tt static $name: ident: $t: ty = $init: expr) => (
166
- __thread_local_inner!( $( #[ $attr] ) * [ pub $vis] $name, $t, $init) ;
142
+ // handle a single declaration
143
+ ( $( #[ $attr: meta] ) * $vis: vis static $name: ident: $t: ty = $init: expr) => (
144
+ __thread_local_inner!( $( #[ $attr] ) * $vis $name, $t, $init) ;
167
145
) ;
168
146
}
169
147
@@ -174,8 +152,8 @@ macro_rules! thread_local {
174
152
#[ macro_export]
175
153
#[ allow_internal_unstable]
176
154
macro_rules! __thread_local_inner {
177
- ( $( #[ $attr: meta] ) * [ $ ( $ vis: tt ) * ] $name: ident, $t: ty, $init: expr) => {
178
- $( #[ $attr] ) * $( $ vis) * static $name: $crate:: thread:: LocalKey <$t> = {
155
+ ( $( #[ $attr: meta] ) * $ vis: vis $name: ident, $t: ty, $init: expr) => {
156
+ $( #[ $attr] ) * $vis static $name: $crate:: thread:: LocalKey <$t> = {
179
157
fn __init( ) -> $t { $init }
180
158
181
159
fn __getit( ) -> $crate:: option:: Option <
0 commit comments