File tree Expand file tree Collapse file tree 1 file changed +4
-4
lines changed Expand file tree Collapse file tree 1 file changed +4
-4
lines changed Original file line number Diff line number Diff line change @@ -2106,7 +2106,8 @@ macro_rules! iterator {
2106
2106
2107
2107
#[ inline]
2108
2108
fn size_hint( & self ) -> ( uint, Option <uint>) {
2109
- let exact = self . indexable( ) ;
2109
+ let diff = ( self . end as uint) - ( self . ptr as uint) ;
2110
+ let exact = diff / sys:: nonzero_size_of:: <T >( ) ;
2110
2111
( exact, Some ( exact) )
2111
2112
}
2112
2113
}
@@ -2139,8 +2140,8 @@ macro_rules! random_access_iterator {
2139
2140
impl <' self , T > RandomAccessIterator <$elem> for $name<' self , T > {
2140
2141
#[ inline]
2141
2142
fn indexable( & self ) -> uint {
2142
- let diff = ( self . end as uint ) - ( self . ptr as uint ) ;
2143
- diff / sys :: nonzero_size_of :: < T > ( )
2143
+ let ( exact , _ ) = self . size_hint ( ) ;
2144
+ exact
2144
2145
}
2145
2146
2146
2147
fn idx( & self , index: uint) -> Option <$elem> {
@@ -2181,7 +2182,6 @@ pub struct VecMutIterator<'self, T> {
2181
2182
}
2182
2183
iterator ! { impl VecMutIterator -> & ' self mut T }
2183
2184
double_ended_iterator ! { impl VecMutIterator -> & ' self mut T }
2184
- random_access_iterator ! { impl VecMutIterator -> & ' self mut T }
2185
2185
pub type MutRevIterator < ' self , T > = Invert < VecMutIterator < ' self , T > > ;
2186
2186
2187
2187
/// An iterator that moves out of a vector.
You can’t perform that action at this time.
0 commit comments