-
Notifications
You must be signed in to change notification settings - Fork 94
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Allow different reprs to still work #687
Conversation
@jsdw please, can you also update the version to 3.7.2 ? |
Done! I have to head out now but if it's failing tests or anything I'll sort it out later or in the morning! |
} else { | ||
Err(syn::Error::new( | ||
discriminant.span(), | ||
"Discriminant must be an integer literal in the range 0..255", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Forcing this to be an integer is a breaking change.
Potential fix: #695
if index.is_none() { | ||
if let Some((_, Expr::Lit(ExprLit { lit: Lit::Int(disc_lit), .. }))) = &v.discriminant { | ||
index = disc_lit.base10_parse::<usize>().ok() | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is ignoring the discriminant when defined with an expression.
Don't output suffixes when generating the index array in the const fun, to avoid the suffix types from conflicting with the declared type of the index array (usize) which leads to compile errors when indexes are from discriminants and are not usizes.
Should fix #686