You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Remove the dependency of elements_are! on HasSize.
HasSize is annoying because it can only be implemented for a priori known types. This change eliminates that dependency by having the matcher check whether the actual and expected values have matching sizes through inspection of the iterator used for matching rather than up front.
This introduces a new type ZippedIterator, which is almost identical to std::iter::Zip except that:
* It contains an additional field which indicates whether the two input iterators had different sizes, and
* It otherwise only implements the bare minimum functionality required by its caller and the Iterator trait.
Using this, the matcher can check whether a size mismatch was detected after the full iteration and fail the test in that case.
In particular, this makes elements_are! actually work with slices, e.g., from calling as_slice() on a Vec. Previously that would fail because (1) the slice must be dereferenced when passed as an actual value to verify_that! and (2) the resulting dereferenced type cannot implement HasSize.
PiperOrigin-RevId: 515585610
0 commit comments