about summary refs log tree commit diff
path: root/src/liballoc
diff options
context:
space:
mode:
authorRalf Jung <post@ralfj.de>2018-09-16 14:26:27 +0200
committerRalf Jung <post@ralfj.de>2018-09-16 14:26:27 +0200
commit357c5dacee1015dc03583287d0c7a132d9fe7880 (patch)
tree5e44f431db49ac13069b06daa9ec5ec004615737 /src/liballoc
parent61f0a2b3fd961c9ae6d327d384bcffabf89a1c26 (diff)
downloadrust-357c5dacee1015dc03583287d0c7a132d9fe7880.tar.gz
rust-357c5dacee1015dc03583287d0c7a132d9fe7880.zip
use mem::zeroed to make up ZST values
Diffstat (limited to 'src/liballoc')
-rw-r--r--src/liballoc/vec.rs8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/liballoc/vec.rs b/src/liballoc/vec.rs
index 02393a185b1..7fc4453fec5 100644
--- a/src/liballoc/vec.rs
+++ b/src/liballoc/vec.rs
@@ -2410,8 +2410,8 @@ impl<T> Iterator for IntoIter<T> {
                     // same pointer.
                     self.ptr = arith_offset(self.ptr as *const i8, 1) as *mut T;
 
-                    // Read from a properly aligned pointer to make up a value of this ZST.
-                    Some(ptr::read(NonNull::dangling().as_ptr()))
+                    // Make up a value of this ZST.
+                    Some(mem::zeroed())
                 } else {
                     let old = self.ptr;
                     self.ptr = self.ptr.offset(1);
@@ -2450,8 +2450,8 @@ impl<T> DoubleEndedIterator for IntoIter<T> {
                     // See above for why 'ptr.offset' isn't used
                     self.end = arith_offset(self.end as *const i8, -1) as *mut T;
 
-                    // Read from a properly aligned pointer to make up a value of this ZST.
-                    Some(ptr::read(NonNull::dangling().as_ptr()))
+                    // Make up a value of this ZST.
+                    Some(mem::zeroed())
                 } else {
                     self.end = self.end.offset(-1);