Skip to content

Commit

Permalink
Use syn::Index for indexing tuple structs
Browse files Browse the repository at this point in the history
quote generates a TokenStream with a suffix for integers (e.g. 0usize).
Suffixes are not allowed for indexing tuples.

See rust-lang/rust#59553
  • Loading branch information
timsueberkrueb committed Apr 23, 2019
1 parent 2adcb11 commit 2272334
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion visit/src/codegen.rs
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,8 @@ impl<'ast, 'cgen> CodeGenerator<'ast, 'cgen> {
.unnamed
.iter()
.enumerate()
.map(|(i, _)| quote! { #i })
.map(|(i, _)| syn::Index::from(i))
.map(|idx| quote! { #idx })
.collect(),
syn::Fields::Unit => Vec::new(),
};
Expand Down

0 comments on commit 2272334

Please sign in to comment.