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)
I tried this code:
I got the following compile error:
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)