-
Notifications
You must be signed in to change notification settings - Fork 105
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
Reached the type-length limit on parser! macro invocation #226
Comments
I find where error: rule logic(i: usize, single_rule: rule<Token>) -> Token = precedence! {
...
d:block(i, <logic(i, <single_rule()>)>) { d }
} when i comment these lines with recursive call |
I fixed this error by adding copy of logic() rule, but i don't like this because i duplicate the same code |
The minimized version is:
This expands to something like fn logic(single_rule: impl Fn()) {
logic(|| single_rule())
} which fails to compile with the same error. This is because it creates an infinite chain of monomorphized versions of the closure. In plain Rust, you could work around this by passing |
When a rule with PEG rule closure arguments is recursive, it can be useful to pass down the rule argument as a value, since re-capturing it results in a type-length limit error from rustc. (#226) Rustc's type error if you do pass the wrong type isn't as good as the custom one, but isn't too bad.
When a rule with PEG rule closure arguments is recursive, it can be useful to pass down the rule argument as a value, since re-capturing it results in a type-length limit error from rustc. (#226) Rustc's type error if you do pass the wrong type isn't as good as the custom one, but isn't too bad.
7b45748 removes the "parameter single_rule expects a PEG expression, but a value was passed" error, allowing you to pass down the rule closure unmodified as a way to avoid the issues with re-capturing the closure:
|
I got a very strange error:
when i try
cargo build
. I tried to create MRE, but if i moved all code related to parsing into another crate, it worked without errors.Build in actions: https://github.com/p0lunin/vglang/runs/663466273
When i build use macro-backtrace, it show:
The text was updated successfully, but these errors were encountered: