Skip to content

Commit

Permalink
comments
Browse files Browse the repository at this point in the history
  • Loading branch information
RalfJung committed Jul 11, 2018
1 parent bcf8375 commit f567aea
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/libcore/slice/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2344,6 +2344,7 @@ macro_rules! iterator {
#[inline(always)]
unsafe fn post_inc_start(&mut self, offset: isize) -> * $raw_mut T {
if mem::size_of::<T>() == 0 {
// This is *reducing* the length. `ptr` never changes with ZST.
self.end = (self.end as isize).wrapping_sub(offset) as * $raw_mut T;
self.ptr
} else {
Expand Down Expand Up @@ -2425,8 +2426,8 @@ macro_rules! iterator {
// This iterator is now empty. The way we encode the length of a non-ZST
// iterator, this works for both ZST and non-ZST.
// For a ZST we would usually do `self.end = self.ptr`, but since
// we will not give out an address any more after this there is no
// way to observe the difference.
// we will not give out an reference any more after this there is no
// way to observe the difference except for raw pointers.
self.ptr = self.end;
return None;
}
Expand Down

0 comments on commit f567aea

Please sign in to comment.