Closed
Description
Assertions are successful in this code (playground):
let mut a = Vec::new();
let mut b = Vec::new();
let value = [1, 2, 3, 4, 5, 6]
.iter()
.cloned()
.map(|n| {
a.push(n);
n * 10
})
.zip([2, 3, 4, 5, 6, 7, 8].iter().cloned().map(|n| {
b.push(n * 100);
n * 1000
}))
.nth_back(3);
assert_eq!(value, Some((30, 4000)));
assert_eq!(a, vec![6, 6, 5, 5, 4, 4, 3]);
assert_eq!(b, vec![800, 700, 700, 600, 600, 500, 500, 400]);
But later assertions are actually wrong (the second and third ones shouldn't double-count).
@matthewjasper pointed out it's a bug that exists in the current next_back
implementation.