-
Notifications
You must be signed in to change notification settings - Fork 12.9k
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
Don't unwind when hitting the macro expansion recursion limit #69497
Conversation
This comment has been minimized.
This comment has been minimized.
4747a99
to
17312df
Compare
Hm.. it seems like macro_rules! prob1 {
(0) => {
0
};
($n:expr) => {
if ($n % 3 == 0) || ($n % 5 == 0) {
$n + prob1!($n - 1); //~ ERROR recursion limit reached while expanding `prob1!`
} else {
prob1!($n - 1);
}
};
}
fn main() {
println!("Problem 1: {}", prob1!(1000));
} |
Interesting, I wanted to remove this fatal error too, and expected producing a dummy fragment to work. |
Each call to |
@petrochenkov I tried using an early exit from |
The problem here is not entirely in expansion. The generated AST is enormous though, so later compilation phases take a lot of time (~7.5 minutes). |
☔ The latest upstream changes (presumably #69796) made this pull request unmergeable. Please resolve the merge conflicts. |
17312df
to
511b73f
Compare
The job Click to expand the log.
I'm a bot! I can only do what humans tell me to, so if this was not helpful or you have suggestions for improvements, please ping or otherwise contact |
511b73f
to
2698eaf
Compare
☔ The latest upstream changes (presumably #70062) made this pull request unmergeable. Please resolve the merge conflicts. |
2698eaf
to
bdaf9e4
Compare
I made the compiler exit early after macro expansion if a recursion limit was hit. |
@bors r+ |
📌 Commit bdaf9e4 has been approved by |
…nkov Don't unwind when hitting the macro expansion recursion limit This removes one use of `FatalError.raise()`. r? @petrochenkov
Failed in #70110 (comment), @bors r- |
bdaf9e4
to
43bee17
Compare
@bors r+ |
📌 Commit 43bee17836d416e440802512b9867042d95651fb has been approved by |
🌲 The tree is currently closed for pull requests below priority 5, this pull request will be tested once the tree is reopened |
Still don't know why it failed in the rollup. @bors r- |
☔ The latest upstream changes (presumably #70118) made this pull request unmergeable. Please resolve the merge conflicts. |
43bee17
to
d641ad0
Compare
📌 Commit d641ad0 has been approved by |
Rollup of 6 pull requests Successful merges: - rust-lang#69497 (Don't unwind when hitting the macro expansion recursion limit) - rust-lang#69901 (add #[rustc_layout(debug)]) - rust-lang#69910 (Avoid query type in generics) - rust-lang#69955 (Fix abort-on-eprintln during process shutdown) - rust-lang#70032 (put type params in front of const params in generics_of) - rust-lang#70119 (rustc: use LocalDefId instead of DefId in TypeckTables.) Failed merges: r? @ghost
This removes one use of
FatalError.raise()
.r? @petrochenkov