Skip to content

Commit

Permalink
Use inner iterator may_have_side_effect for Cloned
Browse files Browse the repository at this point in the history
Previous implementation wasn't correct, as an inner iterator
could have had side effects.
  • Loading branch information
KamilaBorowska committed Dec 5, 2018
1 parent 21cb46a commit 3eddc74
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/libcore/iter/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -602,7 +602,9 @@ unsafe impl<'a, I, T: 'a> TrustedRandomAccess for Cloned<I>
}

#[inline]
fn may_have_side_effect() -> bool { false }
fn may_have_side_effect() -> bool {
I::may_have_side_effect()
}
}

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

0 comments on commit 3eddc74

Please sign in to comment.