Skip to content

Commit

Permalink
Auto merge of #43 - mbrubeck:uninit, r=jdm
Browse files Browse the repository at this point in the history
Don't zero the array on initialization

Using `mem::uninitialized` is potentially faster than `mem::zeroed`, and doesn't remove any safety (since both uninitialized memory and zeroed memory are unsafe to read from in general).

<!-- Reviewable:start -->
---
This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/rust-smallvec/43)
<!-- Reviewable:end -->
  • Loading branch information
bors-servo authored Mar 22, 2017
2 parents f9269da + 4ba8345 commit ce94fc6
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,7 @@ impl<A: Array> SmallVec<A> {
unsafe {
SmallVec {
len: 0,
data: Inline { array: mem::zeroed() },
data: Inline { array: mem::uninitialized() },
}
}
}
Expand Down

0 comments on commit ce94fc6

Please sign in to comment.