Skip to content

lib/ringbuf: fix two macro syntax bugs in no_dedup and all-disabled arms#2570

Open
NeonPhantom123 wants to merge 4 commits into
oxidecomputer:masterfrom
NeonPhantom123:fix/ringbuf-no-dedup-missing-comma-and-percent-name
Open

lib/ringbuf: fix two macro syntax bugs in no_dedup and all-disabled arms#2570
NeonPhantom123 wants to merge 4 commits into
oxidecomputer:masterfrom
NeonPhantom123:fix/ringbuf-no-dedup-missing-comma-and-percent-name

Conversation

@NeonPhantom123

Copy link
Copy Markdown

Two syntactically invalid macro arms in lib/ringbuf/src/lib.rs.

The first is in the #[cfg(not(feature = "disabled"))] ringbuf! macro,
no_dedup named arm (line 295). The type expression reads
Ringbuf<$t, () $n> — two adjacent generic arguments with no separator.
Rust requires a comma between them; the correct form is Ringbuf<$t, (), $n>.
The parallel default arm on line 283 already has this right (u16, $n).

The second is in the #[cfg(all(counters, counters-disabled, disabled))]
counted_ringbuf! macro, no_dedup named arm (line 434). The recursive
call uses %name instead of $name% is not a Rust macro metavariable
sigil. Every other forwarding arm in the file uses $name; this one was
a typo.

Neither arm has an active caller in this repo under the currently enabled
feature combinations, so both are latent compile errors. Adds three
integration tests (one function per file, one static per test) covering
the named no_dedup arm, the unnamed delegation form, and the no-collapse
behaviour that distinguishes no_dedup from the default dedup mode.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant