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

The recursion limit for monomorphizations are different than for macro expansions #51951

Open
Marwes opened this issue Jun 30, 2018 · 0 comments
Labels
A-macros Area: All kinds of macros (custom derive, macro_rules!, proc macros, ..) I-slow Issue: Problems and improvements with respect to performance of generated code.

Comments

@Marwes
Copy link
Contributor

Marwes commented Jun 30, 2018

Currently the recursion limit for monomorphization is 64 which the toml_edit crate ended up hitting as reported in Marwes/combine#172 . The solution here is to manually specify a higher recursion limit via the recursion_limit attribute.

This does mean that the attribute ends up in a bit of a weird situation though, since recursion_limit also affects macro expansions which has a default value of 1024. So any explicitly set value between 64 and 1024 actually ends up reducing the recursion limit for macros.

I assume that there is a good reason for the monomorphization limit being so low compared to the macro limit. But if that is the case then it is perhaps a bit problematic that any increase of the limit for the sake of macro expansion will actually also end up increasing it for monomorphizations as well, only it is increased by a factor of 20 or more.

...

I don't think there is anything that is actually directly actionable in this issue now that I have written it out. But I figure I should still post this as I did end up being rather confused by the fact that setting the recursion_limit to 1024 actually fixed the issue in toml_edit, despite the fact that I remember it being increased to 1024 some time ago (only when I dug up the issue did I realize it was only for macros)

@Marwes Marwes changed the title Increase the recursion limit for monomorphizations The recursion limit for monomorphizations are different than for macro expansions Jun 30, 2018
@estebank estebank added I-slow Issue: Problems and improvements with respect to performance of generated code. A-macros Area: All kinds of macros (custom derive, macro_rules!, proc macros, ..) labels Jul 2, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-macros Area: All kinds of macros (custom derive, macro_rules!, proc macros, ..) I-slow Issue: Problems and improvements with respect to performance of generated code.
Projects
None yet
Development

No branches or pull requests

2 participants