Migrate rest of std::io to alloc#154684
Conversation
|
rustbot has assigned @Mark-Simulacrum. Use Why was this reviewer chosen?The reviewer was selected based on:
|
|
This PR was rebased onto a different main commit. Here's a range-diff highlighting what actually changed. Rebasing is a normal part of keeping PRs up to date, so no action is needed—this note is just to help reviewers. |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This is a separated commit to be easy to reverse later.
This reverts commit 6a30319.
|
The job Click to see the possible cause of the failure (guessed by this bot) |
|
☔ The latest upstream changes (presumably #154832) made this pull request unmergeable. Please resolve the merge conflicts. |
| #[stable(feature = "arc_io_traits", since = "CURRENT_RUSTC_VERSION")] | ||
| #[cfg(all(not(no_rc), not(no_sync), target_has_atomic = "ptr"))] | ||
| impl<R> Read for Arc<R> | ||
| where | ||
| R: Read, | ||
| for<'a> &'a R: Read, | ||
| { | ||
| fn read(&mut self, buf: &mut [u8]) -> io::Result<usize> { | ||
| (&**self).read(buf) | ||
| } | ||
| fn read_vectored(&mut self, bufs: &mut [IoSliceMut<'_>]) -> io::Result<usize> { | ||
| (&**self).read_vectored(bufs) | ||
| } | ||
| fn read_buf(&mut self, cursor: BorrowedCursor<'_>) -> io::Result<()> { | ||
| (&**self).read_buf(cursor) | ||
| } | ||
| #[inline] | ||
| fn is_read_vectored(&self) -> bool { | ||
| (&**self).is_read_vectored() | ||
| } | ||
| fn read_to_end(&mut self, buf: &mut Vec<u8>) -> io::Result<usize> { | ||
| (&**self).read_to_end(buf) | ||
| } | ||
| fn read_to_string(&mut self, buf: &mut String) -> io::Result<usize> { | ||
| (&**self).read_to_string(buf) | ||
| } | ||
| } | ||
| #[stable(feature = "arc_io_traits", since = "CURRENT_RUSTC_VERSION")] | ||
| #[cfg(all(not(no_rc), not(no_sync), target_has_atomic = "ptr"))] | ||
| impl<W> Write for Arc<W> | ||
| where | ||
| W: Write, | ||
| for<'a> &'a W: Write, | ||
| { | ||
| fn write(&mut self, buf: &[u8]) -> io::Result<usize> { | ||
| (&**self).write(buf) | ||
| } | ||
| fn write_vectored(&mut self, bufs: &[IoSlice<'_>]) -> io::Result<usize> { | ||
| (&**self).write_vectored(bufs) | ||
| } | ||
| #[inline] | ||
| fn is_write_vectored(&self) -> bool { | ||
| (&**self).is_write_vectored() | ||
| } | ||
| #[inline] | ||
| fn flush(&mut self) -> io::Result<()> { | ||
| (&**self).flush() | ||
| } | ||
| } | ||
| #[stable(feature = "arc_io_traits", since = "CURRENT_RUSTC_VERSION")] | ||
| #[cfg(all(not(no_rc), not(no_sync), target_has_atomic = "ptr"))] | ||
| impl<S> Seek for Arc<S> | ||
| where | ||
| S: Seek, | ||
| for<'a> &'a S: Seek, | ||
| { | ||
| fn seek(&mut self, pos: SeekFrom) -> io::Result<u64> { | ||
| (&**self).seek(pos) | ||
| } | ||
| fn stream_len(&mut self) -> io::Result<u64> { | ||
| (&**self).stream_len() | ||
| } | ||
| fn stream_position(&mut self) -> io::Result<u64> { | ||
| (&**self).stream_position() | ||
| } | ||
| } |
There was a problem hiding this comment.
These implementations have some potential issues. See #155684 for just this problem split out into its own PR.
Move `std::io::Cursor` to `core::io` ACP: rust-lang/libs-team#755 Tracking issue: rust-lang#154046 Subset of: rust-lang#154684 ## Description Moves `std::io::Cursor` to `core::io`, leaving the IO trait implementations behind. They will be moved along with the traits themselves. Certain documentation links had to be amended, and a private/unstable `into_parts_mut` method was added to allow the internals to remain private. --- ## Notes * This can be reviewed independently of the other PRs tracked in rust-lang#154046. * No AI tooling of any kind was used during the creation of this PR.
Move `std::io::util` to `core::io` ACP: rust-lang/libs-team#755 Tracking issue: rust-lang#154046 Subset of: rust-lang#154684 ## Description Moves utility types and functions from `std::io::util` and `std::io` to `core::io`, leaving any IO trait implementations behind. They will be moved along with the traits themselves. Certain documentation links had to be amended. - `Chain` - `Empty` - `Repeat` - `Sink` - `Take` - `empty` - `repeat` - `sink` --- ## Notes * This can be reviewed independently of the other PRs tracked in rust-lang#154046. * `Chain` and `Take` were previously in the main `mod.rs` file for `std::io`, but I've chosen to move them into the `util.rs` file in `core::io` instead. I think they make more sense in that file, but I'm happy to move them into `mod.rs` if that's a controversial decision. * No AI tooling of any kind was used during the creation of this PR.
Rollup merge of #156428 - bushrat011899:core_io_cursor, r=nia-e Move `std::io::Cursor` to `core::io` ACP: rust-lang/libs-team#755 Tracking issue: #154046 Subset of: #154684 ## Description Moves `std::io::Cursor` to `core::io`, leaving the IO trait implementations behind. They will be moved along with the traits themselves. Certain documentation links had to be amended, and a private/unstable `into_parts_mut` method was added to allow the internals to remain private. --- ## Notes * This can be reviewed independently of the other PRs tracked in #154046. * No AI tooling of any kind was used during the creation of this PR.
Based on #152918
Tracking issue: #154046
Special things to note:
allocdoc testsArc. Unlike Generalize io for Arc #130675, this PR restricts the implementation more to avoid bad implementations such asArc<[u8]>.Another way to do this would be to bypass orphan rule. Is it possible in
std?