@@ -2703,7 +2703,7 @@ impl<T> Iterator for IntoIter<T> {
27032703 // purposefully don't use 'ptr.offset' because for
27042704 // vectors with 0-size elements this would return the
27052705 // same pointer.
2706- self . ptr = unsafe { arith_offset ( self . ptr as * const T , 1 ) as * mut T } ;
2706+ self . ptr = unsafe { arith_offset ( self . ptr as * const i8 , 1 ) as * mut T } ;
27072707
27082708 // Make up a value of this ZST.
27092709 Some ( unsafe { mem:: zeroed ( ) } )
@@ -2735,22 +2735,18 @@ impl<T> Iterator for IntoIter<T> {
27352735impl < T > DoubleEndedIterator for IntoIter < T > {
27362736 #[ inline]
27372737 fn next_back ( & mut self ) -> Option < T > {
2738- unsafe {
2739- if self . end == self . ptr {
2740- None
2741- } else {
2742- if mem:: size_of :: < T > ( ) == 0 {
2743- // See above for why 'ptr.offset' isn't used
2744- self . end = arith_offset ( self . end as * const i8 , -1 ) as * mut T ;
2738+ if self . end == self . ptr {
2739+ None
2740+ } else if mem:: size_of :: < T > ( ) == 0 {
2741+ // See above for why 'ptr.offset' isn't used
2742+ self . end = unsafe { arith_offset ( self . end as * const i8 , -1 ) as * mut T } ;
27452743
2746- // Make up a value of this ZST.
2747- Some ( mem:: zeroed ( ) )
2748- } else {
2749- self . end = self . end . offset ( -1 ) ;
2744+ // Make up a value of this ZST.
2745+ Some ( unsafe { mem:: zeroed ( ) } )
2746+ } else {
2747+ self . end = unsafe { self . end . offset ( -1 ) } ;
27502748
2751- Some ( ptr:: read ( self . end ) )
2752- }
2753- }
2749+ Some ( unsafe { ptr:: read ( self . end ) } )
27542750 }
27552751 }
27562752}
0 commit comments