Skip to content

Add missing impl PartialEq<Vec<T>> for [T; N]#153249

Closed
Not-Sarthak wants to merge 2 commits intorust-lang:mainfrom
Not-Sarthak:fix-149017-partialeq-vec-array
Closed

Add missing impl PartialEq<Vec<T>> for [T; N]#153249
Not-Sarthak wants to merge 2 commits intorust-lang:mainfrom
Not-Sarthak:fix-149017-partialeq-vec-array

Conversation

@Not-Sarthak
Copy link

@Not-Sarthak Not-Sarthak commented Mar 1, 2026

Summary

  • Adds the missing reverse PartialEq implementation: impl<T, U, A: Allocator, const N: usize> PartialEq<Vec<U, A>> for [T; N]
  • The forward direction (Vec<T> == [T; N]) has been stable since 1.0.0, but [T; N] == Vec<T> was missing
  • Uses the existing __impl_slice_eq1 macro, following the same pattern as other reverse impls (e.g., &[T] == Vec, [T] == Vec)

Closes #149017

Test plan

  • ./x test tidy --bless passes
  • ./x test library/alloc passes
  • Verify [1, 2, 3] == vec![1, 2, 3] compiles on nightly

@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 Mar 1, 2026
@rustbot
Copy link
Collaborator

rustbot commented Mar 1, 2026

r? @joboet

rustbot has assigned @joboet.
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, joboet

@rustbot

This comment has been minimized.

The forward direction (Vec<T> == [T; N]) has been stable since 1.0.0,
but the reverse ([T; N] == Vec<T>) was missing. This adds the symmetric
implementation using the existing __impl_slice_eq1 macro.
@Not-Sarthak Not-Sarthak force-pushed the fix-149017-partialeq-vec-array branch from c73db1d to 0ba7ddc Compare March 1, 2026 07:10
@rust-log-analyzer

This comment has been minimized.

The new PartialEq<Vec<U, A>> impl for [T; N] adds one more impl to
the suggestion list, changing "and 11 others" to "and 12 others".
@lqd
Copy link
Member

lqd commented Mar 1, 2026

Duplicate of #149045

@lqd lqd marked this as a duplicate of #149045 Mar 1, 2026
@lqd lqd closed this Mar 1, 2026
@rustbot rustbot removed the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Mar 1, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

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.

Missing impl PartialEq<Vec<T>> for [T; N]

5 participants