Skip to content

feat: add symmetric PartialEq impls for Vec, &[T], &mut [T] versus Cow<'_, [T]> - #156160

Open
kx0101 wants to merge 2 commits into
rust-lang:mainfrom
kx0101:cow-vec-symmetric-partialeq
Open

feat: add symmetric PartialEq impls for Vec, &[T], &mut [T] versus Cow<'_, [T]>#156160
kx0101 wants to merge 2 commits into
rust-lang:mainfrom
kx0101:cow-vec-symmetric-partialeq

Conversation

@kx0101

@kx0101 kx0101 commented May 4, 2026

Copy link
Copy Markdown

add the missing reverse PartialEq<Cow<'_, [U]>> impls for Vec<T, A>, &[T], and &mut [T], essentially mirroring the existing forwards in library/alloc/src/vec/partial_eq.rs

partially addresses #152830. The VecDeque half of that issue is being handled separately by #152972, so there is no overlap with this PR

also fyi: verified locally with ./x test library/alloctests --stage 1 and the new test_partial_eq_cow_symmetric test passes alongside the existing alloc test suite

@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 May 4, 2026
@rustbot

rustbot commented May 4, 2026

Copy link
Copy Markdown
Collaborator

r? @Mark-Simulacrum

rustbot has assigned @Mark-Simulacrum.
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 7 candidates
  • Random selection from Mark-Simulacrum, jhpratt, nia-e

@rust-log-analyzer

This comment has been minimized.

@kx0101

kx0101 commented May 5, 2026

Copy link
Copy Markdown
Author

had to update the two UI tests expected compiler-error snapshots so they reflect the new PartialEq<Cow<[U]>>

pretty interesting!

@Mark-Simulacrum Mark-Simulacrum added needs-fcp This change is insta-stable, or significant enough to need a team FCP to proceed. S-waiting-on-t-libs-api Status: Awaiting decision from T-libs-api and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Jun 6, 2026
@Amanieu

Amanieu commented Jun 16, 2026

Copy link
Copy Markdown
Member

Starting a crater run to check if this breaks type inference in the ecosystem.

@bors try

@rust-bors

This comment has been minimized.

rust-bors Bot pushed a commit that referenced this pull request Jun 16, 2026
feat: add symmetric PartialEq impls for Vec, &[T], &mut [T] versus Cow<'_, [T]>
@rust-bors

rust-bors Bot commented Jun 16, 2026

Copy link
Copy Markdown
Contributor

☀️ Try build successful (CI)
Build commit: d8be255 (d8be25549d5418405531341b4be6d8538fc3c42e, parent: 89a99936d9e76a50e8df622e7242190841fd871b)

@Amanieu

Amanieu commented Jun 23, 2026

Copy link
Copy Markdown
Member

@craterbot check

@craterbot

Copy link
Copy Markdown
Collaborator

👌 Experiment pr-156160 created and queued.
🤖 Automatically detected try build d8be255
🔍 You can check out the queue and this experiment's details.

ℹ️ Crater is a tool to run experiments across parts of the Rust ecosystem. Learn more

@craterbot craterbot added S-waiting-on-crater Status: Waiting on a crater run to be completed. and removed S-waiting-on-t-libs-api Status: Awaiting decision from T-libs-api labels Jun 23, 2026
@craterbot

Copy link
Copy Markdown
Collaborator

🚧 Experiment pr-156160 is now running

ℹ️ Crater is a tool to run experiments across parts of the Rust ecosystem. Learn more

@craterbot

Copy link
Copy Markdown
Collaborator

🎉 Experiment pr-156160 is completed!
📊 3 regressed and 0 fixed (993683 total)
📊 5174 spurious results on the retry-regressed-list.txt, consider a retry1 if this is a significant amount.
📰 Open the summary report.

⚠️ If you notice any spurious failure please add them to the denylist!
ℹ️ Crater is a tool to run experiments across parts of the Rust ecosystem. Learn more

Footnotes

  1. re-run the experiment with crates=https://crater-reports.s3.amazonaws.com/pr-156160/retry-regressed-list.txt

@craterbot craterbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. and removed S-waiting-on-crater Status: Waiting on a crater run to be completed. labels Jun 26, 2026
@Mark-Simulacrum

Copy link
Copy Markdown
Member

@craterbot check crates=https://crater-reports.s3.amazonaws.com/pr-156160/retry-regressed-list.txt name=pr-156160-1 p=1

Re-running to double check the spurious regressions. 3 regressed so far aren't real.

@craterbot

Copy link
Copy Markdown
Collaborator

👌 Experiment pr-156160-1 created and queued.
🤖 Automatically detected try build d8be255
🔍 You can check out the queue and this experiment's details.

ℹ️ Crater is a tool to run experiments across parts of the Rust ecosystem. Learn more

@craterbot craterbot added S-waiting-on-crater Status: Waiting on a crater run to be completed. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Jun 28, 2026
@kx0101

kx0101 commented Jun 28, 2026

Copy link
Copy Markdown
Author

@Mark-Simulacrum great, thank you very much for your help! 🙏

@craterbot

Copy link
Copy Markdown
Collaborator

🚧 Experiment pr-156160-1 is now running

ℹ️ Crater is a tool to run experiments across parts of the Rust ecosystem. Learn more

@craterbot

Copy link
Copy Markdown
Collaborator

🎉 Experiment pr-156160-1 is completed!
📊 0 regressed and 0 fixed (5021 total)
📊 551 spurious results on the retry-regressed-list.txt, consider a retry1 if this is a significant amount.
📰 Open the summary report.

⚠️ If you notice any spurious failure please add them to the denylist!
ℹ️ Crater is a tool to run experiments across parts of the Rust ecosystem. Learn more

Footnotes

  1. re-run the experiment with crates=https://crater-reports.s3.amazonaws.com/pr-156160-1/retry-regressed-list.txt

@craterbot craterbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. and removed S-waiting-on-crater Status: Waiting on a crater run to be completed. labels Jun 30, 2026
@Mark-Simulacrum Mark-Simulacrum added the T-libs-api Relevant to the library API team, which will review and decide on the PR/issue. label Jun 30, 2026
@Mark-Simulacrum

Mark-Simulacrum commented Jun 30, 2026

Copy link
Copy Markdown
Member

@rfcbot fcp merge libs-api

This adds these impls (I think these are transcribed right out of the macro). Crater didn't find any inference breakage as a result of adding them.

impl<T, U: Clone + PartialEq<T>, A: Allocator> PartialEq<Cow<'_, [U]>> for Vec<T, A> {}
impl<T, U: Clone + PartialEq<T>> PartialEq<Cow<'_, [U]>> for &[T] {}
impl<T, U: Clone + PartialEq<T>> PartialEq<Cow<'_, [U]>> for &mut [T] {}

@rust-rfcbot

rust-rfcbot commented Jun 30, 2026

Copy link
Copy Markdown
Collaborator

@Mark-Simulacrum has proposed to merge this. The next step is review by the rest of the tagged team members:

No concerns currently listed.

Once a majority of reviewers approve (and at most 2 approvals are outstanding), this will enter its final comment period. If you spot a major issue that hasn't been raised at any point in this process, please speak up!

See this document for info about what commands tagged team members can give me.

@rust-rfcbot rust-rfcbot added proposed-final-comment-period Proposed to merge/close by relevant subteam, see T-<team> label. Will enter FCP once signed off. disposition-merge This issue / PR is in PFCP or FCP with a disposition to merge it. and removed needs-fcp This change is insta-stable, or significant enough to need a team FCP to proceed. labels Jun 30, 2026
@Mark-Simulacrum Mark-Simulacrum added S-waiting-on-fcp Status: PR is in FCP and is awaiting for FCP to complete. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Jul 11, 2026
@kx0101

kx0101 commented Jul 29, 2026

Copy link
Copy Markdown
Author

@Amanieu @joshtriplett @the8472 hello there! do you think we could merge this? 😄 thanks in advance!

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

Labels

disposition-merge This issue / PR is in PFCP or FCP with a disposition to merge it. proposed-final-comment-period Proposed to merge/close by relevant subteam, see T-<team> label. Will enter FCP once signed off. S-waiting-on-fcp Status: PR is in FCP and is awaiting for FCP to complete. 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.

7 participants