rust-lang / rust-lang/rust

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

Open
#149,017 4 comments 0 reactions 1 assignee View on GitHub

@Amanieu is already working on this.

Since Feb 22, 2026.

C-bug E-easy T-libs
Dominant language
Rust
Stars
119k
Forks
16.1k
PR merge metrics
PR metrics pending

Description

I tried this code:

fn main() {
    let x = vec![1];
    let y = [1];
    let _ = x == y;  // Works
    let _ = y == x;  // Compile error
}

I got the following compile error:

error[E0277]: can't compare `[{integer}; 1]` with `Vec<{integer}>`
 --> src/main.rs:5:15
  |
5 |     let _ = y == x;  // Compile error
  |               ^^ no implementation for `[{integer}; 1] == Vec<{integer}>`
  |
  = help: the trait `PartialEq<Vec<{integer}>>` is not implemented for `[{integer}; 1]`
help: consider dereferencing here
  |
5 |     let _ = y == *x;  // Compile error
  |                  +

For more information about this error, try `rustc --explain E0277`.

There's an impl PartialEq<[T; N]> for Vec<T> in std. However, the opposite impl (impl PartialEq<Vec<T>> for [T; N]) is missing.

I have not checked if any other "opposite impls" are also missing.

Meta

Reproducible on the playground with version 1.93.0-nightly (2025-11-16 518b428304e0008859cb)

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.