You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
macro binding scan: an argument-free item macro from outside the workspace may define a trusted macro name #16348
Found by Devin's review on #16346 (comment 4712657180). This is a property of the macro binding scan as a whole, not of that PR.
Gap (false credit, narrow):macro_binding_ambiguities / macro_binding_candidates (crates/ripr/src/analysis/syntax/owner_pin.rs) judge a macro call by its argument tokens. An item-position call to a macro from a crate outside the workspace, with no relevant tokens in its arguments (install_macros!();), may expand to macro_rules! println { .. }, macro_rules! assert_eq { .. } or macro_rules! json { .. }. The new definition's textual scope then covers the rest of that module and every child module declared after it. The scan reports no site, so a bare trusted name in that scope is read as the standard or drop-in macro.
Who is affected: every consumer of the trusted-name scan:
Exempt only calls whose expansion is known to define no macro: verified cfg_if!, the audited wrapper table, thread_local!, lazy_static! after an audit.
Measure the credit lost on the dogfood and corpus workspaces before landing, since thread_local!/lazy_static!-style item macros are common.
Bump FILE_FACT_CACHE_SCHEMA_VERSION, since stored candidates must widen too.
Check the box below or use the @coderabbitai plan command to generate an implementation plan and prompts that you can use with your favorite coding assistant.
Create Plan
🧪 Issue enrichment is currently in open beta.
You can configure auto-planning by selecting labels in the issue_enrichment configuration.
To disable automatic issue enrichment, add the following to your .coderabbit.yaml:
issue_enrichment:
auto_enrich:
enabled: false
💬 Have feedback or questions? Drop into our discord!
Closing as not planned: rustc rejects the shapes this gap depends on, so code that compiles cannot reach the false credit.
Evidence. Small reproductions were compiled with rustc 1.95.0 (the MSRV) and rustc 1.100.0. Each one fails with E0659 (assert_eq is ambiguous: a macro-expanded name conflicts with a less macro-expanded name from an outer scope). The shapes tried:
An item-position install!(); whose expansion is macro_rules! assert_eq, followed by a bare assert_eq!. Tried in the same module, in a child module declared after it, and in a #[cfg(test)] test, under the 2015, 2018, 2021 and 2024 editions.
#[macro_export] macro_rules! assert_eq coming from an expansion inside a module, then called bare from the crate root.
An expansion that defines vec (a std prelude macro, in the same category as println).
An expansion that defines json while a use ..::json import is in scope. This covers the verified drop-in readings.
An expansion that emits #[macro_use] extern crate x; or use x::assert_eq;.
include! of a file that defines macro_rules! assert_eq.
An expanded use in a parent module does not reach a child module, and a sibling module is not affected, so those cases are already sound.
Cost of the proposed fix. A prototype added an ItemMacroCall binding site with the exemptions listed in this issue. It took credit from 8 Rust rows in cargo xtask verdict-corpus check-all, including two from the real bytesize crate (commutative_op! and quickcheck! item calls), and false verdicts stayed at 0. The prototype is not landing: it costs real credit for a case the compiler already refuses.
Narrow residual, not acted on. In a #[no_std] crate the prelude has no vec/format/println/print/eprint/eprintln/dbg, so an expanded macro_rules! vec there does compile. None of these names is an assertion macro. It only matters if ripr gives oracle credit through a bare std-only macro in a no_std crate with no other source for the name. Open a new issue with a reproducing fixture if that turns up.
A possible follow-up for credit recovery: the existing #16060Included site also refuses core prelude names that rustc would reject anyway.
Activity
coderabbitai commentedon Nov 26, 2026
🔗 Related PRs
#8772 - fix(rust): preserve retained macro-site disclosure parity (
#8265) [merged]📝 Issue Planner
Check the box below or use the
@coderabbitai plancommand to generate an implementation plan and prompts that you can use with your favorite coding assistant.🧪 Issue enrichment is currently in open beta.
You can configure auto-planning by selecting labels in the issue_enrichment configuration.
To disable automatic issue enrichment, add the following to your
.coderabbit.yaml:💬 Have feedback or questions? Drop into our discord!
EffortlessSteven commentedon Nov 27, 2026
Claiming this for the 0.11 correctness pass, under thread "Close open correctness issues for 0.11". A PR will follow.
Generated by Claude Code
EffortlessSteven commentedon Nov 27, 2026
Closing as not planned: rustc rejects the shapes this gap depends on, so code that compiles cannot reach the false credit.
Evidence. Small reproductions were compiled with rustc 1.95.0 (the MSRV) and rustc 1.100.0. Each one fails with E0659 (
assert_eqis ambiguous: a macro-expanded name conflicts with a less macro-expanded name from an outer scope). The shapes tried:install!();whose expansion ismacro_rules! assert_eq, followed by a bareassert_eq!. Tried in the same module, in a child module declared after it, and in a#[cfg(test)]test, under the 2015, 2018, 2021 and 2024 editions.#[macro_export] macro_rules! assert_eqcoming from an expansion inside a module, then called bare from the crate root.vec(a std prelude macro, in the same category asprintln).jsonwhile ause ..::jsonimport is in scope. This covers the verified drop-in readings.#[macro_use] extern crate x;oruse x::assert_eq;.include!of a file that definesmacro_rules! assert_eq.An expanded
usein a parent module does not reach a child module, and a sibling module is not affected, so those cases are already sound.Cost of the proposed fix. A prototype added an
ItemMacroCallbinding site with the exemptions listed in this issue. It took credit from 8 Rust rows incargo xtask verdict-corpus check-all, including two from the realbytesizecrate (commutative_op!andquickcheck!item calls), and false verdicts stayed at 0. The prototype is not landing: it costs real credit for a case the compiler already refuses.Narrow residual, not acted on. In a
#[no_std]crate the prelude has novec/format/println/print/eprint/eprintln/dbg, so an expandedmacro_rules! vecthere does compile. None of these names is an assertion macro. It only matters if ripr gives oracle credit through a bare std-only macro in ano_stdcrate with no other source for the name. Open a new issue with a reproducing fixture if that turns up.A possible follow-up for credit recovery: the existing #16060
Includedsite also refuses core prelude names that rustc would reject anyway.Generated by Claude Code