@@ -292,7 +292,7 @@ macro_rules! quick_error {
292
292
=> $iitem: $imode [ $( $ivar: $ityp ) ,* ] ) * ]
293
293
) ;
294
294
quick_error!( IMPLEMENTATIONS $name { $(
295
- $iitem: $imode [ $( $ivar: $ityp ) ,* ] { $( $ifuncs ) * }
295
+ $iitem: $imode [ $( # [ $imeta ] ) * ] [ $ ( $ivar: $ityp ) ,* ] { $( $ifuncs ) * }
296
296
) * } ) ;
297
297
$(
298
298
quick_error!( ERROR_CHECK $imode $( $ifuncs) * ) ;
@@ -311,7 +311,7 @@ macro_rules! quick_error {
311
311
=> $iitem: $imode [ $( $ivar: $ityp ) ,* ] ) * ]
312
312
) ;
313
313
quick_error!( IMPLEMENTATIONS $name { $(
314
- $iitem: $imode [ $( $ivar: $ityp ) ,* ] { $( $ifuncs ) * }
314
+ $iitem: $imode [ $( # [ $imeta ] ) * ] [ $ ( $ivar: $ityp ) ,* ] { $( $ifuncs ) * }
315
315
) * } ) ;
316
316
$(
317
317
quick_error!( ERROR_CHECK $imode $( $ifuncs) * ) ;
@@ -516,7 +516,7 @@ macro_rules! quick_error {
516
516
} ;
517
517
( IMPLEMENTATIONS
518
518
$name: ident { $(
519
- $item: ident: $imode: tt [ $( $var: ident: $typ: ty ) ,* ] { $( $funcs: tt ) * }
519
+ $item: ident: $imode: tt [ $( # [ $imeta : meta ] ) * ] [ $ ( $var: ident: $typ: ty ) ,* ] { $( $funcs: tt ) * }
520
520
) * }
521
521
) => {
522
522
#[ allow( unused) ]
@@ -526,6 +526,7 @@ macro_rules! quick_error {
526
526
{
527
527
match * self {
528
528
$(
529
+ $( #[ $imeta] ) *
529
530
quick_error!( ITEM_PATTERN
530
531
$name $item: $imode [ $( ref $var ) ,* ]
531
532
) => {
@@ -544,6 +545,7 @@ macro_rules! quick_error {
544
545
fn description( & self ) -> & str {
545
546
match * self {
546
547
$(
548
+ $( #[ $imeta] ) *
547
549
quick_error!( ITEM_PATTERN
548
550
$name $item: $imode [ $( ref $var ) ,* ]
549
551
) => {
@@ -557,6 +559,7 @@ macro_rules! quick_error {
557
559
fn cause( & self ) -> Option <& :: std:: error:: Error > {
558
560
match * self {
559
561
$(
562
+ $( #[ $imeta] ) *
560
563
quick_error!( ITEM_PATTERN
561
564
$name $item: $imode [ $( ref $var ) ,* ]
562
565
) => {
@@ -1131,4 +1134,16 @@ mod test {
1131
1134
"Path error at \" /tmp\" : invalid utf-8: \
1132
1135
invalid byte near index 0") ;
1133
1136
}
1137
+
1138
+ #[ test]
1139
+ fn conditional_compilation ( ) {
1140
+ quick_error ! {
1141
+ #[ allow( dead_code) ]
1142
+ #[ derive( Debug ) ]
1143
+ pub enum Test {
1144
+ #[ cfg( feature = "foo" ) ]
1145
+ Variant
1146
+ }
1147
+ }
1148
+ }
1134
1149
}
0 commit comments