scan: macro_rules regions read as blindspots and fail --strict #35
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
What happened
v0.3.0 cannot parse
macro_rules!bodies or item-position bang-macroinvocations. Each such region reports
blindspot unparsed region, and--strictexits nonzero on any blindspot — so a repo that ships adeclarative macro cannot pass its guard.
Hit in keel (PerishLab/keel #48):
keel-gateships its resourcedefinitions through a declarative macro, per settled product law:
crates/gate/src/make.rs— themacro_rules! gate { ... }body(expands to
#[resource]structs bound to the caller's identity unit)crates/api/src/bin/forge/gear.rs— the call sitekeel_gate::gate!(Actor);Workaround in place (debt)
Macros were isolated into dedicated files (
make.rs,gear.rs) and thosetwo files are excluded in
negentropy.toml. That removes real code fromlaw coverage and is recorded as debt in keel's vocabulary — to be
unexcluded once the scanner learns macros.
What would resolve it
Either (in preference order):
macro_rules!bodies as token trees and scan the expansion-shaped content it can recognize (idents/blocks), applying word and
depth laws where parseable — blindspot only what is truly opaque.
macro_rules!items and item-positionpath::bang!(...)invocations as declared blindspots that do not fail
--strict(a distinct class from unexpected parse failures), optionally gated
by an explicit
[scan] macros = "allow"seat in negentropy.toml.Option 2 keeps strictness honest: an unparsed region the author named
is a different signal from one the scanner stumbled on.
Repro
Any crate with an exported
macro_rules!+ one invocation; runnegentropy --strict .with v0.3.0.