diff --git a/src/libcore/ops/range.rs b/src/libcore/ops/range.rs index 868308cafd1..6f3e3b50885 100644 --- a/src/libcore/ops/range.rs +++ b/src/libcore/ops/range.rs @@ -119,7 +119,7 @@ impl> Range { pub fn contains(&self, item: &U) -> bool where Idx: PartialOrd, - U: ?Sized, + U: ?Sized + PartialOrd, { >::contains(self, item) } @@ -212,7 +212,7 @@ impl> RangeFrom { pub fn contains(&self, item: &U) -> bool where Idx: PartialOrd, - U: ?Sized, + U: ?Sized + PartialOrd, { >::contains(self, item) } @@ -293,7 +293,7 @@ impl> RangeTo { pub fn contains(&self, item: &U) -> bool where Idx: PartialOrd, - U: ?Sized, + U: ?Sized + PartialOrd, { >::contains(self, item) } @@ -369,7 +369,7 @@ impl> RangeInclusive { pub fn contains(&self, item: &U) -> bool where Idx: PartialOrd, - U: ?Sized, + U: ?Sized + PartialOrd, { >::contains(self, item) } @@ -487,7 +487,7 @@ impl> RangeToInclusive { pub fn contains(&self, item: &U) -> bool where Idx: PartialOrd, - U: ?Sized, + U: ?Sized + PartialOrd, { >::contains(self, item) } @@ -612,7 +612,7 @@ pub trait RangeBounds { fn contains(&self, item: &U) -> bool where T: PartialOrd, - U: ?Sized, + U: ?Sized + PartialOrd, { (match self.start() { Included(ref start) => *start <= item, @@ -621,8 +621,8 @@ pub trait RangeBounds { }) && (match self.end() { - Included(ref end) => *end >= item, - Excluded(ref end) => *end > item, + Included(ref end) => item <= *end, + Excluded(ref end) => item < *end, Unbounded => true, }) }