[Fix] Incorrect copying from slice

This commit is contained in:
Maik Klein 2017-06-18 13:52:21 +02:00
parent 80743e9314
commit 9c1698e2f1

View file

@ -72,9 +72,8 @@ impl<T: Copy> Align<T> {
let mapped_slice = from_raw_parts_mut(self.ptr as *mut T, slice.len());
mapped_slice.copy_from_slice(slice);
}
}
else{
for (i, val) in self.iter_mut().enumerate() {
} else {
for (i, val) in self.iter_mut().enumerate().take(slice.len()) {
*val = slice[i];
}
}