@@ -9,8 +9,8 @@ use std::str::FromStr;
9
9
use proc_macro2:: { Ident , Span , TokenStream } ;
10
10
use quote:: { quote, ToTokens } ;
11
11
use syn:: {
12
- parse_macro_input, AttrStyle , Attribute , Data , DeriveInput , Expr , Fields , Meta , NestedMeta ,
13
- Type , TypeGenerics , TypePath ,
12
+ parse_macro_input, AttrStyle , Attribute , Data , DeriveInput , Expr , Fields , Index ,
13
+ Meta , NestedMeta , Type , TypeGenerics , TypePath ,
14
14
} ;
15
15
16
16
#[ proc_macro_derive( H5Type ) ]
@@ -146,11 +146,12 @@ fn impl_trait(
146
146
impl_compound ( ty, ty_generics, & fields, & names, & types)
147
147
}
148
148
Fields :: Unnamed ( ref fields) => {
149
- let ( index, fields) : ( Vec < usize > , Vec < _ > ) = fields
149
+ let ( index, fields) : ( Vec < Index > , Vec < _ > ) = fields
150
150
. unnamed
151
151
. iter ( )
152
152
. enumerate ( )
153
153
. filter ( |& ( _, f) | !is_phantom_data ( & f. ty ) )
154
+ . map ( |( i, f) | ( Index :: from ( i) , f) )
154
155
. unzip ( ) ;
155
156
if fields. is_empty ( ) {
156
157
panic ! ( "Cannot derive H5Type for empty tuple structs" ) ;
0 commit comments