Skip to content

Move std::io into alloc and core #156527

Open
bushrat011899 wants to merge 42 commits into
rust-lang:mainfrom
bushrat011899:core_io_test_merge
Open

Move std::io into alloc and core #156527
bushrat011899 wants to merge 42 commits into
rust-lang:mainfrom
bushrat011899:core_io_test_merge

Conversation

@bushrat011899
Copy link
Copy Markdown
Contributor

@bushrat011899 bushrat011899 commented May 13, 2026

View all comments

ACP: rust-lang/libs-team#755
Tracking issue: #154046
Blocked on: #155625
Blocked on: #155849

Description

Moves as much of std::io into core::io and alloc::io as practically possible. This PR itself is likely too large to be reasonably reviewed and merged in one go, so I'm dividing it into multiple smaller ones. Each commit in this PR is intended to be as small as possible while still being able to pass CI.

Notable Changes

  • Please refer to Move std::io::Error into core #155625 for changes required to facilitate std::io::Error being moved into core::io
  • Having Cursor in core::io requires a blanket implemented trait to allow implementation for alloc types, such as &mut Vec<u8>. This is done by WriteThroughCursor.
  • Several Read and Write implementations that have been moved to alloc have been altered to account for the no_global_oom_handling configuration option. The only observable change is cases where an OOM event would occur will cause the relevant IO operation to return an OutOfMemory kind of io::Error, rather than deferring to the global OOM error handler.
  • Write and Seek are available in core::io, while Read and BufRead are moved to alloc::io. Since BufRead depends on Read, and Read has methods that contain Vec and String in their signature, it would require substantial changes to move everything into core.

Notes

  • No AI tooling of any kind was used during the creation of this PR.

@rustbot rustbot added O-unix Operating system: Unix-like S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. T-libs Relevant to the library team, which will review and decide on the PR/issue. labels May 13, 2026
@rust-log-analyzer

This comment has been minimized.

@rust-log-analyzer

This comment has been minimized.

Comment thread library/std/src/io/mod.rs Outdated
Comment thread library/std/src/sys/stdio/unix.rs Outdated
@rust-log-analyzer

This comment has been minimized.

@rust-log-analyzer

This comment has been minimized.

@rust-log-analyzer

This comment has been minimized.

@rust-bors

This comment has been minimized.

@rust-log-analyzer

This comment has been minimized.

@rust-log-analyzer

This comment has been minimized.

@rust-log-analyzer

This comment has been minimized.

@bushrat011899 bushrat011899 force-pushed the core_io_test_merge branch 2 times, most recently from e8e89b9 to 8ca7764 Compare May 19, 2026 10:45
@rust-log-analyzer

This comment has been minimized.

@rust-log-analyzer

This comment has been minimized.

@rust-log-analyzer

This comment has been minimized.

@rust-log-analyzer

This comment has been minimized.

@rustbot rustbot added the O-windows Operating system: Windows label May 19, 2026
@bushrat011899

This comment was marked as resolved.

@rustbot rustbot removed the A-LLVM Area: Code generation parts specific to LLVM. Both correctness bugs and optimization-related issues. label May 24, 2026
@bushrat011899 bushrat011899 changed the title [WIP]: Move std::io into alloc and core Move std::io into alloc and core May 24, 2026
@bushrat011899
Copy link
Copy Markdown
Contributor Author

This PR is ready, but blocked on the two PRs mentioned in the description. If/when they are merged, I will split off more commits into other PRs.
@rustbot blocked

@rustbot rustbot added S-blocked Status: Blocked on something else such as an RFC or other implementation work. and removed S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. labels May 24, 2026
@bushrat011899 bushrat011899 marked this pull request as ready for review May 24, 2026 11:47
@rustbot rustbot added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label May 24, 2026
@rustbot
Copy link
Copy Markdown
Collaborator

rustbot commented May 24, 2026

r? @Mark-Simulacrum

rustbot has assigned @Mark-Simulacrum.
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: @ChrisDenton, libs
  • @ChrisDenton, libs expanded to 8 candidates

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

Labels

O-unix Operating system: Unix-like O-windows Operating system: Windows S-blocked Status: Blocked on something else such as an RFC or other implementation work. S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. T-libs Relevant to the library team, which will review and decide on the PR/issue. T-rustdoc-frontend Relevant to the rustdoc-frontend team, which will review and decide on the web UI/UX output.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants