Skip to content

Commit 27978f9

Browse files
committed
hdf5-derive: use syn::Index for tuple structs
rust-lang/rust#60210
1 parent 2629453 commit 27978f9

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

hdf5-derive/src/lib.rs

+4-3
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@ use std::str::FromStr;
99
use proc_macro2::{Ident, Span, TokenStream};
1010
use quote::{quote, ToTokens};
1111
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,
1414
};
1515

1616
#[proc_macro_derive(H5Type)]
@@ -146,11 +146,12 @@ fn impl_trait(
146146
impl_compound(ty, ty_generics, &fields, &names, &types)
147147
}
148148
Fields::Unnamed(ref fields) => {
149-
let (index, fields): (Vec<usize>, Vec<_>) = fields
149+
let (index, fields): (Vec<Index>, Vec<_>) = fields
150150
.unnamed
151151
.iter()
152152
.enumerate()
153153
.filter(|&(_, f)| !is_phantom_data(&f.ty))
154+
.map(|(i, f)| (Index::from(i), f))
154155
.unzip();
155156
if fields.is_empty() {
156157
panic!("Cannot derive H5Type for empty tuple structs");

0 commit comments

Comments
 (0)