Skip to content

Commit 6d2b885

Browse files
authored
Rollup merge of #76242 - RalfJung:read-fixme, r=Dylan-DPC
Read: adjust a FIXME reference There's already another reference to #42788 for basically the same problem, so lets reuse it here: https://github.com/rust-lang/rust/blob/5e208efaa850efaa97495e81c49cf0f5767e8f49/library/std/src/io/mod.rs#L369-L376 r? @Dylan-DPC
2 parents 4918ed9 + 0af3bd0 commit 6d2b885

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

library/std/src/io/util.rs

+8-5
Original file line numberDiff line numberDiff line change
@@ -52,11 +52,14 @@ where
5252
W: Write,
5353
{
5454
let mut buf = MaybeUninit::<[u8; super::DEFAULT_BUF_SIZE]>::uninit();
55-
// FIXME(#76092): This is calling `get_mut` and `get_ref` on an uninitialized
56-
// `MaybeUninit`. Revisit this once we decided whether that is valid or not.
57-
// This is still technically undefined behavior due to creating a reference
58-
// to uninitialized data, but within libstd we can rely on more guarantees
59-
// than if this code were in an external lib.
55+
// FIXME: #42788
56+
//
57+
// - This creates a (mut) reference to a slice of
58+
// _uninitialized_ integers, which is **undefined behavior**
59+
//
60+
// - Only the standard library gets to soundly "ignore" this,
61+
// based on its privileged knowledge of unstable rustc
62+
// internals;
6063
unsafe {
6164
reader.initializer().initialize(buf.assume_init_mut());
6265
}

0 commit comments

Comments
 (0)