Reduce required sym features - #144
Merged
Merged
Conversation
`DeriveInput` covers everything the macro needs (attrs, vis, ident and the variants), but unlike `ItemEnum` it doesn't require `syn`s full feature. Applying #[bitenum] to a struct or union now reports a dedicated error instead of syn's generic "expected `enum`", spanned at the struct/union keyword.
The elements are re-tokenized and fed back into parse_argument_tokens anyway, so all this needed was a split at the top-level commas. syn::ExprArray requires the "full" feature. A group with the wrong delimiter, e.g. #[bits((0..=1), rw)], now reports an error rather than panicking in the unwrap that used to be here.
danlehmann
force-pushed
the
reduce-sym-features
branch
from
August 26, 2026 20:30
03b1b0a to
76a286e
Compare
- Reject genuinely empty elements in bit-range arrays (e.g. [0..=1,, 4..=5] or [,0..=1]) with a dedicated error instead of silently ignoring them; a trailing comma remains allowed. - Give delimiter-specific error messages when bit-ranges are wrapped in the wrong delimiters (parentheses, braces) instead of a generic message.
Covers the error messages introduced when #[bitenum] started parsing its input as a DeriveInput and bit-range arrays stopped being parsed via ExprArray: - #[bitenum] on a struct or a union reports a dedicated 'can only be applied to an enum' error, and the original item is still emitted (both tests reference the item, so a regression that dropped it would add a missing-type error and fail the test). - Non-bracket delimiters (e.g. (0..=1)) or empty elements (e.g. [0..=1,, 4..=5]) in bit-range arrays are rejected with a clear message.
bitbybit now depends on syn 3, but the committed lockfile for the excluded-from-workspace qemu-tests crate still pinned syn 2.0.104, so the build-no-std CI job would silently rewrite the lockfile on every build. Regenerate it: bitbybit resolves to syn 3.0.4 while the remaining crates (defmt-macros, cortex-m-rt, ...) stay on syn 2.0.119 as a separate version.
Describe the user-visible changes of PR danlehmann#144: the syn 3 upgrade (with the dropped 'full' feature) which has no API impact, the dedicated #[bitenum] error for non-enums, and the clearer bit-range array errors that replace a proc-macro panic.
danlehmann
approved these changes
Aug 27, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
While checking if something needs to be changed for #143 I noticed that the big
fullfeature ofsymmostly isn't necessary.In a local test this reduced the compile time from ~2s to ~1.3s. Feel free to drop if the extra code is not worth it.