mrustc icon indicating copy to clipboard operation
mrustc copied to clipboard

'Macro_InvokeRules_MatchPattern - No arm matched' error in mrustc

Open iamanonymouscs opened this issue 3 years ago • 3 comments

Code

$ cat 2.rs code:

macro_rules! cbor_map {
    ($key:expr) => {
        $key.signum();
    };
}

fn main() {
    cbor_map! { 
        #[cfg(test)] 
        8
    };
}

It seems that the macro expansion failed to match any arms in the cbor_map! macro definition.

Command

mrustc -L output-1.54.0 2.rs

Output

Setup: V V V
(0.00 s) Setup: DONE
Target Load: V V V
(0.00 s) Target Load: DONE
Parse: V V V
(0.00 s) Parse: DONE
LoadCrates: V V V
(0.39 s) LoadCrates: DONE
Expand: V V V
/home/interesting/mrustc/2.rs:11:7 BUG:src/macro_rules/eval.cpp:1920: TODO: Macro_InvokeRules_MatchPattern - No arm matched - (0, 21)
Aborted (core dumped)

Version

I build the mrustc by using build-1.54.0.sh mrustc --version

rustc 1.29.100 (mrustc v0.10.0 master:4c7e8171)
release: 1.29.100
- Build time: Tue, 26 Sep 2023 07:36:21 +0000
- Commit: 4c7e81716493678df9fe9cac86ea9beedc57db44

iamanonymouscs avatar Oct 10 '23 08:10 iamanonymouscs

Looks like :expr isn't matching attributes

thepowersgang avatar Oct 10 '23 11:10 thepowersgang

Looks like :expr isn't matching attributes

Is this an issue with the code itself or an internal error in the compiler? I initially thought it was an internal issue with the compiler when encountering the BUG statement. Of course, there are syntax errors in the code itself.

iamanonymouscs avatar Oct 10 '23 16:10 iamanonymouscs

If rustc accepts that code, then it's a mrustc bug and will be addressed next time I do a push to clean up tickets.

thepowersgang avatar Oct 12 '23 13:10 thepowersgang