diff options
| author | Ralf Jung <post@ralfj.de> | 2019-07-17 09:51:58 +0200 |
|---|---|---|
| committer | Ralf Jung <post@ralfj.de> | 2019-07-19 09:45:38 +0200 |
| commit | 13ed0cf9e86a4fdbf75152849353050fea5d4461 (patch) | |
| tree | e36efbef3abc4f5770aca642b0d8aca04fa47803 /src/libcore | |
| parent | 33452b0587ad543c6d7cc0f41daad6d4be71842f (diff) | |
| download | rust-13ed0cf9e86a4fdbf75152849353050fea5d4461.tar.gz rust-13ed0cf9e86a4fdbf75152849353050fea5d4461.zip | |
do not use mem::uninitialized in std::io
Diffstat (limited to 'src/libcore')
| -rw-r--r-- | src/libcore/fmt/float.rs | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/src/libcore/fmt/float.rs b/src/libcore/fmt/float.rs index 4bd7d3b4b22..a2fff913ac7 100644 --- a/src/libcore/fmt/float.rs +++ b/src/libcore/fmt/float.rs @@ -12,10 +12,11 @@ fn float_to_decimal_common_exact<T>(fmt: &mut Formatter<'_>, num: &T, unsafe { let mut buf = MaybeUninit::<[u8; 1024]>::uninit(); // enough for f32 and f64 let mut parts = MaybeUninit::<[flt2dec::Part<'_>; 4]>::uninit(); - // FIXME(#53491): Technically, this is calling `get_mut` on an uninitialized - // `MaybeUninit` (here and elsewhere in this file). Revisit this once + // FIXME(#53491): This is calling `get_mut` on an uninitialized + // `MaybeUninit` (here and elsewhere in this file). Revisit this once // we decided whether that is valid or not. - // Using `freeze` is *not enough*; `flt2dec::Part` is an enum! + // We can do this only because we are libstd and coupled to the compiler. + // (FWIW, using `freeze` would not be enough; `flt2dec::Part` is an enum!) let formatted = flt2dec::to_exact_fixed_str(flt2dec::strategy::grisu::format_exact, *num, sign, precision, false, buf.get_mut(), parts.get_mut()); |
