Conversation
|
(rust_highfive has picked a reviewer for you, use r? to override) |
|
r? @scottmcm |
|
Nice! Is it possible with the current state of |
|
What is the best way to test both implementations? |
|
ping from triage @scottmcm waiting for your review on this |
|
You're not mutating let mut iter = std::iter::empty().chain(vec![0, 0]);
iter.next(); // to change the state to ChainState::Back
iter.nth_back(100); // to empty the iterator
assert_eq!(iter.next(), None);I think you'll need to call |
|
@timvermeulen I added tests for that and fixed the specialization. Thanks! |
|
Ping from triage, still waiting on your review @scottmcm (or someone else from @rust-lang/libs) |
|
This is introducing a r? @Kimundi |
|
Presumably there could also be a specialized |
b625514 to
558f909
Compare
|
What could be the problem in not having |
|
Second ping from |
|
r? @SimonSapin |
|
Per discussion in #62483 (comment) it’s not clear that we want to use specialization in public trait (as opposed to a private trait that only optimize an implementation detail) while specialization itself is still unstable, or at least while it has significant design issue still open. |
|
I'm personally not the biggest fan of so aggressively using specialization myself, but at a bare minimum the general convention we've had (or so I think) is that all specialization is done internally in the standard library and no public-facing function is listed as |
|
Ping from triage @acrrd @SimonSapin |
558f909 to
7b6ad60
Compare
|
After the comment of @SimonSapin and @alexcrichton I removed the specialization |
|
@bors r+ |
|
📌 Commit 7b6ad60 has been approved by |
Add custom nth_back for Chain Implementation of nth_back for Chain. Part of rust-lang#54054
Rollup of 10 pull requests Successful merges: - #60492 (Add custom nth_back for Chain) - #61780 (Finalize the error type for `try_reserve`) - #63495 ( Remove redundant `ty` fields from `mir::Constant` and `hair::pattern::PatternRange`.) - #63525 (Make sure that all file loading happens via SourceMap) - #63595 (add sparc64-unknown-openbsd target) - #63604 (Some update for vxWorks) - #63613 (Hygienize use of built-in macros in the standard library) - #63632 (A couple of comment fixes.) - #63634 (ci: properly set the job name in CPU stats) - #63636 (ci: move linkcheck from mingw-2 to mingw-1) Failed merges: r? @ghost
Implementation of nth_back for Chain.
Part of #54054