Skip to content

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

Open
@Marwes

Description

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)

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

No one assigned

    Labels

    A-macrosArea: All kinds of macros (custom derive, macro_rules!, proc macros, ..)I-slowIssue: Problems and improvements with respect to performance of generated code.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions