diff --git a/lib/dnsbox-derive/src/dns_packet_data.rs b/lib/dnsbox-derive/src/dns_packet_data.rs index dcd07cf..02754f4 100644 --- a/lib/dnsbox-derive/src/dns_packet_data.rs +++ b/lib/dnsbox-derive/src/dns_packet_data.rs @@ -54,6 +54,7 @@ fn derive_unnamed(s: &synstructure::Structure, fields: &syn::FieldsUnnamed) -> T let mut parse_fields = quote!{}; let mut serialize_fields = quote!{}; for field in 0..fields.unnamed.len() { + let field = syn::Index::from(field); parse_fields.extend(quote!{ DnsPacketData::deserialize(_data) .with_context(|e| format!("failed parsing field {}::{}: {}", stringify!(#name), #field, e))?, diff --git a/lib/dnsbox-derive/src/dns_text_data.rs b/lib/dnsbox-derive/src/dns_text_data.rs index dad620a..83f3b35 100644 --- a/lib/dnsbox-derive/src/dns_text_data.rs +++ b/lib/dnsbox-derive/src/dns_text_data.rs @@ -53,6 +53,7 @@ fn derive_unnamed(s: &synstructure::Structure, fields: &syn::FieldsUnnamed) -> T let mut parse_fields = quote!{}; let mut format_fields = quote!{}; for field in 0..fields.unnamed.len() { + let field = syn::Index::from(field); parse_fields.extend(quote!{ DnsTextData::dns_parse(_context, _data) .with_context(|e| format!("failed parsing field {}::{}: {}", stringify!(#name), #field, e))?,