diff options
| author | Ralf Jung <post@ralfj.de> | 2018-07-11 21:36:50 +0200 |
|---|---|---|
| committer | Ralf Jung <post@ralfj.de> | 2018-08-02 00:33:03 +0200 |
| commit | c7d90d1a50b82e8812f90dcf53087ea9574200e1 (patch) | |
| tree | 576b98f16175d57a6a8bc2f59c5ddea3e3118c50 /src/libcore/slice | |
| parent | 86369c3ad44a59cad44514c4b466ee3877a4b2a5 (diff) | |
| download | rust-c7d90d1a50b82e8812f90dcf53087ea9574200e1.tar.gz rust-c7d90d1a50b82e8812f90dcf53087ea9574200e1.zip | |
comments
Diffstat (limited to 'src/libcore/slice')
| -rw-r--r-- | src/libcore/slice/mod.rs | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/src/libcore/slice/mod.rs b/src/libcore/slice/mod.rs index 10ca4a3ce46..0cd226c78f2 100644 --- a/src/libcore/slice/mod.rs +++ b/src/libcore/slice/mod.rs @@ -2353,6 +2353,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 { @@ -2434,8 +2435,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; } |
