@@ -119,7 +119,7 @@ impl<Idx: PartialOrd<Idx>> Range<Idx> {
119119 pub fn contains < U > ( & self , item : & U ) -> bool
120120 where
121121 Idx : PartialOrd < U > ,
122- U : ?Sized ,
122+ U : ?Sized + PartialOrd < Idx > ,
123123 {
124124 <Self as RangeBounds < Idx > >:: contains ( self , item)
125125 }
@@ -212,7 +212,7 @@ impl<Idx: PartialOrd<Idx>> RangeFrom<Idx> {
212212 pub fn contains < U > ( & self , item : & U ) -> bool
213213 where
214214 Idx : PartialOrd < U > ,
215- U : ?Sized ,
215+ U : ?Sized + PartialOrd < Idx > ,
216216 {
217217 <Self as RangeBounds < Idx > >:: contains ( self , item)
218218 }
@@ -293,7 +293,7 @@ impl<Idx: PartialOrd<Idx>> RangeTo<Idx> {
293293 pub fn contains < U > ( & self , item : & U ) -> bool
294294 where
295295 Idx : PartialOrd < U > ,
296- U : ?Sized ,
296+ U : ?Sized + PartialOrd < Idx > ,
297297 {
298298 <Self as RangeBounds < Idx > >:: contains ( self , item)
299299 }
@@ -369,7 +369,7 @@ impl<Idx: PartialOrd<Idx>> RangeInclusive<Idx> {
369369 pub fn contains < U > ( & self , item : & U ) -> bool
370370 where
371371 Idx : PartialOrd < U > ,
372- U : ?Sized ,
372+ U : ?Sized + PartialOrd < Idx > ,
373373 {
374374 <Self as RangeBounds < Idx > >:: contains ( self , item)
375375 }
@@ -487,7 +487,7 @@ impl<Idx: PartialOrd<Idx>> RangeToInclusive<Idx> {
487487 pub fn contains < U > ( & self , item : & U ) -> bool
488488 where
489489 Idx : PartialOrd < U > ,
490- U : ?Sized ,
490+ U : ?Sized + PartialOrd < Idx > ,
491491 {
492492 <Self as RangeBounds < Idx > >:: contains ( self , item)
493493 }
@@ -612,7 +612,7 @@ pub trait RangeBounds<T: ?Sized> {
612612 fn contains < U > ( & self , item : & U ) -> bool
613613 where
614614 T : PartialOrd < U > ,
615- U : ?Sized ,
615+ U : ?Sized + PartialOrd < T > ,
616616 {
617617 ( match self . start ( ) {
618618 Included ( ref start) => * start <= item,
@@ -621,8 +621,8 @@ pub trait RangeBounds<T: ?Sized> {
621621 } )
622622 &&
623623 ( 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 ,
626626 Unbounded => true ,
627627 } )
628628 }
0 commit comments