From bd1ae637f8c9ecb94614831c4e6642d09f508dfb Mon Sep 17 00:00:00 2001 From: Alex Burka Date: Sun, 11 Sep 2016 01:55:15 +0000 Subject: remove ExactSizeIterator from RangeInclusive --- src/libcore/iter/range.rs | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) (limited to 'src/libcore') diff --git a/src/libcore/iter/range.rs b/src/libcore/iter/range.rs index 66d05d81d80..38afcb6a65e 100644 --- a/src/libcore/iter/range.rs +++ b/src/libcore/iter/range.rs @@ -466,7 +466,11 @@ macro_rules! range_exact_iter_impl { ($($t:ty)*) => ($( #[stable(feature = "rust1", since = "1.0.0")] impl ExactSizeIterator for ops::Range<$t> { } + )*) +} +macro_rules! range_incl_exact_iter_impl { + ($($t:ty)*) => ($( #[unstable(feature = "inclusive_range", reason = "recently added, follows RFC", issue = "28237")] @@ -500,9 +504,12 @@ impl Iterator for ops::Range where } } -// Ranges of u64 and i64 are excluded because they cannot guarantee having -// a length <= usize::MAX, which is required by ExactSizeIterator. +// These macros generate `ExactSizeIterator` impls for various range types. +// Range<{u,i}64> and RangeInclusive<{u,i}{32,64,size}> are excluded +// because they cannot guarantee having a length <= usize::MAX, which is +// required by ExactSizeIterator. range_exact_iter_impl!(usize u8 u16 u32 isize i8 i16 i32); +range_incl_exact_iter_impl!(u8 u16 i8 i16); #[stable(feature = "rust1", since = "1.0.0")] impl DoubleEndedIterator for ops::Range where -- cgit 1.4.1-3-g733a5