From dbed18ca20f14a1fe3c8a1e02071c8e8dd7476c5 Mon Sep 17 00:00:00 2001 From: Simon Sapin Date: Wed, 5 Jul 2017 23:49:33 +0200 Subject: [PATCH] Remove unused Add bounds in iterator for ranges impls. --- src/libcore/iter/range.rs | 31 ++++++++----------------------- src/test/compile-fail/range-1.rs | 1 - 2 files changed, 8 insertions(+), 24 deletions(-) diff --git a/src/libcore/iter/range.rs b/src/libcore/iter/range.rs index 1dad81579489..11a8f8f7ee6b 100644 --- a/src/libcore/iter/range.rs +++ b/src/libcore/iter/range.rs @@ -277,9 +277,7 @@ macro_rules! range_incl_trusted_len_impl { } #[stable(feature = "rust1", since = "1.0.0")] -impl Iterator for ops::Range where - for<'a> &'a A: Add<&'a A, Output = A> -{ +impl Iterator for ops::Range { type Item = A; #[inline] @@ -317,10 +315,7 @@ range_trusted_len_impl!(usize isize u8 i8 u16 i16 u32 i32 i64 u64); range_incl_trusted_len_impl!(usize isize u8 i8 u16 i16 u32 i32 i64 u64); #[stable(feature = "rust1", since = "1.0.0")] -impl DoubleEndedIterator for ops::Range where - for<'a> &'a A: Add<&'a A, Output = A>, - for<'a> &'a A: Sub<&'a A, Output = A> -{ +impl DoubleEndedIterator for ops::Range { #[inline] fn next_back(&mut self) -> Option { if self.start < self.end { @@ -333,13 +328,10 @@ impl DoubleEndedIterator for ops::Range where } #[unstable(feature = "fused", issue = "35602")] -impl FusedIterator for ops::Range - where A: Step, for<'a> &'a A: Add<&'a A, Output = A> {} +impl FusedIterator for ops::Range {} #[stable(feature = "rust1", since = "1.0.0")] -impl Iterator for ops::RangeFrom where - for<'a> &'a A: Add<&'a A, Output = A> -{ +impl Iterator for ops::RangeFrom { type Item = A; #[inline] @@ -356,13 +348,10 @@ impl Iterator for ops::RangeFrom where } #[unstable(feature = "fused", issue = "35602")] -impl FusedIterator for ops::RangeFrom - where A: Step, for<'a> &'a A: Add<&'a A, Output = A> {} +impl FusedIterator for ops::RangeFrom {} #[unstable(feature = "inclusive_range", reason = "recently added, follows RFC", issue = "28237")] -impl Iterator for ops::RangeInclusive where - for<'a> &'a A: Add<&'a A, Output = A> -{ +impl Iterator for ops::RangeInclusive { type Item = A; #[inline] @@ -397,10 +386,7 @@ impl Iterator for ops::RangeInclusive where } #[unstable(feature = "inclusive_range", reason = "recently added, follows RFC", issue = "28237")] -impl DoubleEndedIterator for ops::RangeInclusive where - for<'a> &'a A: Add<&'a A, Output = A>, - for<'a> &'a A: Sub<&'a A, Output = A> -{ +impl DoubleEndedIterator for ops::RangeInclusive { #[inline] fn next_back(&mut self) -> Option { use cmp::Ordering::*; @@ -421,5 +407,4 @@ impl DoubleEndedIterator for ops::RangeInclusive where } #[unstable(feature = "fused", issue = "35602")] -impl FusedIterator for ops::RangeInclusive - where A: Step, for<'a> &'a A: Add<&'a A, Output = A> {} +impl FusedIterator for ops::RangeInclusive {} diff --git a/src/test/compile-fail/range-1.rs b/src/test/compile-fail/range-1.rs index dc6833163a47..58794e3b35d5 100644 --- a/src/test/compile-fail/range-1.rs +++ b/src/test/compile-fail/range-1.rs @@ -18,7 +18,6 @@ pub fn main() { // Bool => does not implement iterator. for i in false..true {} //~^ ERROR `bool: std::iter::Step` is not satisfied - //~^^ ERROR `for<'a> &'a bool: std::ops::Add` is not satisfied // Unsized type. let arr: &[_] = &[1, 2, 3];