Skip to content

Commit fc9dfda

Browse files
authored
Rollup merge of rust-lang#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.
2 parents 571734f + 38cbdcd commit fc9dfda

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/libcore/fmt/num.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ trait GenericRadix {
6363
// characters for a base 2 number.
6464
let zero = T::zero();
6565
let is_nonnegative = x >= zero;
66-
let mut buf = [0; 128];
66+
let mut buf: [u8; 128] = unsafe { mem::uninitialized() };
6767
let mut curr = buf.len();
6868
let base = T::from_u8(Self::BASE);
6969
if is_nonnegative {

0 commit comments

Comments
 (0)