Skip to content

Move std::io::ErrorKind to core::io#154654

Merged
rust-bors[bot] merged 3 commits intorust-lang:mainfrom
bushrat011899:core_io_error_kind
Apr 20, 2026
Merged

Move std::io::ErrorKind to core::io#154654
rust-bors[bot] merged 3 commits intorust-lang:mainfrom
bushrat011899:core_io_error_kind

Conversation

@bushrat011899
Copy link
Copy Markdown
Contributor

@bushrat011899 bushrat011899 commented Apr 1, 2026

View all comments

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

Description

I consider #154046 to be really important for no_std, but I'm concerned #152918 might be too controversial. As an alternative, I'd like to propose starting small with ErrorKind, since it can be moved somewhat trivially. It has no dependencies on functionality in std, no platform specific behaviour, and could provide an excellent bridging point for no_std IO libraries.

Since std::io::Error implements From<ErrorKind>, libraries could write functions which return Result<T, core::io::ErrorKind>, and therefore be usable in std-using libraries with the ? operator. For that reason, I'd consider this to be a worthwhile change even if the rest of std::io couldn't be moved to core/alloc, and entirely compatible with any efforts to make such a change in the future.

Notes

  • This is my first PR against Rust, please let me know if there's anything I should be doing that I have not done. I tried reading through the library contributors guide but I'm sure I've missed something.
  • No AI tooling of any kind was used in the creation of this PR.
  • I believe it's appropriate that this be a part of the linked tracking issue, but please let me know if that's not the case!

@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 1, 2026
@rustbot
Copy link
Copy Markdown
Collaborator

rustbot commented Apr 1, 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

@rustbot rustbot added T-rustdoc Relevant to the rustdoc 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. labels Apr 1, 2026
@rustbot

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_error_kind branch 2 times, most recently from 8faa574 to 0ef55d6 Compare April 1, 2026 02:22
@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.

@rust-log-analyzer

This comment has been minimized.

@bushrat011899 bushrat011899 force-pushed the core_io_error_kind branch 2 times, most recently from 94753ea to b0ce24e Compare April 1, 2026 04:53
@a1phyr
Copy link
Copy Markdown
Contributor

a1phyr commented Apr 1, 2026

I'm concerned #152918 might be too controversial.

It may be controversial, but it has been accepted in principle by libs-teams, so it should be fine.

@bushrat011899
Copy link
Copy Markdown
Contributor Author

I'm concerned #152918 might be too controversial.

It may be controversial, but it has been accepted in principle by libs-teams, so it should be fine.

I hope so! I really want your PR to land. Regardless of whether it does, this is a good follow-up to go further at basically no cost.

@lygstate
Copy link
Copy Markdown
Contributor

lygstate commented Apr 1, 2026

looks good to me

Comment thread library/core/src/io/error.rs
Comment thread library/core/src/io/error.rs
Comment thread library/std/src/io/error/repr_bitpacked.rs Outdated
@rustbot rustbot added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Apr 4, 2026
@rust-bors rust-bors Bot added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Apr 20, 2026
jhpratt added a commit to jhpratt/rust that referenced this pull request Apr 20, 2026
…r=Mark-Simulacrum

Move `std::io::ErrorKind` to `core::io`

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

## Description

I consider rust-lang#154046 to be really important for `no_std`, but I'm concerned rust-lang#152918 might be too controversial. As an alternative, I'd like to propose starting small with `ErrorKind`, since it can be moved somewhat trivially. It has no dependencies on functionality in `std`, no platform specific behaviour, and could provide an excellent bridging point for `no_std` IO libraries.

Since `std::io::Error` implements `From<ErrorKind>`, libraries could write functions which return `Result<T, core::io::ErrorKind>`, and therefore be usable in `std`-using libraries with the `?` operator. For that reason, I'd consider this to be a worthwhile change even if the rest of `std::io` couldn't be moved to `core`/`alloc`, and entirely compatible with any efforts to make such a change in the future.

## Notes

* This is my first PR against Rust, please let me know if there's anything I should be doing that I have not done. I tried reading through the library contributors guide but I'm sure I've missed _something_.
* No AI tooling of any kind was used in the creation of this PR.
* I believe it's appropriate that this be a part of the linked tracking issue, but please let me know if that's not the case!
rust-bors Bot pushed a commit that referenced this pull request Apr 20, 2026
Rollup of 6 pull requests

Successful merges:

 - #154654 (Move `std::io::ErrorKind` to `core::io`)
 - #155054 (constify `Index(Mut)`, `Deref(Mut)` for `Vec`)
 - #155507 (suggest expect instead of unwrap when arg provided)
 - #154664 (core/num: Implement feature `integer_cast_extras`)
 - #155474 (Rename incremental `cfail`/`cpass` revisions to `bfail`/`bpass`)
 - #155493 (docs(num): fix stale link to `mem::Alignment`)
@JonathanBrouwer
Copy link
Copy Markdown
Contributor

@bors r-
#155534 (comment)

@rust-bors rust-bors Bot added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. and removed S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. labels Apr 20, 2026
@rust-bors
Copy link
Copy Markdown
Contributor

rust-bors Bot commented Apr 20, 2026

This pull request was unapproved.

This PR was contained in a rollup (#155534), which was unapproved.

Comment thread library/std/src/os/windows/fs.rs Outdated
Move `std::io::ErrorKind` to `core::io`
* Update `rustdoc-html` tests for the new path
* Add `core_io` feature to control stability. This replaces the use of `core_io_borrowed_buf` on the `core::io` module itself.
* Re-export `core::io::ErrorKind` in `std::io::error`
@bushrat011899
Copy link
Copy Markdown
Contributor Author

@rustbot ready
I assumed all instances of #![feature(core_io_borrowed_buf)] would need to include #![feature(core_io)], but that's not the case for documentation tests from the looks of it. Unfortunate that it wasn't caught in CI. I'm very sorry for these little mistakes!

@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. and removed S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Apr 20, 2026
@JonathanBrouwer
Copy link
Copy Markdown
Contributor

@bors try jobs=aarch64-msvc-1

@rust-bors

This comment has been minimized.

rust-bors Bot pushed a commit that referenced this pull request Apr 20, 2026
Move `std::io::ErrorKind` to `core::io`


try-job: aarch64-msvc-1
@rust-bors
Copy link
Copy Markdown
Contributor

rust-bors Bot commented Apr 20, 2026

☀️ Try build successful (CI)
Build commit: 4388fd1 (4388fd113335ef85115dddb6c3a59ec4411fc4db, parent: e22c616e4e87914135c1db261a03e0437255335e)

@JonathanBrouwer
Copy link
Copy Markdown
Contributor

JonathanBrouwer commented Apr 20, 2026

@bors r=Mark-Simulacrum

No worries about the little mistakes btw, these are very common and there's not much you can do to prevent them :3

@rust-bors
Copy link
Copy Markdown
Contributor

rust-bors Bot commented Apr 20, 2026

📌 Commit fe2b39f has been approved by Mark-Simulacrum

It is now in the queue for this repository.

@rust-bors rust-bors Bot added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Apr 20, 2026
rust-bors Bot pushed a commit that referenced this pull request Apr 20, 2026
…uwer

Rollup of 11 pull requests

Successful merges:

 - #154654 (Move `std::io::ErrorKind` to `core::io`)
 - #145270 (Fix an ICE observed with an explicit tail-call in a default trait method)
 - #154895 (borrowck: Apply `user_arg_index` nomenclature more broadly)
 - #155213 (resolve: Make sure visibilities of import declarations make sense)
 - #155346 (`single_use_lifetimes`: respect `anonymous_lifetime_in_impl_trait`)
 - #155517 (Add a test for Mach-O `#[link_section]` API inherited from LLVM)
 - #155549 (Remove some unnecessary lifetimes.)
 - #154248 (resolve :  mark repr_simd as internal)
 - #154772 (slightly optimize the `non-camel-case-types` lint)
 - #155541 (Add `#[rust_analyzer::prefer_underscore_import]` to the traits in `rustc_type_ir::inherent`)
 - #155544 (bootstrap: Make "detected modifications" for download-rustc less verbose)
@rust-bors rust-bors Bot merged commit 3ca43dc into rust-lang:main Apr 20, 2026
12 checks passed
@rustbot rustbot added this to the 1.97.0 milestone Apr 20, 2026
rust-timer added a commit that referenced this pull request Apr 20, 2026
Rollup merge of #154654 - bushrat011899:core_io_error_kind, r=Mark-Simulacrum

Move `std::io::ErrorKind` to `core::io`

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

## Description

I consider #154046 to be really important for `no_std`, but I'm concerned #152918 might be too controversial. As an alternative, I'd like to propose starting small with `ErrorKind`, since it can be moved somewhat trivially. It has no dependencies on functionality in `std`, no platform specific behaviour, and could provide an excellent bridging point for `no_std` IO libraries.

Since `std::io::Error` implements `From<ErrorKind>`, libraries could write functions which return `Result<T, core::io::ErrorKind>`, and therefore be usable in `std`-using libraries with the `?` operator. For that reason, I'd consider this to be a worthwhile change even if the rest of `std::io` couldn't be moved to `core`/`alloc`, and entirely compatible with any efforts to make such a change in the future.

## Notes

* This is my first PR against Rust, please let me know if there's anything I should be doing that I have not done. I tried reading through the library contributors guide but I'm sure I've missed _something_.
* No AI tooling of any kind was used in the creation of this PR.
* I believe it's appropriate that this be a part of the linked tracking issue, but please let me know if that's not the case!
github-actions Bot pushed a commit to rust-lang/rustc-dev-guide that referenced this pull request Apr 21, 2026
…uwer

Rollup of 11 pull requests

Successful merges:

 - rust-lang/rust#154654 (Move `std::io::ErrorKind` to `core::io`)
 - rust-lang/rust#145270 (Fix an ICE observed with an explicit tail-call in a default trait method)
 - rust-lang/rust#154895 (borrowck: Apply `user_arg_index` nomenclature more broadly)
 - rust-lang/rust#155213 (resolve: Make sure visibilities of import declarations make sense)
 - rust-lang/rust#155346 (`single_use_lifetimes`: respect `anonymous_lifetime_in_impl_trait`)
 - rust-lang/rust#155517 (Add a test for Mach-O `#[link_section]` API inherited from LLVM)
 - rust-lang/rust#155549 (Remove some unnecessary lifetimes.)
 - rust-lang/rust#154248 (resolve :  mark repr_simd as internal)
 - rust-lang/rust#154772 (slightly optimize the `non-camel-case-types` lint)
 - rust-lang/rust#155541 (Add `#[rust_analyzer::prefer_underscore_import]` to the traits in `rustc_type_ir::inherent`)
 - rust-lang/rust#155544 (bootstrap: Make "detected modifications" for download-rustc less verbose)
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-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. T-libs Relevant to the library team, which will review and decide on the PR/issue. T-rustdoc Relevant to the rustdoc 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.

8 participants