From 85e76e804d2526d2a39c5453c3999f895b1d40b5 Mon Sep 17 00:00:00 2001 From: Alex Burka Date: Thu, 9 Jun 2016 10:52:36 -0400 Subject: derive Hash for ranges Fixes #34170. --- src/libcore/ops.rs | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'src/libcore') diff --git a/src/libcore/ops.rs b/src/libcore/ops.rs index 50c4dc697c2..39f27bd47ba 100644 --- a/src/libcore/ops.rs +++ b/src/libcore/ops.rs @@ -1475,7 +1475,7 @@ pub trait IndexMut: Index { /// assert_eq!(arr[1..3], [ 1,2 ]); /// } /// ``` -#[derive(Copy, Clone, PartialEq, Eq)] +#[derive(Copy, Clone, PartialEq, Eq, Hash)] #[stable(feature = "rust1", since = "1.0.0")] pub struct RangeFull; @@ -1506,7 +1506,7 @@ impl fmt::Debug for RangeFull { /// assert_eq!(arr[1..3], [ 1,2 ]); // Range /// } /// ``` -#[derive(Clone, PartialEq, Eq)] +#[derive(Clone, PartialEq, Eq, Hash)] // not Copy -- see #27186 #[stable(feature = "rust1", since = "1.0.0")] pub struct Range { /// The lower bound of the range (inclusive). @@ -1570,7 +1570,7 @@ impl> Range { /// assert_eq!(arr[1..3], [ 1,2 ]); /// } /// ``` -#[derive(Clone, PartialEq, Eq)] +#[derive(Clone, PartialEq, Eq, Hash)] // not Copy -- see #27186 #[stable(feature = "rust1", since = "1.0.0")] pub struct RangeFrom { /// The lower bound of the range (inclusive). @@ -1619,7 +1619,7 @@ impl> RangeFrom { /// assert_eq!(arr[1..3], [ 1,2 ]); /// } /// ``` -#[derive(Copy, Clone, PartialEq, Eq)] +#[derive(Copy, Clone, PartialEq, Eq, Hash)] #[stable(feature = "rust1", since = "1.0.0")] pub struct RangeTo { /// The upper bound of the range (exclusive). @@ -1774,7 +1774,7 @@ impl> RangeInclusive { /// assert_eq!(arr[1...2], [ 1,2 ]); /// } /// ``` -#[derive(Copy, Clone, PartialEq, Eq)] +#[derive(Copy, Clone, PartialEq, Eq, Hash)] #[unstable(feature = "inclusive_range", reason = "recently added, follows RFC", issue = "28237")] pub struct RangeToInclusive { /// The upper bound of the range (inclusive) -- cgit 1.4.1-3-g733a5 From 9e78cd73b5c4254efda9fe57be56b8b374383812 Mon Sep 17 00:00:00 2001 From: Alex Burka Date: Thu, 9 Jun 2016 13:26:02 -0400 Subject: make RangeInclusive Hash and !Copy [breaking-change] due to the removal of Copy which shouldn't have been there in the first place, as per policy set forth in #27186. --- src/libcore/ops.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/libcore') diff --git a/src/libcore/ops.rs b/src/libcore/ops.rs index 39f27bd47ba..5e1210b2ff9 100644 --- a/src/libcore/ops.rs +++ b/src/libcore/ops.rs @@ -1669,7 +1669,7 @@ impl> RangeTo { /// assert_eq!(arr[1...2], [ 1,2 ]); // RangeInclusive /// } /// ``` -#[derive(Copy, Clone, PartialEq, Eq)] +#[derive(Clone, PartialEq, Eq, Hash)] // not Copy -- see #27186 #[unstable(feature = "inclusive_range", reason = "recently added, follows RFC", issue = "28237")] pub enum RangeInclusive { /// Empty range (iteration has finished) -- cgit 1.4.1-3-g733a5