Skip to content

Move IoSlice and IoSliceMut to core::io#155849

Open
bushrat011899 wants to merge 1 commit intorust-lang:mainfrom
bushrat011899:io_slice_in_core
Open

Move IoSlice and IoSliceMut to core::io#155849
bushrat011899 wants to merge 1 commit intorust-lang:mainfrom
bushrat011899:io_slice_in_core

Conversation

@bushrat011899
Copy link
Copy Markdown
Contributor

@bushrat011899 bushrat011899 commented Apr 27, 2026

View all comments

ACP: rust-lang/libs-team#755
Tracking issue: #154046
Related: #152918
Related: #155625

Description

Moves std::io::IoSlice and std::io::IoSliceMut into core::io. This is required for the Read and Write traits to be moved into alloc and/or core, as they contain stable methods which work with IO slices. Similar to #155574, this PR inlines the std::sys types required to create an ABI compatible type for the platforms where such compatibility is guaranteed.

Additionally, I've moved the relevant tests out of std::io::tests into coretests::io::io_slice.


Notes

  • This PR overlaps with Move OS-dependent parts of std::io to alloc #152918, but goes further than moving the IO slice types to alloc and instead moves them straight to core. Since these types have no interaction with allocation, and doing so will allow Write to move to core::io, I consider this a better home for these types.
  • Some discussion around the decision to not use a core::sys module can be found here.
  • I've renamed unsupported to generic to better reflect that IoSlice(Mut) is supported by all platforms, it just doesn't have a special ABI-compatible type. I don't want to imply that parts of core "don't work" depending on the target; IoSlice(Mut) works exactly as expected on all targets.
  • I've made pub items within each platform-specific representation pub(super) to highlight that everything within core::io::io_slice is an internal implementation detail not meant for any other part of the crate to be aware of.
  • No AI tooling of any kind was used during the creation of this PR.

@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-libs Relevant to the library team, which will review and decide on the PR/issue. labels Apr 27, 2026
@rustbot
Copy link
Copy Markdown
Collaborator

rustbot commented Apr 27, 2026

r? @jhpratt

rustbot has assigned @jhpratt.
They will have a look at your PR within the next two weeks and either review your PR or reassign to another reviewer.

Use r? to explicitly pick a reviewer

Why was this reviewer chosen?

The reviewer was selected based on:

  • Owners of files modified in this PR: @scottmcm, libs
  • @scottmcm, libs expanded to 7 candidates
  • Random selection from Mark-Simulacrum, jhpratt, scottmcm

@rust-log-analyzer

This comment has been minimized.

@rust-log-analyzer

This comment has been minimized.

@lygstate
Copy link
Copy Markdown
Contributor

a long awating staff, thanks.

@rust-log-analyzer

This comment has been minimized.

@rust-log-analyzer

This comment has been minimized.

@bushrat011899

This comment has been minimized.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-libs Relevant to the library team, which will review and decide on the PR/issue.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants