Skip to content

Commit f567aea

Browse files
committed
comments
1 parent bcf8375 commit f567aea

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

src/libcore/slice/mod.rs

+3-2
Original file line numberDiff line numberDiff line change
@@ -2344,6 +2344,7 @@ macro_rules! iterator {
23442344
#[inline(always)]
23452345
unsafe fn post_inc_start(&mut self, offset: isize) -> * $raw_mut T {
23462346
if mem::size_of::<T>() == 0 {
2347+
// This is *reducing* the length. `ptr` never changes with ZST.
23472348
self.end = (self.end as isize).wrapping_sub(offset) as * $raw_mut T;
23482349
self.ptr
23492350
} else {
@@ -2425,8 +2426,8 @@ macro_rules! iterator {
24252426
// This iterator is now empty. The way we encode the length of a non-ZST
24262427
// iterator, this works for both ZST and non-ZST.
24272428
// For a ZST we would usually do `self.end = self.ptr`, but since
2428-
// we will not give out an address any more after this there is no
2429-
// way to observe the difference.
2429+
// we will not give out an reference any more after this there is no
2430+
// way to observe the difference except for raw pointers.
24302431
self.ptr = self.end;
24312432
return None;
24322433
}

0 commit comments

Comments
 (0)