Skip to content

Commit 83b7397

Browse files
authored
io: drop the Sized requirements from AsyncReadExt.read_buf (#6169)
1 parent 3991f9f commit 83b7397

File tree

2 files changed

+7
-7
lines changed

2 files changed

+7
-7
lines changed

tokio/src/io/util/async_read_ext.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -245,8 +245,8 @@ cfg_io_util! {
245245
/// ```
246246
fn read_buf<'a, B>(&'a mut self, buf: &'a mut B) -> ReadBuf<'a, Self, B>
247247
where
248-
Self: Sized + Unpin,
249-
B: BufMut,
248+
Self: Unpin,
249+
B: BufMut + ?Sized,
250250
{
251251
read_buf(self, buf)
252252
}

tokio/src/io/util/read_buf.rs

+5-5
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@ use std::task::{Context, Poll};
1010

1111
pub(crate) fn read_buf<'a, R, B>(reader: &'a mut R, buf: &'a mut B) -> ReadBuf<'a, R, B>
1212
where
13-
R: AsyncRead + Unpin,
14-
B: BufMut,
13+
R: AsyncRead + Unpin + ?Sized,
14+
B: BufMut + ?Sized,
1515
{
1616
ReadBuf {
1717
reader,
@@ -24,7 +24,7 @@ pin_project! {
2424
/// Future returned by [`read_buf`](crate::io::AsyncReadExt::read_buf).
2525
#[derive(Debug)]
2626
#[must_use = "futures do nothing unless you `.await` or poll them"]
27-
pub struct ReadBuf<'a, R, B> {
27+
pub struct ReadBuf<'a, R: ?Sized, B: ?Sized> {
2828
reader: &'a mut R,
2929
buf: &'a mut B,
3030
#[pin]
@@ -34,8 +34,8 @@ pin_project! {
3434

3535
impl<R, B> Future for ReadBuf<'_, R, B>
3636
where
37-
R: AsyncRead + Unpin,
38-
B: BufMut,
37+
R: AsyncRead + Unpin + ?Sized,
38+
B: BufMut + ?Sized,
3939
{
4040
type Output = io::Result<usize>;
4141

0 commit comments

Comments
 (0)