Skip to content

bug: Compiler panic in semantic pass: unreachable!() in is_macro_rule_match_ex for macro param without kind #9797

@jubnzv

Description

@jubnzv

The compiler panics with unreachable!() in macro_declaration.rs:298 when a declarative macro rule has a param without a kind specifier (e.g. $x instead of $x:expr).

MRE:

macro m {
    ($x) => { 0 };
}
fn main() {
    m!(1);
}

Reproduce steps:

RUST_BACKTRACE=1 cairo-compile --single-file mre/mre_008.cairo

Output:

thread 'main' panicked at crates/cairo-lang-semantic/src/items/macro_declaration.rs:298:25:
internal error: entered unreachable code: Missing macro rule param kind, should have been handled by the parser.
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

Expected behavior: emit a diagnostic about the missing param kind instead of panicking.

Git commit: 711d307
Build: release
cargo 1.96.0-nightly (e84cb639e 2026-03-21)
rustc 1.96.0-nightly (562dee482 2026-03-21)

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions