From 9c1698e2f10a9f575829f9e5737ae7ec3d773680 Mon Sep 17 00:00:00 2001 From: Maik Klein Date: Sun, 18 Jun 2017 13:52:21 +0200 Subject: [PATCH] [Fix] Incorrect copying from slice --- ash/src/util.rs | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/ash/src/util.rs b/ash/src/util.rs index 4c89ec0..44bb901 100644 --- a/ash/src/util.rs +++ b/ash/src/util.rs @@ -72,9 +72,8 @@ impl Align { 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]; } }