Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
While I was moving my lexer over to
zero-copy
there were some issues that I encountered related toTakeUntil
, and I am sad to say it took like an hour and a half of dealing with Rusts wonderful generic errors before I was able to find the reason why.The current implementation for of
Parser
is only implemented forTakeUntil<P, C>
, and when one fills in the missing items, you get:TakeUntil<P, C, (), (), ()>
. This was a particularly fun problem becauseC
, which represents the collection that should be parsed into, is actually in the spot for the input genericI
, which we can see when we look at the definition herepub struct TakeUntil<P, I: ?Sized, C = (), E = (), S = ()>
Additionally I fixed the bug that I accidentally introduced in one of my previous pull requests. At the time I believed it to be correct, and have gotten one less branch. What I didn't realize was that I removed the branch that assured that the
offset
index is within the&str
. By removing that I enabled the classic "read memory that doesn't belong to you" bug.