Rollup merge of #49103 - glandium:uninitialized, r=cramertj

Use an uninitialized buffer in GenericRadix::fmt_int, like in Display::fmt for numeric types

The code using a slice of that buffer is only ever going to use
bytes that are subsequently initialized.
This commit is contained in:
Tim Neumann 2018-03-26 15:14:56 +02:00 committed by GitHub
commit fc9dfda6ad
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -63,7 +63,7 @@ trait GenericRadix {
// characters for a base 2 number.
let zero = T::zero();
let is_nonnegative = x >= zero;
let mut buf = [0; 128];
let mut buf: [u8; 128] = unsafe { mem::uninitialized() };
let mut curr = buf.len();
let base = T::from_u8(Self::BASE);
if is_nonnegative {