@@ -361,7 +361,7 @@ macro_rules! quick_error {
361
361
=> $iitem: $imode [ $( $ivar: $ityp ) ,* ] ) * ]
362
362
) ;
363
363
quick_error!( IMPLEMENTATIONS $name { $(
364
- $iitem: $imode [ $( $ivar: $ityp ) ,* ] { $( $ifuncs ) * }
364
+ $iitem: $imode [ $( # [ $imeta ] ) * ] [ $ ( $ivar: $ityp ) ,* ] { $( $ifuncs ) * }
365
365
) * } ) ;
366
366
$(
367
367
quick_error!( ERROR_CHECK $imode $( $ifuncs) * ) ;
@@ -380,7 +380,7 @@ macro_rules! quick_error {
380
380
=> $iitem: $imode [ $( $ivar: $ityp ) ,* ] ) * ]
381
381
) ;
382
382
quick_error!( IMPLEMENTATIONS $name { $(
383
- $iitem: $imode [ $( $ivar: $ityp ) ,* ] { $( $ifuncs ) * }
383
+ $iitem: $imode [ $( # [ $imeta ] ) * ] [ $ ( $ivar: $ityp ) ,* ] { $( $ifuncs ) * }
384
384
) * } ) ;
385
385
$(
386
386
quick_error!( ERROR_CHECK $imode $( $ifuncs) * ) ;
@@ -585,7 +585,7 @@ macro_rules! quick_error {
585
585
} ;
586
586
( IMPLEMENTATIONS
587
587
$name: ident { $(
588
- $item: ident: $imode: tt [ $( $var: ident: $typ: ty ) ,* ] { $( $funcs: tt ) * }
588
+ $item: ident: $imode: tt [ $( # [ $imeta : meta ] ) * ] [ $ ( $var: ident: $typ: ty ) ,* ] { $( $funcs: tt ) * }
589
589
) * }
590
590
) => {
591
591
#[ allow( unused) ]
@@ -595,6 +595,7 @@ macro_rules! quick_error {
595
595
{
596
596
match * self {
597
597
$(
598
+ $( #[ $imeta] ) *
598
599
quick_error!( ITEM_PATTERN
599
600
$name $item: $imode [ $( ref $var ) ,* ]
600
601
) => {
@@ -613,6 +614,7 @@ macro_rules! quick_error {
613
614
fn description( & self ) -> & str {
614
615
match * self {
615
616
$(
617
+ $( #[ $imeta] ) *
616
618
quick_error!( ITEM_PATTERN
617
619
$name $item: $imode [ $( ref $var ) ,* ]
618
620
) => {
@@ -626,6 +628,7 @@ macro_rules! quick_error {
626
628
fn cause( & self ) -> Option <& :: std:: error:: Error > {
627
629
match * self {
628
630
$(
631
+ $( #[ $imeta] ) *
629
632
quick_error!( ITEM_PATTERN
630
633
$name $item: $imode [ $( ref $var ) ,* ]
631
634
) => {
@@ -1224,4 +1227,16 @@ mod test {
1224
1227
assert ! ( etext. starts_with(
1225
1228
"Path error at \" /tmp\" : invalid utf-8" ) ) ;
1226
1229
}
1230
+
1231
+ #[ test]
1232
+ fn conditional_compilation ( ) {
1233
+ quick_error ! {
1234
+ #[ allow( dead_code) ]
1235
+ #[ derive( Debug ) ]
1236
+ pub enum Test {
1237
+ #[ cfg( feature = "foo" ) ]
1238
+ Variant
1239
+ }
1240
+ }
1241
+ }
1227
1242
}
0 commit comments