Add PartialEq<Vec<U>> for [T; N] and &[T; N] - #158809
Conversation
Enable comparing arrays with Vec in both directions, matching the existing Vec<T> == [U; N] impls. Fixes rust-lang#149017
|
Thanks for the pull request, and welcome! The Rust Project is excited to review your changes, and you should hear from @wesleywiser (or someone else) some time within the next two weeks. Please see the contribution instructions for more information. Namely, in order to ensure the minimum review times lag, PR authors and assigned reviewers should ensure that the review label (
Why was this reviewer chosen?The reviewer was selected based on:
|
|
|
Adds the symmetric @rustbot ready |
|
The job Click to see the possible cause of the failure (guessed by this bot) |
| let z = [1, 2, 3]; | ||
| assert!(z == vec![1, 2, 3]); | ||
| assert!(&z == vec![1, 2, 3]); | ||
| } |
There was a problem hiding this comment.
I believe tidy check failed because this test is not in a subdirectory of ui/. Perhaps array-slice-vec/ is a good place?
Enable comparing arrays with
Vecin both directions.Vec<T> == [U; N]already works, but[T; N] == Vec<U>did not compile.This adds the missing symmetric impls using the existing
__impl_slice_eq1macro.
Fixes #149017
Test plan
tests/ui/array-vec-partialeq.rs(//@ check-pass)@rustbot ready