]> git.lizzy.rs Git - rust.git/commit
Increment `self.index` before calling `Iterator::self.a.__iterator_get_unchecked...
authorSebastian Dröge <sebastian@centricular.com>
Thu, 4 Feb 2021 08:23:01 +0000 (10:23 +0200)
committerSebastian Dröge <sebastian@centricular.com>
Thu, 4 Feb 2021 08:23:01 +0000 (10:23 +0200)
commit86a4b27475aab52b998c15f5758540697cc9cff0
treeae73fd834da24211212ae754b5a3ef6c94afc095
parente708cbd91c9cae4426d69270248362b423324556
Increment `self.index` before calling `Iterator::self.a.__iterator_get_unchecked` in `Zip` `TrustedRandomAccess` specialization

Otherwise if `Iterator::self.a.__iterator_get_unchecked` panics the
index would not have been incremented yet and another call to
`Iterator::next` would read from the same index again, which is not
allowed according to the API contract of `TrustedRandomAccess` for
`!Clone`.

Fixes https://github.com/rust-lang/rust/issues/81740
library/core/src/iter/adapters/zip.rs