Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

'Macro_InvokeRules_MatchPattern - No arm matched' error in mrustc #321

Open
iamanonymouscs opened this issue Oct 10, 2023 · 3 comments
Open

Comments

@iamanonymouscs
Copy link

iamanonymouscs commented Oct 10, 2023

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
@thepowersgang
Copy link
Owner

Looks like :expr isn't matching attributes

@iamanonymouscs
Copy link
Author

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.

@thepowersgang
Copy link
Owner

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.

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

No branches or pull requests

2 participants