From 83b7397e44011f695bfd546516bcdb5397b6cfc2 Mon Sep 17 00:00:00 2001 From: tijsvd <34085809+tijsvd@users.noreply.github.com> Date: Fri, 8 Dec 2023 09:51:08 +0100 Subject: [PATCH] io: drop the `Sized` requirements from `AsyncReadExt.read_buf` (#6169) --- tokio/src/io/util/async_read_ext.rs | 4 ++-- tokio/src/io/util/read_buf.rs | 10 +++++----- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/tokio/src/io/util/async_read_ext.rs b/tokio/src/io/util/async_read_ext.rs index 7588f822fb6..11bd42448ab 100644 --- a/tokio/src/io/util/async_read_ext.rs +++ b/tokio/src/io/util/async_read_ext.rs @@ -245,8 +245,8 @@ cfg_io_util! { /// ``` fn read_buf<'a, B>(&'a mut self, buf: &'a mut B) -> ReadBuf<'a, Self, B> where - Self: Sized + Unpin, - B: BufMut, + Self: Unpin, + B: BufMut + ?Sized, { read_buf(self, buf) } diff --git a/tokio/src/io/util/read_buf.rs b/tokio/src/io/util/read_buf.rs index 8ec57c0d6f6..750497c9e0c 100644 --- a/tokio/src/io/util/read_buf.rs +++ b/tokio/src/io/util/read_buf.rs @@ -10,8 +10,8 @@ use std::task::{Context, Poll}; pub(crate) fn read_buf<'a, R, B>(reader: &'a mut R, buf: &'a mut B) -> ReadBuf<'a, R, B> where - R: AsyncRead + Unpin, - B: BufMut, + R: AsyncRead + Unpin + ?Sized, + B: BufMut + ?Sized, { ReadBuf { reader, @@ -24,7 +24,7 @@ pin_project! { /// Future returned by [`read_buf`](crate::io::AsyncReadExt::read_buf). #[derive(Debug)] #[must_use = "futures do nothing unless you `.await` or poll them"] - pub struct ReadBuf<'a, R, B> { + pub struct ReadBuf<'a, R: ?Sized, B: ?Sized> { reader: &'a mut R, buf: &'a mut B, #[pin] @@ -34,8 +34,8 @@ pin_project! { impl Future for ReadBuf<'_, R, B> where - R: AsyncRead + Unpin, - B: BufMut, + R: AsyncRead + Unpin + ?Sized, + B: BufMut + ?Sized, { type Output = io::Result;