Skip to content

Commit c7d90d1

Browse files
committed
comments
1 parent 86369c3 commit c7d90d1

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

src/libcore/slice/mod.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2353,6 +2353,7 @@ macro_rules! iterator {
23532353
#[inline(always)]
23542354
unsafe fn post_inc_start(&mut self, offset: isize) -> * $raw_mut T {
23552355
if mem::size_of::<T>() == 0 {
2356+
// This is *reducing* the length. `ptr` never changes with ZST.
23562357
self.end = (self.end as isize).wrapping_sub(offset) as * $raw_mut T;
23572358
self.ptr
23582359
} else {
@@ -2434,8 +2435,8 @@ macro_rules! iterator {
24342435
// This iterator is now empty. The way we encode the length of a non-ZST
24352436
// iterator, this works for both ZST and non-ZST.
24362437
// For a ZST we would usually do `self.end = self.ptr`, but since
2437-
// we will not give out an address any more after this there is no
2438-
// way to observe the difference.
2438+
// we will not give out an reference any more after this there is no
2439+
// way to observe the difference except for raw pointers.
24392440
self.ptr = self.end;
24402441
return None;
24412442
}

0 commit comments

Comments
 (0)