Rust Analyzer increase recursion limit?

Hello. I am currently using a macro which requires #![recursion_limit = "1024"] to compile/run. The VS Code Rust Analyzer extension reports the error that it's reached it's limit for macro expansion. Is there a way to increase this limit or get it to use the limit I set at the top of the file?

1 Like

I'm getting this too via use of the serde_json::json macro.

It is hard-coded to 128:

You could open an issue to ask for a way to configure it.

You may be able to make it go away by disabling macro-error.

You can change this setting by making ./vscode/settings.json containing:

{
    "rust-analyzer.diagnostics.disabled": [
    "macro-error"
  ]
}

I think disabling the error is unsatisfying because I will want to know of any actual macro errors. Maybe more importantly, I'm using my macro to generate a struct/impls so I would hope that increasing the recursion limit would allow rust-analyzer to do it's expansion and I would get auto-completion/type inference.

@bjorn3 I have opened this issue: Configure recursion limit for macro expansion · Issue #8640 · rust-analyzer/rust-analyzer · GitHub which I hope was done correctly.

This topic was automatically closed 90 days after the last reply. We invite you to open a new topic if you have further questions or comments.