1
Fork 0

More IS_ZST in library

I noticed that `post_inc_start` and `pre_dec_end` were doing this check in different ways

d19b64fb54/library/core/src/slice/iter/macros.rs (L76-L93)

so started making this PR, then added a few more I found since I was already making changes anyway.
This commit is contained in:
Scott McMurray 2023-04-20 20:15:04 -07:00
parent d19b64fb54
commit 56613f8c38
4 changed files with 7 additions and 15 deletions

View file

@ -73,7 +73,7 @@ macro_rules! iterator {
// Unsafe because the offset must not exceed `self.len()`.
#[inline(always)]
unsafe fn post_inc_start(&mut self, offset: usize) -> * $raw_mut T {
if mem::size_of::<T>() == 0 {
if T::IS_ZST {
zst_shrink!(self, offset);
self.ptr.as_ptr()
} else {