Skip to content

Rust stable, macro bomb #58823

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
denisandroid opened this issue Feb 28, 2019 · 1 comment
Closed

Rust stable, macro bomb #58823

denisandroid opened this issue Feb 28, 2019 · 1 comment

Comments

@denisandroid
Copy link

Rust:
rustc 1.34.0-nightly (097c04c 2019-02-24)
rustc 1.33.0 (2aa4c46 2019-02-28)

PlayGround:
https://play.rust-lang.org/?version=stable&mode=debug&edition=2018&gist=14643a4834e5ae92f13e1a1de5c5becb

(OUT) https://pastebin.com/Bv13Lf0M (signal: 9, SIGKILL: kill)

Eng:
Accidentally identified "macro bomb".
It completely clogs the computer's RAM, even on a stable version of Rust and when using RLS.

No warnings or errors.

PlayGround does not even work on a stable version (output is attached), please solve the problem.

Ru:
Случайно выявлена "macro bomb".
Забивает полностью ОЗУ компьютера, даже на стабильной версии Rust и при использовании RLS.

Никаких варнингов или ошибок.

Не отрабатывает PlayGround даже на стабильной версии (вывод прилагается), просьба решить проблему.

@jonas-schievink
Copy link
Contributor

The second macro arm puts @RAW; between each token of the input, so the first arm is never actually reached (you can remove it). This means that for every expansion of the second arm, the number of tokens is multiplied by 4. The recursion limit doesn't help in this case before the memory usage grows exponentially.

This also looks like a duplicate of #51754, so closing in favor of that.

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