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
@hkBst
Copy link
Member

hkBst commented Jan 27, 2026

The minimal fix would seem to be to backport an unstabling PR, then let these changes ride the train as normal.

@cuviper
Copy link
Member Author

cuviper commented Jan 27, 2026

@hkBst "unstabling" is an option, but that comes with a lot of secondary effects, like needing to reverse the bootstrap-feature change in commit 3dc7a1f.

Backporting just the Copy removal would be simplest action. The rest can ride the train, no problem.

@hkBst
Copy link
Member

hkBst commented Jan 28, 2026

Given the number of missed things, it seems clear that this feature did not receive enough attention before it was stabilized. That's why I think unstabilizing is the most principled solution. Beta is the least used/tested release channel so backporting like this feels awfully close to committing straight to stable ;P. These changes seem straightforward enough, but the changes that end up causing problems often seem so as well...

@Amanieu Amanieu added the beta-accepted Accepted for backporting to the compiler in the beta channel. label Jan 28, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

beta-accepted Accepted for backporting to the compiler in the beta channel. 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.

5 participants