Uh oh!
There was an error while loading. Please reload this page.
Override StepBy::{try_fold, try_rfold} - #64121
Conversation
rust-highfive
commented
Sep 3, 2019
r? @KodrAus (rust_highfive has picked a reviewer for you, use r? to override) |
Centril
commented
Sep 3, 2019
r? @scottmcm |
scottmcm
left a comment
There was a problem hiding this comment.
Thanks for the PR! This definitely seems like one that needs try_fold (though I wish LLVM would just peel it). One minor change and it'll be good to go.
There was a problem hiding this comment.
Can you just use a while let Some(x) = self.iter.nth(self.step) loop here instead? It'll do the same thing, but without introducing a new closure that would regress #62429.
There was a problem hiding this comment.
Thanks, I forgot about that. I turned the closures into functions instead, that should have the same benefits, correct? I figured this will make it easier to potentially undo these changes in the future.
scottmcm
commented
Sep 9, 2019
@bors r+ rollup |
bors
commented
Sep 9, 2019
📌 Commit 78908f2 has been approved by |
… r=scottmcm
Override `StepBy::{try_fold, try_rfold}`
Previous PR: rust-lang#51435
The previous PR was closed in favor of rust-lang#51601, which was later reverted. I don't think these implementations will make it harder to specialize `StepBy<Range<_>>` later, so we should be able to land this without any consequences.
This should fixrust-lang#57517 – in my benchmarks `iter` and `iter.step_by(1)` now perform equally well, provided internal iteration is used.
Previous PR: #51435
The previous PR was closed in favor of #51601, which was later reverted. I don't think these implementations will make it harder to specialize
StepBy<Range<_>>later, so we should be able to land this without any consequences.This should fix#57517 – in my benchmarks
iteranditer.step_by(1)now perform equally well, provided internal iteration is used.