@@ -139,37 +139,15 @@ macro_rules! thread_local {
139139 // empty (base case for the recursion)
140140 ( ) => { } ;
141141
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) ;
145145 thread_local!( $( $rest) * ) ;
146146 ) ;
147147
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) ;
173151 ) ;
174152}
175153
@@ -180,8 +158,8 @@ macro_rules! thread_local {
180158#[ macro_export]
181159#[ allow_internal_unstable]
182160macro_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> = {
185163 fn __init( ) -> $t { $init }
186164
187165 fn __getit( ) -> $crate:: option:: Option <
0 commit comments