Skip to content

Forward all array PartialOrd to slices - #160996

Open
scottmcm wants to merge 1 commit into
rust-lang:mainfrom
scottmcm:too-many-ampersands-2
Open

Forward all array PartialOrd to slices#160996
scottmcm wants to merge 1 commit into
rust-lang:mainfrom
scottmcm:too-many-ampersands-2

Conversation

@scottmcm

@scottmcm scottmcm commented Aug 12, 2026

Copy link
Copy Markdown
Member

I happened to notice that these have had too many &s since before 1.0 -- it ends up using &[T]: PartialOrd and thus wastefully need to forward to [T]: PartialOrd.

So re-written to specify the implementation to which we're trying to delegate explicitly (by writing <[T] as PartialOrd>) which means we no longer need the &&self[..]-style dance at all since the unsizing coercion will do the right thing.

And while I was here delegating stuff, it also delegates the __chaining_* methods, since those have custom overrides for slices (#138881) and we ought to take advantage of that for arrays too.


No LLM used.

@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. labels Aug 12, 2026
@rustbot

rustbot commented Aug 12, 2026

Copy link
Copy Markdown
Collaborator

r? @JohnTitor

rustbot has assigned @JohnTitor.
They will have a look at your PR within the next two weeks and either review your PR or reassign to another reviewer.

Use r? to explicitly pick a reviewer

Why was this reviewer chosen?

The reviewer was selected based on:

  • Owners of files modified in this PR: libs
  • libs expanded to 12 candidates
  • Random selection from JohnTitor, Mark-Simulacrum, clarfonthey, nia-e

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

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.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants