-
Notifications
You must be signed in to change notification settings - Fork 14k
Open
Labels
C-bugCategory: This is a bug.Category: This is a bug.E-easyCall for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue.Call for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue.T-libs-apiRelevant to the library API team, which will review and decide on the PR/issue.Relevant to the library API team, which will review and decide on the PR/issue.
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)
Metadata
Metadata
Assignees
Labels
C-bugCategory: This is a bug.Category: This is a bug.E-easyCall for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue.Call for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue.T-libs-apiRelevant to the library API team, which will review and decide on the PR/issue.Relevant to the library API team, which will review and decide on the PR/issue.