SplitIterator panics when doing SplitIterator.first()
twice
#22338
Labels
bug
Observed behavior contradicts documented or intended behavior
standard library
This issue involves writing Zig code for the standard library.
Milestone
Zig Version
0.14.0-dev.2569+30169d1d2
Steps to Reproduce and Observed Behavior
std.mem.splitAny
)split_iterator.first()
panic: reached unreachable code
after calling the secondsplit_iterator.first()
Example code:
Expected Behavior
I expected that function to either succeed or to explicitly say it can be called only once.
The documentation says "this function always succeeds" and "call this only to get the first field".
I know I should probably have saved the value of the first call to
split_iterator.first()
(and reused the value), but the documentation does not say something like "Caller guarantees that this function is called only once".The text was updated successfully, but these errors were encountered: