mirror of
https://github.com/rust-lang/rust.git
synced 2025-01-23 21:23:20 +00:00
Read: adjust a FIXME reference
This commit is contained in:
parent
e88e908e66
commit
0af3bd01df
@ -52,11 +52,14 @@ where
|
|||||||
W: Write,
|
W: Write,
|
||||||
{
|
{
|
||||||
let mut buf = MaybeUninit::<[u8; super::DEFAULT_BUF_SIZE]>::uninit();
|
let mut buf = MaybeUninit::<[u8; super::DEFAULT_BUF_SIZE]>::uninit();
|
||||||
// FIXME(#76092): This is calling `get_mut` and `get_ref` on an uninitialized
|
// FIXME: #42788
|
||||||
// `MaybeUninit`. Revisit this once we decided whether that is valid or not.
|
//
|
||||||
// This is still technically undefined behavior due to creating a reference
|
// - This creates a (mut) reference to a slice of
|
||||||
// to uninitialized data, but within libstd we can rely on more guarantees
|
// _uninitialized_ integers, which is **undefined behavior**
|
||||||
// than if this code were in an external lib.
|
//
|
||||||
|
// - Only the standard library gets to soundly "ignore" this,
|
||||||
|
// based on its privileged knowledge of unstable rustc
|
||||||
|
// internals;
|
||||||
unsafe {
|
unsafe {
|
||||||
reader.initializer().initialize(buf.assume_init_mut());
|
reader.initializer().initialize(buf.assume_init_mut());
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user