Skip to content

Repeated macro rules cause an infinite loop #34488

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

Closed
TheZoq2 opened this issue Jun 26, 2016 · 2 comments
Closed

Repeated macro rules cause an infinite loop #34488

TheZoq2 opened this issue Jun 26, 2016 · 2 comments

Comments

@TheZoq2
Copy link
Contributor

TheZoq2 commented Jun 26, 2016

If you define a macro which contains the rule $()* the compiler seems to go into an infinite loop and quickly consume a lot of memory

When compiling the following code:

macro_rules! test {
    ($()*) => {}
}

pub fn main()
{
    test!();
}

The compiler freezes and starts consuming memory until it runs out at which point it seems to crash.
Using the above test code, I got this error message but when I encountered this bug in a bigger project, my computer froze for about 1 minute after which the operating system killed the compiler.

fatal runtime error: out of memory
zsh: illegal hardware instruction (core dumped)  rustc test.rs

This is the output of rustc --version --verbose

rustc 1.9.0
binary: rustc
commit-hash: unknown
commit-date: unknown
host: x86_64-unknown-linux-gnu
release: 1.9.0
@jonas-schievink
Copy link
Contributor

Duplicate of #5067

@Aatch
Copy link
Contributor

Aatch commented Jun 27, 2016

Closing as duplicate

@Aatch Aatch closed this as completed Jun 27, 2016
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

3 participants