diff options
| author | Michael Goulet <michael@errs.io> | 2023-06-16 12:53:21 -0700 | 
|---|---|---|
| committer | GitHub <noreply@github.com> | 2023-06-16 12:53:21 -0700 | 
| commit | c55af41e7a8388a022049f21a93b68626b36bc90 (patch) | |
| tree | 37bdf49a94a40fb6487c2c6a335fddbf06227b4a /library/std/src/io/copy.rs | |
| parent | 6a94e87a54ecf2df307c65af2dbc2effb3a525b8 (diff) | |
| parent | 29302a204c1f5a1ac1c114cbdb17c32a24da8367 (diff) | |
| download | rust-c55af41e7a8388a022049f21a93b68626b36bc90.tar.gz rust-c55af41e7a8388a022049f21a93b68626b36bc90.zip | |
Rollup merge of #111074 - WaffleLapkin:🌟unsizes_your_buf_reader🌟, r=Amanieu
Relax implicit `T: Sized` bounds on `BufReader<T>`, `BufWriter<T>` and `LineWriter<T>`
TL;DR:
```diff,rust
-pub struct BufReader<R> { /* ... */ }
+pub struct BufReader<R: ?Sized> { /* ... */ }
-pub struct BufWriter<W: Write> { /* ... */ }
+pub struct BufWriter<W: ?Sized + Write> { /* ... */ }
-pub struct LineWriter<W: Write> { /* ... */ }
+pub struct LineWriter<W: ?Sized + Write> { /* ... */ }
```
This allows using `&mut BufReader<dyn Read>`, for example.
**This is an insta-stable change**.
Diffstat (limited to 'library/std/src/io/copy.rs')
| -rw-r--r-- | library/std/src/io/copy.rs | 2 | 
1 files changed, 1 insertions, 1 deletions
| diff --git a/library/std/src/io/copy.rs b/library/std/src/io/copy.rs index 1d9d93f5b64..420fc400705 100644 --- a/library/std/src/io/copy.rs +++ b/library/std/src/io/copy.rs @@ -86,7 +86,7 @@ impl<W: Write + ?Sized> BufferedCopySpec for W { } } -impl<I: Write> BufferedCopySpec for BufWriter<I> { +impl<I: ?Sized + Write> BufferedCopySpec for BufWriter<I> { fn copy_to<R: Read + ?Sized>(reader: &mut R, writer: &mut Self) -> Result<u64> { if writer.capacity() < DEFAULT_BUF_SIZE { return stack_buffer_copy(reader, writer); | 
