Move std::io::RawOsError to core::io#155574
Conversation
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 has assigned @Mark-Simulacrum. Use Why was this reviewer chosen?The reviewer was selected based on:
|
|
lgtm |
|
@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). |
|
|
|
It depends: having a separate |
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 |
|
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+ |
…, 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.
…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)
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.
…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)
Move `IoSlice` and `IoSliceMut` to `core::io` 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 #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](#155574 (comment)). * 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.
Move `IoSlice` and `IoSliceMut` to `core::io` 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 #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](#155574 (comment)). * 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.
Move `IoSlice` and `IoSliceMut` to `core::io` 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 #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](#155574 (comment)). * 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.
ACP: rust-lang/libs-team#755
Tracking issue: #154046
Related: #154654
Description
As a part of moving components of
std::iointoalloc::ioandcore::io, there will need to be a new home for the typeRawOsError. In this PR, I propose moving it tocore::io, and removing it fromstd::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 ontarget_osincore(e.g.,core::osandcore::ffi).Since
RawOsErroris 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 aroundisizeon all platforms).Notes