Skip to content

Commit 3eddc74

Browse files
Use inner iterator may_have_side_effect for Cloned
Previous implementation wasn't correct, as an inner iterator could have had side effects.
1 parent 21cb46a commit 3eddc74

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/libcore/iter/mod.rs

+3-1
Original file line numberDiff line numberDiff line change
@@ -602,7 +602,9 @@ unsafe impl<'a, I, T: 'a> TrustedRandomAccess for Cloned<I>
602602
}
603603

604604
#[inline]
605-
fn may_have_side_effect() -> bool { false }
605+
fn may_have_side_effect() -> bool {
606+
I::may_have_side_effect()
607+
}
606608
}
607609

608610
#[unstable(feature = "trusted_len", issue = "37572")]

0 commit comments

Comments
 (0)