cpubits: single 16 => { ... } macro arm fails expansion with error: no rules expected ','
Maintainers usually reply within 1 day
Nobody has claimed this yet.
Assessment
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Newbie friendliness
- 82/100
Research direction
Start by locating the cpubits! macro definition in the cpubits crate and compare the expansion path for 16 => { ... } with the working 32 and 64 single-branch forms. The reproduction in the issue is the first thing to compile; done means it compiles while the listed working forms continue to compile.
Written by the indexing model from the issue text.
Description
Component
cpubits (v0.1.1)
Description
Calling the cpubits! macro with only the 16-bit branch (single 16) fails to expand at compile time with a syntax error. Other single-branch forms (32 => { ... } and 64 => { ... }), pairs, and the full triple compile as expected.
Minimal Reproduction Example
use cpubits::cpubits;
cpubits! {
16 => {
pub type Word = u16;
}
}
fn main() {}
Compiler Output
error: no rules expected `,`
--> src/main.rs:3:1
|
3 | / cpubits! {
4 | | 16 => {
5 | | pub type Word = u16;
6 | | }
7 | | }
| |_^ no rules expected this token in macro call
|
= note: this error originates in the macro `cpubits::cpubits`
Root Cause
During macro expansion of the single 16 => { ... } pattern, the macro inserts a comma after its first generated branch, but the internal two-branch/downstream matcher in cpubits! does not accept a comma at that position.
Observed shapes probe results:
single16: ❌exit 1(error: no rules expected ',')single32: ✅exit 0single64: ✅exit 0group16_32: ✅exit 0group32_64: ✅exit 0pair16_32: ✅exit 0pair32_64: ✅exit 0triple: ✅exit 0
- Dominant language
- Rust
- Stars
- 688
- Forks
- 177
- Avg merge
- 2h 31m
- Merged PRs (30d)
- 31
Getting set up
This project ships no dev container, Dockerfile or contributing guide, so setting up is up to you: start from its README, and see our first-contribution guide for the general steps.
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from RustCrypto/utils
-
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
RustCrypto/utils#1555 · 3 comments ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
RustCrypto/utils#1546 · 1 comment ·
Maintainers usually reply within 1 day
-
Difficulty 3/5 1-2 days Newbie friendliness 59/100
RustCrypto/utils#1589 ·
Maintainers usually reply within 1 day
-
Difficulty 4/5 3-5 days Newbie friendliness 42/100
RustCrypto/utils#1562 ·
Maintainers usually reply within 1 day
-
Difficulty 3/5 1-2 days Newbie friendliness 55/100
RustCrypto/utils#1537 · 7 comments ·
Maintainers usually reply within 1 day
All issues in RustCrypto/utils
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
max-sixty/worktrunk#4727 · 7 comments · 1 reaction ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 86/100
Maintainers usually reply within 1 day
-
follow-up
Difficulty 2/5 1-3 hours Newbie friendliness 73/100
carrick-sh/carrick#1859 ·
Maintainers usually reply within 1 day
-
crate: spate-kafka documentation priority: medium
Difficulty 1/5 Under an hour Newbie friendliness 88/100
Maintainers usually reply within 1 day