-
Notifications
You must be signed in to change notification settings - Fork 12.7k
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
#![recursion_limit]
behaves strangely
#75602
Comments
I’ve never worked on the Rust compiler before, so I doubt I’ll be of any help here, but I quickly ran a GitHub search for |
I found a similar, but more egregious bug. (See #76424). Should I merge them? |
I'm pretty sure the recursion limit applies to all parts of the compiler, not just macros. So the bit about weird errors when the limit is 1 seems fine to me. But it should probably enforce that the limit is at least a number. |
Certainly, running
Yes, of course the compiler should set a minimum recursion limit to avoid breaking things. |
Improve help for recursion limit errors - Tweak help message and suggested limit (handle `0` case). - Add test for rust-lang#75602 (it was already fixed, maybe can be resolved too). Fixes rust-lang#76424
Improve help for recursion limit errors - Tweak help message and suggested limit (handle `0` case). - Add test for rust-lang#75602 (it was already fixed, maybe can be resolved too). Fixes rust-lang#76424
Improve help for recursion limit errors - Tweak help message and suggested limit (handle `0` case). - Add test for rust-lang#75602 (it was already fixed, maybe can be resolved too). Fixes rust-lang#76424
Current version: #![recursion_limit = "1"]
fn main() { } emits
Note: for some reason this does not break if it is layered all on one line, like #![recursion_limit = "1"] fn main() { } So yeah, there's an unfortunate thing here where there are a bunch of implicit pieces of code embedded as part of A mildly hackish answer might be that we could set a hard floor of a recursion requirement of 3, which stops this from breaking on such a trivial example. |
I was playing around with
recursion_limit
, and I realized thatrecursion_limit
doesn't check for bad values.#![recursion_limit = "malformed"] fn main() {}
, for example, compiles without error. Moreover, when set to1
, the Rust compiler raises a weird error:What is
RustaceansAreAwesome
? This code doesn't make any macro calls, yet somehow exceeds the recursion limit.Version
rustc --version --verbose
:Code
The text was updated successfully, but these errors were encountered: