Skip to content

Conversation

@cuviper
Copy link
Member

@cuviper cuviper commented Jan 24, 2026

With slice::ArrayWindows getting ready to stabilize in 1.94, I noticed that it currently has some differences in trait implementations compared to slice::Windows, and I think we should align these.

  • Remove derive(Copy) -- we generally don't want Copy for iterators at all, as this is seen as a footgun (e.g. remove Copy impls from remaining iterators #21809). This is obviously a breaking change though, so we should only remove this if we also backport the removal before it's stable. Otherwise, it should at least be replaced by a manual impl without requiring T: Copy.
  • Manually impl Clone, simply to avoid requiring T: Clone.
  • impl FusedIterator, because it is trivially so. The since = "1.94.0" assumes we'll backport this, otherwise we should change that to the "current" placeholder.
  • impl TrustedLen, because we can trust our implementation.
  • impl TrustedRandomAccess, because the required __iterator_get_unchecked method is straightforward.

r? libs-api

@rustbot label beta-nominated
(at least for the Copy removal, but we could be more selective about the rest).

The derived `T: Copy` constraint is not appropriate for an iterator by
reference, but we generally do not want `Copy` on iterators anyway.
This implementation doesn't need the derived `T: Clone`.
@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-libs Relevant to the library team, which will review and decide on the PR/issue. beta-nominated Nominated for backporting to the compiler in the beta channel. labels Jan 24, 2026
@cuviper cuviper added the T-libs-api Relevant to the library API team, which will review and decide on the PR/issue. label Jan 25, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

beta-nominated Nominated for backporting to the compiler in the beta channel. S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-libs Relevant to the library team, which will review and decide on the PR/issue. T-libs-api Relevant to the library API team, which will review and decide on the PR/issue.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants