Skip to content

Commit

Permalink
Fix suffixes on tuple index
Browse files Browse the repository at this point in the history
  • Loading branch information
taiki-e committed Mar 30, 2019
1 parent daa47e2 commit 5f5cc35
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions src/unsafe_project/structs.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use proc_macro2::TokenStream;
use proc_macro2::{Literal, TokenStream};
use quote::{quote, ToTokens};
use syn::{Field, Fields, FieldsNamed, FieldsUnnamed, ItemStruct};

Expand Down Expand Up @@ -87,14 +87,15 @@ fn unnamed(
fields
.iter_mut()
.enumerate()
.for_each(|(n, Field { attrs, ty, .. })| {
.for_each(|(i, Field { attrs, ty, .. })| {
let i = Literal::usize_unsuffixed(i);
if attrs.find_remove(PIN) {
impl_unpin.push(ty);
proj_fields.push(quote!(::core::pin::Pin<&'__a mut #ty>));
proj_init.push(quote!(::core::pin::Pin::new_unchecked(&mut this.#n)));
proj_init.push(quote!(::core::pin::Pin::new_unchecked(&mut this.#i)));
} else {
proj_fields.push(quote!(&'__a mut #ty));
proj_init.push(quote!(&mut this.#n));
proj_init.push(quote!(&mut this.#i));
}
});

Expand Down

0 comments on commit 5f5cc35

Please sign in to comment.