From 0af3bd01dfae488392dc6f08daa2d0d8d370fb00 Mon Sep 17 00:00:00 2001 From: Ralf Jung Date: Wed, 2 Sep 2020 12:34:15 +0200 Subject: [PATCH] Read: adjust a FIXME reference --- library/std/src/io/util.rs | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/library/std/src/io/util.rs b/library/std/src/io/util.rs index b3df6f49dc4..44d2937ee1b 100644 --- a/library/std/src/io/util.rs +++ b/library/std/src/io/util.rs @@ -52,11 +52,14 @@ where W: Write, { let mut buf = MaybeUninit::<[u8; super::DEFAULT_BUF_SIZE]>::uninit(); - // FIXME(#76092): This is calling `get_mut` and `get_ref` on an uninitialized - // `MaybeUninit`. Revisit this once we decided whether that is valid or not. - // This is still technically undefined behavior due to creating a reference - // to uninitialized data, but within libstd we can rely on more guarantees - // than if this code were in an external lib. + // FIXME: #42788 + // + // - This creates a (mut) reference to a slice of + // _uninitialized_ integers, which is **undefined behavior** + // + // - Only the standard library gets to soundly "ignore" this, + // based on its privileged knowledge of unstable rustc + // internals; unsafe { reader.initializer().initialize(buf.assume_init_mut()); }