Skip to content

Commit 9f3f854

Browse files
committed
Fix missing ?Sized bounds for partialeq implementations
Fix #636
1 parent 3794869 commit 9f3f854

File tree

4 files changed

+17
-9
lines changed

4 files changed

+17
-9
lines changed

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,9 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/)
66
and this project adheres to [Semantic Versioning](http://semver.org/).
77

88
## [Unreleased]
9+
910
- Added `from_bytes_truncating_at_nul` to `CString`
11+
- Fix missing `?Sized` bounds for partialeq implementations
1012

1113
## [v0.9.2] 2025-11-12
1214

src/deque.rs

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1164,9 +1164,13 @@ where
11641164
}
11651165
}
11661166

1167-
impl<T: PartialEq, const N: usize> PartialEq for Deque<T, N> {
1168-
fn eq(&self, other: &Self) -> bool {
1169-
if self.len() != other.len() {
1167+
impl<T: PartialEq, S1, S2> PartialEq<DequeInner<T, S2>> for DequeInner<T, S1>
1168+
where
1169+
S1: VecStorage<T> + ?Sized,
1170+
S2: VecStorage<T> + ?Sized,
1171+
{
1172+
fn eq(&self, other: &DequeInner<T, S2>) -> bool {
1173+
if self.storage_len() != other.storage_len() {
11701174
return false;
11711175
}
11721176
let (sa, sb) = self.as_slices();

src/history_buf.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -610,11 +610,13 @@ impl<T, const N: usize> Default for HistoryBuf<T, N> {
610610
}
611611
}
612612

613-
impl<T, S: HistoryBufStorage<T> + ?Sized> PartialEq for HistoryBufInner<T, S>
613+
impl<T, S1, S2> PartialEq<HistoryBufInner<T, S2>> for HistoryBufInner<T, S1>
614614
where
615615
T: PartialEq,
616+
S1: HistoryBufStorage<T> + ?Sized,
617+
S2: HistoryBufStorage<T> + ?Sized,
616618
{
617-
fn eq(&self, other: &Self) -> bool {
619+
fn eq(&self, other: &HistoryBufInner<T, S2>) -> bool {
618620
self.oldest_ordered().eq(other.oldest_ordered())
619621
}
620622
}

src/vec/mod.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1609,7 +1609,7 @@ impl<A, B, LenTB, const M: usize, SB> PartialEq<VecInner<B, LenTB, SB>> for [A;
16091609
where
16101610
A: PartialEq<B>,
16111611
LenTB: LenType,
1612-
SB: VecStorage<B>,
1612+
SB: VecStorage<B> + ?Sized,
16131613
{
16141614
fn eq(&self, other: &VecInner<B, LenTB, SB>) -> bool {
16151615
self.eq(other.as_slice())
@@ -1620,7 +1620,7 @@ impl<A, B, LenTB, SB, const M: usize> PartialEq<VecInner<B, LenTB, SB>> for &[A;
16201620
where
16211621
A: PartialEq<B>,
16221622
LenTB: LenType,
1623-
SB: VecStorage<B>,
1623+
SB: VecStorage<B> + ?Sized,
16241624
{
16251625
fn eq(&self, other: &VecInner<B, LenTB, SB>) -> bool {
16261626
(*self).eq(other)
@@ -1631,7 +1631,7 @@ impl<A, B, LenTB, SB> PartialEq<VecInner<B, LenTB, SB>> for [A]
16311631
where
16321632
A: PartialEq<B>,
16331633
LenTB: LenType,
1634-
SB: VecStorage<B>,
1634+
SB: VecStorage<B> + ?Sized,
16351635
{
16361636
fn eq(&self, other: &VecInner<B, LenTB, SB>) -> bool {
16371637
self.eq(other.as_slice())
@@ -1642,7 +1642,7 @@ impl<A, B, LenTB, SB> PartialEq<VecInner<B, LenTB, SB>> for &[A]
16421642
where
16431643
A: PartialEq<B>,
16441644
LenTB: LenType,
1645-
SB: VecStorage<B>,
1645+
SB: VecStorage<B> + ?Sized,
16461646
{
16471647
fn eq(&self, other: &VecInner<B, LenTB, SB>) -> bool {
16481648
(*self).eq(other)

0 commit comments

Comments
 (0)