-
Notifications
You must be signed in to change notification settings - Fork 40
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
seq!
for tuples errors when capturing locally-defined parsers.
#502
Comments
This still has a deficiency compared to seq structs in that you can only use the parser once. This is a part of winnow-rs#502
Thanks for reporting this! I worked on a fix but it appears to be a breaking change. Before, we moved the parser and the caller could declare their parsers as immutable. With this change, they now need to make their parsers mutable. I'm assuming this can be worked around on the callers side by adding I'm thinking this is likely to not be enough to justify a breaking release right now but will need to wait until the motivation is strong enough to release one. Side note: #502 only partially brings their behavior in alignment which is why I didn't mark this as a fix but a step. I suspect the way to fix this would be to stop using |
Please complete the following tasks
rust version
rustc 1.77.0 (aedd173a2 2024-03-17)
winnow version
0.6.5
Minimal reproducible code
Steps to reproduce the bug with the above code
cargo check
Actual Behaviour
Expected Behaviour
This should compile.
If
seq!
is used to make a struct (instead of a tuple) it does compile.works fine.
Additional Context
Manually expanding the
seq!
macro (with RA) for the broken example gives:This gives a more descriptive error:
Manually expanding the example that does work gives:
I think the reason this works is that
foo
andbar
don't need to be captured by value here, as.parse_next
takes&mut self
.Adding
.by_ref()
to the tuple example version may fix it.The text was updated successfully, but these errors were encountered: