We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 330ddf1 commit fcca559Copy full SHA for fcca559
src/proto/h1/io.rs
@@ -3,7 +3,6 @@ use std::fmt;
3
#[cfg(feature = "server")]
4
use std::future::Future;
5
use std::io::{self, IoSlice};
6
-use std::mem::MaybeUninit;
7
use std::pin::Pin;
8
use std::task::{Context, Poll};
9
@@ -246,8 +245,9 @@ where
246
245
self.read_buf.reserve(next);
247
}
248
249
- let dst = self.read_buf.chunk_mut();
250
- let dst = unsafe { &mut *(dst as *mut _ as *mut [MaybeUninit<u8>]) };
+ // SAFETY: ReadBuf and poll_read promise not to set any uninitialized
+ // bytes onto `dst`.
+ let dst = unsafe { self.read_buf.chunk_mut().as_uninit_slice_mut() };
251
let mut buf = ReadBuf::uninit(dst);
252
match Pin::new(&mut self.io).poll_read(cx, buf.unfilled()) {
253
Poll::Ready(Ok(_)) => {
0 commit comments