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