-
Notifications
You must be signed in to change notification settings - Fork 819
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
Merge InputLength into Input can introduce extra trait requirement #1809
Comments
Thank you @tisonkun for investigating the problem. Seems we are not able to add the impls by ourself except we add a new type which is not so ergonomic 🤔. |
I think there should be an implementation for Input for all slices of objects. The problem is the current implementations are in the way, because they use a copied version of the The main downside is that it's another breaking API change that could have an impact on code that people are using. |
I make a new type wrapper as a workaround: https://github.com/andylokandy/nom-rule/pull/8/files/62e78a4a0475eba6494b49820e91b414474e432e..6fcd576dc7022955f90dc837476d5907331ad621 But it's not so ergonomic, yes.
Yes. I'm not sure if |
Something like this actually passes all the tests and should work for you. The main issue is that is changes the external API and it will brake stuff for some people. |
@marcdejonge That should help. Thank you! We're using a wrapper Perhaps that would be an supplement for a general Input wrapper or nom's Input trait can require a span info. I found that error reporting is an essential part when writing an end-user parser, otherwise users would only accept "Syntax error" without which part is the source of error. I know |
See andylokandy/nom-rule#8
Previously, we have:
nom/src/multi/mod.rs
Lines 52 to 58 in 869f897
and
So
InputLength
is implemented for&[proc_macro2::TokenTree]
.But now we have:
nom/src/multi/mod.rs
Lines 61 to 67 in 2cec1b3
So
&[proc_macro2::TokenTree]
can no longer directly adapted inmany0
.Perhaps we can wrap a newtype to work it around. But I'd first report this use case and see if there is better/idiomatic way.
cc @Geal
The text was updated successfully, but these errors were encountered: