diff --git a/src/libcore/ops/range.rs b/src/libcore/ops/range.rs index 8ffad82b69d..7fdb6dda1f9 100644 --- a/src/libcore/ops/range.rs +++ b/src/libcore/ops/range.rs @@ -330,7 +330,7 @@ impl<Idx: PartialOrd<Idx>> RangeTo<Idx> { /// assert_eq!(arr[1..=3], [ 1,2,3 ]); // RangeInclusive /// ``` #[doc(alias = "..=")] -#[derive(Clone)] // not Copy -- see #27186 +#[derive(Clone, PartialEq, Eq, Hash)] // not Copy -- see #27186 #[stable(feature = "inclusive_range", since = "1.26.0")] pub struct RangeInclusive<Idx> { // Note that the fields here are not public to allow changing the @@ -350,26 +350,6 @@ pub struct RangeInclusive<Idx> { pub(crate) exhausted: bool, } -#[stable(feature = "inclusive_range", since = "1.26.0")] -impl<Idx: PartialEq> PartialEq for RangeInclusive<Idx> { - #[inline] - fn eq(&self, other: &Self) -> bool { - self.start == other.start && self.end == other.end && self.exhausted == other.exhausted - } -} - -#[stable(feature = "inclusive_range", since = "1.26.0")] -impl<Idx: Eq> Eq for RangeInclusive<Idx> {} - -#[stable(feature = "inclusive_range", since = "1.26.0")] -impl<Idx: Hash> Hash for RangeInclusive<Idx> { - fn hash<H: Hasher>(&self, state: &mut H) { - self.start.hash(state); - self.end.hash(state); - self.exhausted.hash(state); - } -} - impl<Idx> RangeInclusive<Idx> { /// Creates a new inclusive range. Equivalent to writing `start..=end`. ///