Code change:
} } <del> macro_rules! range_impl { </del> <ins> macro_rules! range_exact_iter_impl { </ins> ($($t:ty)*) => ($( #[stable(feature = "rust1", since = "1.0.0")] <del> impl Iterator for ::ops::Range<$t> { type Item = $t; </del> <ins> impl ExactSizeIterator for ::ops::Range<$t> { </ins> #[inline] <del> fn next(&mut self) -> Option<$t> { if self.start < self.end { let result = self.start; self.start += 1; return Some(result); } return None; } #[inline] fn size_hint(&self) -> (usize, Option<usize>) { </del> <ins> fn len(&self) -> usize { </ins> debug_assert!(self.end >= self.start); <del> let hint = (self.end - self.start) as usize; (hint, Some(hint)) </del> <ins> (self.end - self.start) as usize </ins> } } <del> #[stable(feature = "rust1", since = "1.0.0")] impl ExactSizeIterator for ::ops::Range<$t> {} </del> )*) } <del> macro_rules! range_impl_no_hint { ($($t:ty)*) => ($( #[stable(feature = "rust1", since = "1.0.0")] impl Iterator for ::ops::Range<$t> { type Item = $t; #[inline] fn next(&mut self) -> Option<$t> { if self.start < self.end { let result = self.start; self.start += 1; return Some(result); } </del> <ins> #[stable(feature = "rust1", since = "1.0.0")] impl<A: Int> Iterator for ::ops::Range<A> { type Item = A; </ins> <del> return None; } </del> <ins> #[inline] fn next(&mut self) -> Option<A> { if self.start < self.end { let result = self.start; self.start = self.start + Int::one(); Some(result) } else { None </ins> } <del> )*) } macro_rules! range_other_impls { ($($t:ty)*) => ($( #[stable(feature = "rust1", since = "1.0.0")] impl DoubleEndedIterator for ::ops::Range<$t> { #[inline] fn next_back(&mut self) -> Option<$t> { if self.start < self.end { self.end -= 1; return Some(self.end); } </del> <ins> } </ins> <del> return None; } } </del> <ins> #[inline] fn size_hint(&self) -> (usize, Option<usize>) { debug_assert!(self.end >= self.start); let hint = (self.end - self.start).to_uint(); (hint.unwrap_or(0), hint) } } </ins> <del> #[stable(feature = "rust1", since = "1.0.0")] impl Iterator for ::ops::RangeFrom<$t> { type Item = $t; </del> <ins> range_exact_iter_impl!(usize u8 u16 u32 isize i8 i16 i32); #[cfg(target_pointer_width = "64")] range_exact_iter_impl!(u64 i64); </ins> <del> #[inline] fn next(&mut self) -> Option<$t> { let result = self.start; self.start += 1; debug_assert!(result < self.start); return Some(result); } </del> <ins> #[stable(feature = "rust1", since = "1.0.0")] impl<A: Int> DoubleEndedIterator for ::ops::Range<A> { #[inline] fn next_back(&mut self) -> Option<A> { if self.start < self.end { self.end = self.end - Int::one(); Some(self.end) } else { None </ins> } <del> )*) </del> <ins> } </ins> } <del> range_impl!(usize u8 u16 u32 isize i8 i16 i32); #[cfg(target_pointer_width = "64")] range_impl!(u64 i64); #[cfg(target_pointer_width = "32")] range_impl_no_hint!(u64 i64); </del> <ins> #[stable(feature = "rust1", since = "1.0.0")] impl<A: Int> Iterator for ::ops::RangeFrom<A> { type Item = A; </ins> <del> range_other_impls!(usize u8 u16 u32 u64 isize i8 i16 i32 i64); </del> <ins> #[inline] fn next(&mut self) -> Option<A> { let result = self.start; self.start = self.start + Int::one(); debug_assert!(result < self.start); Some(result) } } </ins> /// An iterator that repeats an element endlessly #[derive(Clone)]

Related discussion:
text: However, it doesn't have to be this way, but it'd take some work to massage the trait matching infrastructure, since impl selection doesn't presently have access to output binding information, that'd have to be propagated inward. It might be interesting to try and address this in a more wholistic way (i.e., something that accounts for the full set of facts that are registered). particular, the important constraint that we MUST maintain is that, during trans, given the input types, we can derive the output type. But it's permissible for us to use the output type to derive the input type during type checking, since once inference is done, we then have the input types to supply during trans so that we can rederive the output.
The fix is very simple then. Thanks for helping diagnose the problem and pointing to the right direction.