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

Add a cap on ensure macro recursion depth #194

Merged
merged 2 commits into from Nov 22, 2021
Merged

Add a cap on ensure macro recursion depth #194

merged 2 commits into from Nov 22, 2021

Conversation

dtolnay
Copy link
Owner

@dtolnay dtolnay commented Nov 22, 2021

Before:

error: recursion limit reached while expanding `$crate::__parse_ensure!`
  --> tests/test_ensure.rs:50:22
   |
50 |       let test = || Ok(ensure!(
   |  ______________________^
51 | |         false | false | false | false | false | false | false | false | false |
52 | |         false | false | false | false | false | false | false | false | false |
53 | |         false | false | false | false | false | false | false | false | false |
...  |
57 | |         false | false | false | false | false | false | false | false | false
58 | |     ));
   | |_____^
   |
   = help: consider increasing the recursion limit by adding a `#![recursion_limit = "256"]` attribute to your crate (`test_ensure`)
   = note: this error originates in the macro `$crate::__parse_ensure` (in Nightly builds, run with -Z macro-backtrace for more info)

After: we recurse to a maximum of 120 macro calls before bailing out and rendering a fallback message without the lhs/rhs.

Currently fails:

    error: recursion limit reached while expanding `$crate::__parse_ensure!`
      --> tests/test_ensure.rs:50:22
       |
    50 |       let test = || Ok(ensure!(
       |  ______________________^
    51 | |         false | false | false | false | false | false | false | false | false |
    52 | |         false | false | false | false | false | false | false | false | false |
    53 | |         false | false | false | false | false | false | false | false | false |
    ...  |
    57 | |         false | false | false | false | false | false | false | false | false
    58 | |     ));
       | |_____^
       |
       = help: consider increasing the recursion limit by adding a `#![recursion_limit = "256"]` attribute to your crate (`test_ensure`)
       = note: this error originates in the macro `$crate::__parse_ensure` (in Nightly builds, run with -Z macro-backtrace for more info)
@dtolnay dtolnay merged commit 9f2e32f into master Nov 22, 2021
@dtolnay dtolnay deleted the ensure branch November 22, 2021 07:02
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

Successfully merging this pull request may close these issues.

None yet

1 participant