← Back to Pull requests

implement PartialEq<VecDeque<U>> for Vec<T>, &[T], &mut [T], [T; N], &[T; N] and &mut [T; N] #163753

Open
clarfonthey opened this pull request with 66 lines diff across 5 files
View on GitHub
clarfonthey clarfonthey commented on Oct 04, 2026 12:24 UTC
Author

r? libs

This re-commits rust-lang/rust#152972 but in a way where we can actually do FCP. It was reverted in rust-lang/rust#163752.

API stabilization:

impl<T, U, A> PartialEq<VecDeque<U, A>> for Vec<T, A>;
impl<T, U, A> PartialEq<VecDeque<U, A>> for &[T];
impl<T, U, A> PartialEq<VecDeque<U, A>> for &mut [T];
impl<T, U, A, const N: usize> PartialEq<VecDeque<U, A>> for [T; N];
impl<T, U, A, const N: usize> PartialEq<VecDeque<U, A>> for &[T; N];
impl<T, U, A, const N: usize> PartialEq<VecDeque<U, A>> for &mut [T; N];

Diff: 66 lines (+57 / -9) across 5 files Reviewer: pthariensflame Review duration: 88060m
All Vouch review confidence checks passed
Residual risk 0.04 = Change Risk (0.41) × (1 − Review Confidence (0.89)). Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.41 · 66 lines diff across 5 files
0.41
Model 2 · Review Depth (DistilBERT)
Depth Score: 0.90 · 5 substantive comment(s)
0.90
Model 3 · Review Timing & Attention
Session adequacy: 100% · Reviewer familiarity: 50%
89%
Bedrock Claude 3 · Risk Narration
(disconnected)
Groq
Groq Risk Narration
AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
Model 1 · Change Risk Attribution
SHAP Weights
Diff Size diff_size
0.252
Real PR Conversation Timeline
7 items
clarfonthey clarfonthey commented on Oct 04, 2026 12:24 UTC
Author

@rfcbot merge libs

rust-rfcbot rust-rfcbot commented on Oct 04, 2026 12:24 UTC
Contributor

@clarfonthey has proposed to merge this. The next step is review by the rest of the tagged team members:

[ ] @ChrisDenton
[x] @Mark-Simulacrum
[x] @cuviper
[x] @dtolnay
[x] @joshtriplett
[ ] @nia-e
[ ] @the8472
[x] @thomcc

No concerns currently listed.

Once a majority of reviewers approve (and at most 2 approvals are outstanding), this will enter its final comment period. If you spot a major issue that hasn't been raised at any point in this process, please speak up!

cc @rust-lang/libs-ping: FCP proposed for libs, please feel free to register concerns.
See this document for info about what commands tagged team members can give me.

rustbot rustbot commented on Oct 05, 2026 02:22 UTC
Contributor

This PR was rebased onto a different main commit. Here's a range-diff highlighting what actually changed.

Rebasing is a normal part of keeping PRs up to date, so no action is needed—this note is just to help reviewers.

pthariensflame pthariensflame commented on code on Oct 22, 2026 02:51 UTC
Code Review
library/alloc/src/collections/vec_deque/mod.rs:1
@@ -3907,6 +3907,13 @@ __impl_slice_eq1! { [const N: usize] VecDeque<T, A>, [U; N], }
 __impl_slice_eq1! { [const N: usize] VecDeque<T, A>, &[U; N], }
 __impl_slice_eq1! { [const N: usize] VecDeque<T, A>, &mut [U; N], }
 
+__impl_slice_eq2! { #[stable(feature = "slice_partial_eq_vec_deque", since = "CURRENT_RUSTC_VERSION")], [] Vec<T, A>, VecDeque<U, A>, }

Why are the two allocators both A? Is there a reason to restrict to only comparing a Vec and VecDeque using the same allocator?

View changes since the review

clarfonthey clarfonthey commented on code on Oct 22, 2026 03:51 UTC
Code Review
library/alloc/src/collections/vec_deque/mod.rs:1
@@ -3907,6 +3907,13 @@ __impl_slice_eq1! { [const N: usize] VecDeque<T, A>, [U; N], }
 __impl_slice_eq1! { [const N: usize] VecDeque<T, A>, &[U; N], }
 __impl_slice_eq1! { [const N: usize] VecDeque<T, A>, &mut [U; N], }
 
+__impl_slice_eq2! { #[stable(feature = "slice_partial_eq_vec_deque", since = "CURRENT_RUSTC_VERSION")], [] Vec<T, A>, VecDeque<U, A>, }

Valid point, and I think unfortunately this might warrant another crater run to fix. Although it's worth clarifying that only Vec stably supports allocators at the moment.

pthariensflame pthariensflame commented on code on Oct 22, 2026 17:47 UTC
Code Review
library/alloc/src/collections/vec_deque/mod.rs:1
@@ -3907,6 +3907,13 @@ __impl_slice_eq1! { [const N: usize] VecDeque<T, A>, [U; N], }
 __impl_slice_eq1! { [const N: usize] VecDeque<T, A>, &[U; N], }
 __impl_slice_eq1! { [const N: usize] VecDeque<T, A>, &mut [U; N], }
 
+__impl_slice_eq2! { #[stable(feature = "slice_partial_eq_vec_deque", since = "CURRENT_RUSTC_VERSION")], [] Vec<T, A>, VecDeque<U, A>, }

Although it's worth clarifying that only Vec stably supports allocators at the moment.

We did think of that but it doesn’t actually make a difference to this generalization. Vec having a choice of allocators means we may want to compare it with an arbitrary allocator to VecDeque<_, Global>.

Assignees
clarfonthey clarfonthey
Labels
risk: low confidence: 89.2% reviewed
Vouch Risk Breakdown
AI-powered review risk analysis
Change Risk
Change Risk · Model 1 (XGBoost)
Predicted defect probability (0.00–1.00) based on diff churn, modified sensitive files, and author risk history.
Score: 41% (MEDIUM) · Higher = larger blast radius
41%
Review Confidence
Review Confidence · Models 2 & 3
Scrutiny score (0.00–1.00) combining DistilBERT semantic review depth with reviewer familiarity and session dwell time.
Score: 89.2% · Lower = rushed or shallow review
89.2%
Residual Risk
Residual Risk · Core Equation
Residual = Change × (1 − Confidence)
Unmitigated risk surviving review. ≥ 0.65 triggers an automated re-queue to protect production.
Score: 4.5% · Safe to merge
4.5%
Repository