Skip to content

Commit

Permalink
Merge pull request #25 from dtolnay/alignpacked
Browse files Browse the repository at this point in the history
Ignore certain unrelated reprs
  • Loading branch information
dtolnay authored Oct 30, 2023
2 parents 8a6b642 + cccb6a7 commit f92f946
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions src/parse.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use proc_macro2::{Span, TokenTree};
use proc_macro2::{Span, TokenStream, TokenTree};
use syn::parse::{Error, Parse, ParseStream, Result};
use syn::{token, Attribute, Data, DeriveInput, Expr, Fields, Ident, Meta, Token};
use syn::{parenthesized, token, Attribute, Data, DeriveInput, Expr, Fields, Ident, Meta, Token};

pub struct Input {
pub ident: Ident,
Expand Down Expand Up @@ -96,6 +96,14 @@ impl Parse for Input {
repr = Some(meta.path.get_ident().unwrap().clone());
return Ok(());
}
if meta.path.is_ident("align") || meta.path.is_ident("packed") {
if meta.input.peek(token::Paren) {
let arg;
parenthesized!(arg in meta.input);
let _ = arg.parse::<TokenStream>()?;
}
return Ok(());
}
Err(meta.error("unsupported repr for serde_repr enum"))
})?;
}
Expand Down

0 comments on commit f92f946

Please sign in to comment.