Skip to content

Move std::io::RawOsError to core::io#155574

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

Move std::io::RawOsError to core::io#155574
rust-bors[bot] merged 3 commits intorust-lang:mainfrom
bushrat011899:core_io_raw_os_error

Conversation

@bushrat011899
Copy link
Copy Markdown
Contributor

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

Description

As a part of moving components of std::io into alloc::io and core::io, there will need to be a new home for the type RawOsError. In this PR, I propose moving it to core::io, and removing it from std::sys. I suspect this will be quite controversial as it is a platform dependent type, but this is not the only instance of a type being conditioned on target_os in core (e.g., core::os and core::ffi).

Since RawOsError is currently unstable, I think it's reasonable to make this move now, and worry about making it platform independent if/when it is stabilized (e.g., replacing it with a wrapper around isize on all platforms).


Notes

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

The hyperlink to `std::io::Error` will not be valid when moved to `core::io`.
There is also a typo which I might as well fix while I'm here.
Inconsistently referenced through `std::sys` and `std::io`. Choosing `std::io` as the canonical source to make migration to `core::io` cleaner.
@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 20, 2026
@rustbot
Copy link
Copy Markdown
Collaborator

rustbot commented Apr 20, 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 7 candidates
  • Random selection from Mark-Simulacrum, jhpratt

@lygstate
Copy link
Copy Markdown
Contributor

lgtm

@Mark-Simulacrum
Copy link
Copy Markdown
Member

@joboet, do you think we should replicate the sys/ structure in core for platform-specific things, following the convention in std (IIRC linted on by tidy at least to some extent as well).

r? joboet

r=me if we don't hear back in a week or so (can always change this later).

@rustbot rustbot assigned joboet and unassigned Mark-Simulacrum Apr 26, 2026
@rustbot
Copy link
Copy Markdown
Collaborator

rustbot commented Apr 26, 2026

joboet is not on the review rotation at the moment.
They may take a while to respond.

@joboet
Copy link
Copy Markdown
Member

joboet commented Apr 26, 2026

It depends: having a separate sys module is useful for std as it forces its abstractions to conform to a shared interface and makes it easier to document. If we expect core to contain a significant number of abstractions, then I'd say having a dedicated sys module makes sense. But if it's just RawOsError alone then I don't think the added complexity is justified.

@bushrat011899
Copy link
Copy Markdown
Contributor Author

It depends: having a separate sys module is useful for std as it forces its abstractions to conform to a shared interface and makes it easier to document. If we expect core to contain a significant number of abstractions, then I'd say having a dedicated sys module makes sense. But if it's just RawOsError alone then I don't think the added complexity is justified.

For some added context, #152918 and #154684 have done a little scouting as to the extent of changes required. I believe the only other items which may need to be moved to core are IoSlice and IoSliceMut. Technically, io::Error will include configuration to switch between bitpacked and unpacked internal representations, but that's currently internal to std::io::error anyway.

@Mark-Simulacrum
Copy link
Copy Markdown
Member

Alright, let's move forward with this and revisit if we end up with much more than a few cfgs (and maybe even when those spread outside error).

@bors r+

@rust-bors
Copy link
Copy Markdown
Contributor

rust-bors Bot commented Apr 26, 2026

📌 Commit 7653e5e 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 26, 2026
JonathanBrouwer added a commit to JonathanBrouwer/rust that referenced this pull request Apr 26, 2026
…, r=Mark-Simulacrum

Move `std::io::RawOsError` to `core::io`

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

## Description

As a part of moving components of `std::io` into `alloc::io` and `core::io`, there will need to be a new home for the type `RawOsError`. In this PR, I propose moving it to `core::io`, and removing it from `std::sys`. I suspect this will be quite controversial as it is a platform dependent type, but this is not the only instance of a type being conditioned on `target_os` in `core` (e.g., `core::os` and `core::ffi`).

Since `RawOsError` is currently unstable, I think it's reasonable to make this move now, and worry about making it platform independent if/when it is stabilized (e.g., replacing it with a wrapper around `isize` on all platforms).

---

## Notes

* No AI tooling of any kind was used during the creation of this PR.
rust-bors Bot pushed a commit that referenced this pull request Apr 26, 2026
…uwer

Rollup of 15 pull requests

Successful merges:

 - #152995 (ACP Implementation of PermissionsExt for Windows )
 - #153457 (prevent deref coercions in `pin!`)
 - #155250 (Windows: Cache the pipe filesystem handle)
 - #155574 (Move `std::io::RawOsError` to `core::io`)
 - #155757 (macro_metavar_expr_concat: explain why idents are invalid)
 - #155823 (miri subtree update)
 - #155693 (Suggest enclosing format string with `""` under special cases)
 - #155707 (Fix minor panic-unsoundness in CString::clone_into)
 - #155719 (Suggest `.iter()` for shared projections)
 - #155779 (ssa_range_prop: use `if let` guards)
 - #155789 (Cleanups to `AttributeExt`)
 - #155805 (Mention `DEPRECATED_LLVM_INTRINSIC` lint for internal use)
 - #155806 (Remove the incomplete marker from `impl` restrictions)
 - #155820 (Avoid improper spans when `...` or `..=` is recovered from non-ASCII)
 - #155822 (Add default field values to diagnostic FormatArgs)
@rust-bors rust-bors Bot merged commit 9170ff7 into rust-lang:main Apr 26, 2026
11 checks passed
@rustbot rustbot added this to the 1.97.0 milestone Apr 26, 2026
rust-timer added a commit that referenced this pull request Apr 26, 2026
Rollup merge of #155574 - bushrat011899:core_io_raw_os_error, r=Mark-Simulacrum

Move `std::io::RawOsError` to `core::io`

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

## Description

As a part of moving components of `std::io` into `alloc::io` and `core::io`, there will need to be a new home for the type `RawOsError`. In this PR, I propose moving it to `core::io`, and removing it from `std::sys`. I suspect this will be quite controversial as it is a platform dependent type, but this is not the only instance of a type being conditioned on `target_os` in `core` (e.g., `core::os` and `core::ffi`).

Since `RawOsError` is currently unstable, I think it's reasonable to make this move now, and worry about making it platform independent if/when it is stabilized (e.g., replacing it with a wrapper around `isize` on all platforms).

---

## Notes

* No AI tooling of any kind was used during the creation of this PR.
pull Bot pushed a commit to LeeeeeeM/miri that referenced this pull request Apr 30, 2026
…uwer

Rollup of 15 pull requests

Successful merges:

 - rust-lang/rust#152995 (ACP Implementation of PermissionsExt for Windows )
 - rust-lang/rust#153457 (prevent deref coercions in `pin!`)
 - rust-lang/rust#155250 (Windows: Cache the pipe filesystem handle)
 - rust-lang/rust#155574 (Move `std::io::RawOsError` to `core::io`)
 - rust-lang/rust#155757 (macro_metavar_expr_concat: explain why idents are invalid)
 - rust-lang/rust#155823 (miri subtree update)
 - rust-lang/rust#155693 (Suggest enclosing format string with `""` under special cases)
 - rust-lang/rust#155707 (Fix minor panic-unsoundness in CString::clone_into)
 - rust-lang/rust#155719 (Suggest `.iter()` for shared projections)
 - rust-lang/rust#155779 (ssa_range_prop: use `if let` guards)
 - rust-lang/rust#155789 (Cleanups to `AttributeExt`)
 - rust-lang/rust#155805 (Mention `DEPRECATED_LLVM_INTRINSIC` lint for internal use)
 - rust-lang/rust#155806 (Remove the incomplete marker from `impl` restrictions)
 - rust-lang/rust#155820 (Avoid improper spans when `...` or `..=` is recovered from non-ASCII)
 - rust-lang/rust#155822 (Add default field values to diagnostic FormatArgs)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

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.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants