Skip to content

Commit

Permalink
fix 2
Browse files Browse the repository at this point in the history
  • Loading branch information
MikailBag committed May 12, 2020
1 parent 7b656d3 commit 7a98b67
Show file tree
Hide file tree
Showing 6 changed files with 11 additions and 15 deletions.
12 changes: 6 additions & 6 deletions tokio/src/io/async_read.rs
Original file line number Diff line number Diff line change
Expand Up @@ -96,13 +96,13 @@ pub trait AsyncRead {
///
/// [`io::Read`]: std::io::Read
/// [`poll_read_buf`]: #method.poll_read_buf
unsafe fn prepare_uninitialized_buffer(&self, buf: &mut [MaybeUninit<u8>]) -> bool; /* {
for x in buf {
*x.as_mut_ptr() = 0;
}
unsafe fn prepare_uninitialized_buffer(&self, buf: &mut [MaybeUninit<u8>]) -> bool {
for x in buf {
*x.as_mut_ptr() = 0;
}

true
}*/
true
}

/// Attempts to read from the `AsyncRead` into `buf`.
///
Expand Down
4 changes: 0 additions & 4 deletions tokio/src/io/split.rs
Original file line number Diff line number Diff line change
Expand Up @@ -99,10 +99,6 @@ impl<T> WriteHalf<T> {
}

impl<T: AsyncRead> AsyncRead for ReadHalf<T> {
unsafe fn prepare_uninitialized_buffer(&self, buf: &mut [std::mem::MaybeUninit<u8>]) -> bool {
panic!()
}

fn poll_read(
self: Pin<&mut Self>,
cx: &mut Context<'_>,
Expand Down
2 changes: 1 addition & 1 deletion tokio/src/io/stdin.rs
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ impl std::os::windows::io::AsRawHandle for Stdin {
}

impl AsyncRead for Stdin {
unsafe fn prepare_uninitialized_buffer(&self, buf: &mut [std::mem::MaybeUninit<u8>]) -> bool {
unsafe fn prepare_uninitialized_buffer(&self, _buf: &mut [std::mem::MaybeUninit<u8>]) -> bool {
// https://github.com/rust-lang/rust/blob/09c817eeb29e764cfc12d0a8d94841e3ffe34023/src/libstd/io/stdio.rs#L97
false
}
Expand Down
2 changes: 1 addition & 1 deletion tokio/src/io/util/empty.rs
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ cfg_io_util! {
}

impl AsyncRead for Empty {
unsafe fn prepare_uninitialized_buffer(&self, buf: &mut [std::mem::MaybeUninit<u8>]) -> bool {
unsafe fn prepare_uninitialized_buffer(&self, _buf: &mut [std::mem::MaybeUninit<u8>]) -> bool {
false
}
#[inline]
Expand Down
2 changes: 1 addition & 1 deletion tokio/src/io/util/repeat.rs
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ cfg_io_util! {
}

impl AsyncRead for Repeat {
unsafe fn prepare_uninitialized_buffer(&self, buf: &mut [std::mem::MaybeUninit<u8>]) -> bool {
unsafe fn prepare_uninitialized_buffer(&self, _buf: &mut [std::mem::MaybeUninit<u8>]) -> bool {
false
}
#[inline]
Expand Down
4 changes: 2 additions & 2 deletions tokio/src/process/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -872,7 +872,7 @@ impl AsyncWrite for ChildStdin {
}

impl AsyncRead for ChildStdout {
unsafe fn prepare_uninitialized_buffer(&self, buf: &mut [std::mem::MaybeUninit<u8>]) -> bool {
unsafe fn prepare_uninitialized_buffer(&self, _buf: &mut [std::mem::MaybeUninit<u8>]) -> bool {
// https://github.com/rust-lang/rust/blob/09c817eeb29e764cfc12d0a8d94841e3ffe34023/src/libstd/process.rs#L314
false
}
Expand All @@ -887,7 +887,7 @@ impl AsyncRead for ChildStdout {
}

impl AsyncRead for ChildStderr {
unsafe fn prepare_uninitialized_buffer(&self, buf: &mut [std::mem::MaybeUninit<u8>]) -> bool {
unsafe fn prepare_uninitialized_buffer(&self, _buf: &mut [std::mem::MaybeUninit<u8>]) -> bool {
// https://github.com/rust-lang/rust/blob/09c817eeb29e764cfc12d0a8d94841e3ffe34023/src/libstd/process.rs#L375
false
}
Expand Down

0 comments on commit 7a98b67

Please sign in to comment.