-
-
Notifications
You must be signed in to change notification settings - Fork 2.6k
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
fix compiler error in 'std.fmt.Parser.until' #22129
base: master
Are you sure you want to change the base?
fix compiler error in 'std.fmt.Parser.until' #22129
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
until
should not be using ++
, a better solution would be to call nextCodepoint
like the other functions next to it and return a slice like it did before #18533
Would it involve converting |
No, it would look something like: pub fn until(self: *@This(), ch: u21) []const u8 {
const start = self.iter.i;
while (self.peek(0)) |code_point| {
if (code_point == ch)
break;
_ = self.iter.nextCodepoint();
}
return self.iter.bytes[start..self.iter.i];
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This kind of easily tested change should come with unit test coverage.
Fair enough, none of the previous fixes in #20505 added any specific tests so I figured the existing usage as part of format strings would be sufficient. |
Fixes
_ = &std.fmt.Parser.until;
in #20505