diff --git a/Cargo.toml b/Cargo.toml index 29266225a8..878618c35d 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -115,7 +115,6 @@ restriction = { level = "warn", priority = -2 } arithmetic_side_effects = "allow" # TODO: consider as_conversions = "allow" # TODO: tricky -borrow_as_ptr = "allow" cast_possible_truncation = "allow" # TODO: consider cast_precision_loss = "allow" # TODO: consider checked_conversions = "allow" diff --git a/src/rt/io.rs b/src/rt/io.rs index 54d00be2d3..21c8ed9c7c 100644 --- a/src/rt/io.rs +++ b/src/rt/io.rs @@ -258,7 +258,7 @@ impl<'data> ReadBuf<'data> { #[inline] pub fn filled(&self) -> &[u8] { // SAFETY: We only slice the filled part of the buffer, which is always valid - unsafe { &*(&self.raw[0..self.filled] as *const [MaybeUninit] as *const [u8]) } + unsafe { &*(std::ptr::addr_of!(self.raw[0..self.filled]) as *const [u8]) } } /// Get a cursor to the unfilled portion of the buffer.