@@ -119,7 +119,7 @@ impl<Idx: PartialOrd<Idx>> Range<Idx> {
119
119
pub fn contains < U > ( & self , item : & U ) -> bool
120
120
where
121
121
Idx : PartialOrd < U > ,
122
- U : ?Sized ,
122
+ U : ?Sized + PartialOrd < Idx > ,
123
123
{
124
124
<Self as RangeBounds < Idx > >:: contains ( self , item)
125
125
}
@@ -212,7 +212,7 @@ impl<Idx: PartialOrd<Idx>> RangeFrom<Idx> {
212
212
pub fn contains < U > ( & self , item : & U ) -> bool
213
213
where
214
214
Idx : PartialOrd < U > ,
215
- U : ?Sized ,
215
+ U : ?Sized + PartialOrd < Idx > ,
216
216
{
217
217
<Self as RangeBounds < Idx > >:: contains ( self , item)
218
218
}
@@ -293,7 +293,7 @@ impl<Idx: PartialOrd<Idx>> RangeTo<Idx> {
293
293
pub fn contains < U > ( & self , item : & U ) -> bool
294
294
where
295
295
Idx : PartialOrd < U > ,
296
- U : ?Sized ,
296
+ U : ?Sized + PartialOrd < Idx > ,
297
297
{
298
298
<Self as RangeBounds < Idx > >:: contains ( self , item)
299
299
}
@@ -369,7 +369,7 @@ impl<Idx: PartialOrd<Idx>> RangeInclusive<Idx> {
369
369
pub fn contains < U > ( & self , item : & U ) -> bool
370
370
where
371
371
Idx : PartialOrd < U > ,
372
- U : ?Sized ,
372
+ U : ?Sized + PartialOrd < Idx > ,
373
373
{
374
374
<Self as RangeBounds < Idx > >:: contains ( self , item)
375
375
}
@@ -487,7 +487,7 @@ impl<Idx: PartialOrd<Idx>> RangeToInclusive<Idx> {
487
487
pub fn contains < U > ( & self , item : & U ) -> bool
488
488
where
489
489
Idx : PartialOrd < U > ,
490
- U : ?Sized ,
490
+ U : ?Sized + PartialOrd < Idx > ,
491
491
{
492
492
<Self as RangeBounds < Idx > >:: contains ( self , item)
493
493
}
@@ -612,7 +612,7 @@ pub trait RangeBounds<T: ?Sized> {
612
612
fn contains < U > ( & self , item : & U ) -> bool
613
613
where
614
614
T : PartialOrd < U > ,
615
- U : ?Sized ,
615
+ U : ?Sized + PartialOrd < T > ,
616
616
{
617
617
( match self . start ( ) {
618
618
Included ( ref start) => * start <= item,
@@ -621,8 +621,8 @@ pub trait RangeBounds<T: ?Sized> {
621
621
} )
622
622
&&
623
623
( match self . end ( ) {
624
- Included ( ref end) => * end >= item ,
625
- Excluded ( ref end) => * end > item ,
624
+ Included ( ref end) => item <= * end ,
625
+ Excluded ( ref end) => item < * end ,
626
626
Unbounded => true ,
627
627
} )
628
628
}
0 commit comments