@@ -137,9 +137,6 @@ impl<T: 'static> fmt::Debug for LocalKey<T> {
137137#[ unstable( feature = "thread_local_internals" , issue = "none" ) ]
138138#[ rustc_macro_transparency = "semitransparent" ]
139139pub macro thread_local_process_attrs {
140- // Base case for recursion:
141- ( [ ] [ ] ; ) => ( ) ,
142-
143140 // Separate attributes into `rustc_align_static` and everything else:
144141
145142 // `rustc_align_static` attribute
@@ -219,26 +216,16 @@ pub macro thread_local_process_attrs {
219216
220217 // Delegate to `thread_local_inner` once attributes are fully categorized:
221218
222- // process multiple declarations, starting with a `const` one
223- ( [ $( $align_attrs: tt) * ] [ $( $other_attrs: tt) * ] ; $vis: vis static $name: ident: $t: ty = const $init: block; $( $rest: tt) * ) => (
224- $crate:: thread:: local_impl:: thread_local_inner!( $( $other_attrs) * $vis $name, $t, $( $align_attrs) * , const $init) ;
225- $crate:: thread:: local_impl:: thread_local_process_attrs!( [ ] [ ] ; $( $rest) * ) ;
226- ) ,
227-
228- // handle a single `const` declaration
229- ( [ $( $align_attrs: tt) * ] [ $( $other_attrs: tt) * ] ; $vis: vis static $name: ident: $t: ty = const $init: block) => (
219+ // process `const` declaration and recurse
220+ ( [ $( $align_attrs: tt) * ] [ $( $other_attrs: tt) * ] ; $vis: vis static $name: ident: $t: ty = const $init: block $( ; $( $( $rest: tt) +) ?) ?) => (
230221 $crate:: thread:: local_impl:: thread_local_inner!( $( $other_attrs) * $vis $name, $t, $( $align_attrs) * , const $init) ;
222+ $( $( $crate:: thread:: local_impl:: thread_local_process_attrs!( [ ] [ ] ; $( $rest) +) ; ) ?) ?
231223 ) ,
232224
233- // process multiple declarations, starting with a non-`const` one
234- ( [ $( $align_attrs: tt) * ] [ $( $other_attrs: tt) * ] ; $vis: vis static $name: ident: $t: ty = $init: expr; $( $rest: tt) * ) => (
235- $crate:: thread:: local_impl:: thread_local_inner!( $( $other_attrs) * $vis $name, $t, $( $align_attrs) * , $init) ;
236- $crate:: thread:: local_impl:: thread_local_process_attrs!( [ ] [ ] ; $( $rest) * ) ;
237- ) ,
238-
239- // handle a single non-`const` declaration
240- ( [ $( $align_attrs: tt) * ] [ $( $other_attrs: tt) * ] ; $vis: vis static $name: ident: $t: ty = $init: expr) => (
225+ // process non-`const` declaration and recurse
226+ ( [ $( $align_attrs: tt) * ] [ $( $other_attrs: tt) * ] ; $vis: vis static $name: ident: $t: ty = $init: expr $( ; $( $( $rest: tt) +) ?) ?) => (
241227 $crate:: thread:: local_impl:: thread_local_inner!( $( $other_attrs) * $vis $name, $t, $( $align_attrs) * , $init) ;
228+ $( $( $crate:: thread:: local_impl:: thread_local_process_attrs!( [ ] [ ] ; $( $rest) +) ; ) ?) ?
242229 ) ,
243230}
244231
@@ -292,8 +279,10 @@ pub macro thread_local_process_attrs {
292279#[ cfg_attr ( not ( test) , rustc_diagnostic_item = "thread_local_macro" ) ]
293280#[ allow_internal_unstable ( thread_local_internals) ]
294281macro_rules! thread_local {
295- ( $( $tt: tt) * ) => {
296- $crate:: thread:: local_impl:: thread_local_process_attrs!( [ ] [ ] ; $( $tt) * ) ;
282+ ( ) => { } ;
283+
284+ ( $( $tt: tt) +) => {
285+ $crate:: thread:: local_impl:: thread_local_process_attrs!( [ ] [ ] ; $( $tt) +) ;
297286 } ;
298287}
299288
0 commit comments