Skip to content

Tracking Issue for restructuring std::sys #117276

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
21 of 24 tasks
joboet opened this issue Oct 27, 2023 · 3 comments
Open
21 of 24 tasks

Tracking Issue for restructuring std::sys #117276

joboet opened this issue Oct 27, 2023 · 3 comments
Assignees
Labels
C-tracking-issue Category: An issue tracking the progress of sth. like the implementation of an RFC E-help-wanted Call for participation: Help is requested to fix this issue. T-libs Relevant to the library team, which will review and decide on the PR/issue.

Comments

@joboet
Copy link
Member

joboet commented Oct 27, 2023

On Wednesday, the libs-team discussed reorganizing the platform-specific modules inside std, namely sys and sys_common into a new structure. These modules will be merged into one sys module with a feature-first organization:

  • the submodules of sys, named after the feature they implement, contain all the implementations of the different platforms and provide a uniform interface that the rest of std may depend on. E.g. sys::thread_local, sys::fs or sys::thread_parking.
  • sys::pal contains platform-specific generic API wrappers like FileDesc cvt (UNIX) used to implement these features. E.g. sys::pal::unix, sys::pal::windows or (perhaps) sys::pal::apple.

The rest of std, modulo std::os, should now only depend on sys::feature_name and not sys::pal. The implementations themselves may however depend on other parts of std as necessary.

@rustbot label +T-libs +E-help-wanted
@rustbot claim

@joboet joboet added the C-tracking-issue Category: An issue tracking the progress of sth. like the implementation of an RFC label Oct 27, 2023
@rustbot rustbot added the T-libs Relevant to the library team, which will review and decide on the PR/issue. label Oct 27, 2023
bors added a commit to rust-lang-ci/rust that referenced this issue Jan 12, 2024
…sDenton

Move platform modules into `sys::pal`

This is the initial step of rust-lang#117276. `sys` just re-exports everything from the current `sys` for now, I'll move the implementations for the individual features one-by-one after this PR merges.
bors added a commit to rust-lang-ci/rust that referenced this issue Jan 13, 2024
…sDenton

Move platform modules into `sys::pal`

This is the initial step of rust-lang#117276. `sys` just re-exports everything from the current `sys` for now, I'll move the implementations for the individual features one-by-one after this PR merges.
matthiaskrgr added a commit to matthiaskrgr/rust that referenced this issue Jan 13, 2024
…isDenton

Move personality implementation out of PAL

The module already follows the new convention described in rust-lang#117276. This PR also includes a small fix in the tidy pal check, that was just an oversight in rust-lang#117285.
rust-timer added a commit to rust-lang-ci/rust that referenced this issue Jan 14, 2024
Rollup merge of rust-lang#119935 - joboet:move_pal_personality, r=ChrisDenton

Move personality implementation out of PAL

The module already follows the new convention described in rust-lang#117276. This PR also includes a small fix in the tidy pal check, that was just an oversight in rust-lang#117285.
@rustbot rustbot added the E-help-wanted Call for participation: Help is requested to fix this issue. label Jan 18, 2024
Nadrieril added a commit to Nadrieril/rust that referenced this issue Jan 21, 2024
Move OS String implementation into `sys`

Part of rust-lang#117276. The new structure is really useful here, since we can easily eliminate a number of ugly `#[path]`-based imports.

In the future, it might be good to move the WTF-8 implementation directly to the OS string implementation, I cannot see it being used anywhere else. That is a story for another PR, however.
rust-timer added a commit to rust-lang-ci/rust that referenced this issue Jan 21, 2024
Rollup merge of rust-lang#119996 - joboet:move_pal_os_str, r=ChrisDenton

Move OS String implementation into `sys`

Part of rust-lang#117276. The new structure is really useful here, since we can easily eliminate a number of ugly `#[path]`-based imports.

In the future, it might be good to move the WTF-8 implementation directly to the OS string implementation, I cannot see it being used anywhere else. That is a story for another PR, however.
@ChrisDenton
Copy link
Member

Something that just occurred to me is that we might want to add commits to https://github.com/rust-lang/rust/blob/master/.git-blame-ignore-revs if they're purely moving files. This allows GitHub's blame interface to ignore them.

matthiaskrgr added a commit to matthiaskrgr/rust that referenced this issue Jan 22, 2024
matthiaskrgr added a commit to matthiaskrgr/rust that referenced this issue Jan 22, 2024
rust-timer added a commit to rust-lang-ci/rust that referenced this issue Jan 23, 2024
Rollup merge of rust-lang#120109 - joboet:move_pal_cmath, r=ChrisDenton

Move cmath into `sys`

Part of rust-lang#117276.

r? ``@ChrisDenton``
matthiaskrgr added a commit to matthiaskrgr/rust that referenced this issue Feb 9, 2024
Move path implementations into `sys`

Part of rust-lang#117276.

r? `@ChrisDenton`
rust-timer added a commit to rust-lang-ci/rust that referenced this issue Feb 9, 2024
Rollup merge of rust-lang#120776 - joboet:move_pal_path, r=ChrisDenton

Move path implementations into `sys`

Part of rust-lang#117276.

r? `@ChrisDenton`
bors added a commit to rust-lang-ci/rust that referenced this issue Feb 19, 2024
matthiaskrgr added a commit to matthiaskrgr/rust that referenced this issue Mar 2, 2024
…risDenton

Move thread local implementation to `sys`

Part of rust-lang#117276.
matthiaskrgr added a commit to matthiaskrgr/rust that referenced this issue Mar 2, 2024
…risDenton

Move thread local implementation to `sys`

Part of rust-lang#117276.
matthiaskrgr added a commit to matthiaskrgr/rust that referenced this issue Mar 2, 2024
…risDenton

Move thread local implementation to `sys`

Part of rust-lang#117276.
rust-timer added a commit to rust-lang-ci/rust that referenced this issue Mar 2, 2024
Rollup merge of rust-lang#121758 - joboet:move_pal_thread_local, r=ChrisDenton

Move thread local implementation to `sys`

Part of rust-lang#117276.
joboet added a commit to joboet/rust that referenced this issue Mar 15, 2025
As per rust-lang#117276, this moves the implementations of `Process` and friends out of the `pal` module and into the `sys` module, removing quite a lot of error-prone `#[path]` imports in the process (hah, get it ;-)). I've also made the `zircon` module a dedicated submodule of `pal::unix`, hopefully we can move some other definitions there as well (they are currently quite a lot of duplications in `sys`). Also, the `ensure_no_nuls` function on Windows now lives in `sys::pal::windows` – it's not specific to processes and shared by the argument implementation.
bors added a commit to rust-lang-ci/rust that referenced this issue Mar 16, 2025
…lacrum

std: move process implementations to `sys`

As per rust-lang#117276, this moves the implementations of `Process` and friends out of the `pal` module and into the `sys` module, removing quite a lot of error-prone `#[path]` imports in the process (hah, get it ;-)). I've also made the `zircon` module a dedicated submodule of `pal::unix`, hopefully we can move some other definitions there as well (they are currently quite a lot of duplications in `sys`). Also, the `ensure_no_nuls` function on Windows now lives in `sys::pal::windows` – it's not specific to processes and shared by the argument implementation.
madhav-madhusoodanan pushed a commit to madhav-madhusoodanan/rust that referenced this issue Mar 18, 2025
As per rust-lang#117276, this moves the platform definitions of `Stdout` and friends into `sys`. This PR also unifies the UNIX and Hermit implementations and moves the `__rust_print_err` function needed by libunwind on SGX into the dedicated module for such helper functions.
joboet added a commit to joboet/rust that referenced this issue Mar 22, 2025
As per rust-lang#117276, this moves the implementations of `Process` and friends out of the `pal` module and into the `sys` module, removing quite a lot of error-prone `#[path]` imports in the process (hah, get it ;-)). I've also made the `zircon` module a dedicated submodule of `pal::unix`, hopefully we can move some other definitions there as well (they are currently quite a lot of duplications in `sys`). Also, the `ensure_no_nuls` function on Windows now lives in `sys::pal::windows` – it's not specific to processes and shared by the argument implementation.
bors added a commit to rust-lang-ci/rust that referenced this issue Mar 23, 2025
…lacrum

std: move process implementations to `sys`

As per rust-lang#117276, this moves the implementations of `Process` and friends out of the `pal` module and into the `sys` module, removing quite a lot of error-prone `#[path]` imports in the process (hah, get it ;-)). I've also made the `zircon` module a dedicated submodule of `pal::unix`, hopefully we can move some other definitions there as well (they are currently quite a lot of duplications in `sys`). Also, the `ensure_no_nuls` function on Windows now lives in `sys::pal::windows` – it's not specific to processes and shared by the argument implementation.
joboet added a commit to joboet/rust that referenced this issue Mar 27, 2025
Move the public `CommandEnvs` into the `process` module (and make it a wrapper type for an internal iterator type) and everything else into `sys::process` as per rust-lang#117276.
jhpratt added a commit to jhpratt/rust that referenced this issue Mar 30, 2025
Move `fd` into `std::sys`

Move platform definitions of `fd` into `std::sys`, as part of rust-lang#117276.

Unlike other modules directly under `std::sys`, this is only available on some platforms and I have not provided a fallback abstraction for unsupported platforms. That is similar to how `std::os::fd` is gated to only supported platforms.

Also, fix the `unsafe_op_in_unsafe_fn` lint, which was allowed for the Unix fd impl. Since macro expansions from `std::sys::pal::unix::weak` trigger this lint, fix it there too.

cc `@joboet,` `@ChrisDenton`
bors added a commit to rust-lang-ci/rust that referenced this issue Mar 30, 2025
Move `fd` into `std::sys`

Move platform definitions of `fd` into `std::sys`, as part of rust-lang#117276.

Unlike other modules directly under `std::sys`, this is only available on some platforms and I have not provided a fallback abstraction for unsupported platforms. That is similar to how `std::os::fd` is gated to only supported platforms.

Also, fix the `unsafe_op_in_unsafe_fn` lint, which was allowed for the Unix fd impl. Since macro expansions from `std::sys::pal::unix::weak` trigger this lint, fix it there too.

cc `@joboet,` `@ChrisDenton`
github-actions bot pushed a commit to model-checking/verify-rust-std that referenced this issue Apr 2, 2025
As per rust-lang#117276, this moves the implementations of `Process` and friends out of the `pal` module and into the `sys` module, removing quite a lot of error-prone `#[path]` imports in the process (hah, get it ;-)). I've also made the `zircon` module a dedicated submodule of `pal::unix`, hopefully we can move some other definitions there as well (they are currently quite a lot of duplications in `sys`). Also, the `ensure_no_nuls` function on Windows now lives in `sys::pal::windows` – it's not specific to processes and shared by the argument implementation.
github-actions bot pushed a commit to model-checking/verify-rust-std that referenced this issue Apr 2, 2025
…lacrum

std: move process implementations to `sys`

As per rust-lang#117276, this moves the implementations of `Process` and friends out of the `pal` module and into the `sys` module, removing quite a lot of error-prone `#[path]` imports in the process (hah, get it ;-)). I've also made the `zircon` module a dedicated submodule of `pal::unix`, hopefully we can move some other definitions there as well (they are currently quite a lot of duplications in `sys`). Also, the `ensure_no_nuls` function on Windows now lives in `sys::pal::windows` – it's not specific to processes and shared by the argument implementation.
bors added a commit to rust-lang-ci/rust that referenced this issue Apr 5, 2025
Move `fd` into `std::sys`

Move platform definitions of `fd` into `std::sys`, as part of rust-lang#117276.

Unlike other modules directly under `std::sys`, this is only available on some platforms and I have not provided a fallback abstraction for unsupported platforms. That is similar to how `std::os::fd` is gated to only supported platforms.

Also, fix the `unsafe_op_in_unsafe_fn` lint, which was allowed for the Unix fd impl. Since macro expansions from `std::sys::pal::unix::weak` trigger this lint, fix it there too.

cc `@joboet,` `@ChrisDenton`

try-job: x86_64-gnu-aux
matthiaskrgr added a commit to matthiaskrgr/rust that referenced this issue Apr 5, 2025
Move `fd` into `std::sys`

Move platform definitions of `fd` into `std::sys`, as part of rust-lang#117276.

Unlike other modules directly under `std::sys`, this is only available on some platforms and I have not provided a fallback abstraction for unsupported platforms. That is similar to how `std::os::fd` is gated to only supported platforms.

Also, fix the `unsafe_op_in_unsafe_fn` lint, which was allowed for the Unix fd impl. Since macro expansions from `std::sys::pal::unix::weak` trigger this lint, fix it there too.

cc `@joboet,` `@ChrisDenton`

try-job: x86_64-gnu-aux
rust-timer added a commit to rust-lang-ci/rust that referenced this issue Apr 5, 2025
Rollup merge of rust-lang#139092 - thaliaarchi:move-fd-pal, r=joboet

Move `fd` into `std::sys`

Move platform definitions of `fd` into `std::sys`, as part of rust-lang#117276.

Unlike other modules directly under `std::sys`, this is only available on some platforms and I have not provided a fallback abstraction for unsupported platforms. That is similar to how `std::os::fd` is gated to only supported platforms.

Also, fix the `unsafe_op_in_unsafe_fn` lint, which was allowed for the Unix fd impl. Since macro expansions from `std::sys::pal::unix::weak` trigger this lint, fix it there too.

cc `@joboet,` `@ChrisDenton`

try-job: x86_64-gnu-aux
github-actions bot pushed a commit to model-checking/verify-rust-std that referenced this issue Apr 10, 2025
Move `fd` into `std::sys`

Move platform definitions of `fd` into `std::sys`, as part of rust-lang#117276.

Unlike other modules directly under `std::sys`, this is only available on some platforms and I have not provided a fallback abstraction for unsupported platforms. That is similar to how `std::os::fd` is gated to only supported platforms.

Also, fix the `unsafe_op_in_unsafe_fn` lint, which was allowed for the Unix fd impl. Since macro expansions from `std::sys::pal::unix::weak` trigger this lint, fix it there too.

cc `@joboet,` `@ChrisDenton`

try-job: x86_64-gnu-aux
ChrisDenton added a commit to ChrisDenton/rust that referenced this issue Apr 13, 2025
Move `args` into `std::sys`

Move platform definitions of `args` into `std::sys`, as part of rust-lang#117276.

cc `@joboet`
ChrisDenton added a commit to ChrisDenton/rust that referenced this issue Apr 13, 2025
Move `args` into `std::sys`

Move platform definitions of `args` into `std::sys`, as part of rust-lang#117276.

cc ``@joboet``
rust-timer added a commit to rust-lang-ci/rust that referenced this issue Apr 13, 2025
Rollup merge of rust-lang#139710 - thaliaarchi:move-args-pal, r=joboet

Move `args` into `std::sys`

Move platform definitions of `args` into `std::sys`, as part of rust-lang#117276.

cc ``@joboet``
github-actions bot pushed a commit to rust-lang/rustc-dev-guide that referenced this issue Apr 14, 2025
Move `args` into `std::sys`

Move platform definitions of `args` into `std::sys`, as part of rust-lang/rust#117276.

cc ``@joboet``
github-actions bot pushed a commit to rust-lang/miri that referenced this issue Apr 17, 2025
Move `args` into `std::sys`

Move platform definitions of `args` into `std::sys`, as part of rust-lang/rust#117276.

cc ``@joboet``
matthiaskrgr added a commit to matthiaskrgr/rust that referenced this issue Apr 18, 2025
…=joboet

Move `pal::env` into `std::sys::env_consts`

Combine the `std::env::consts` platform implementations as a single file. Use the Unix file as the base, since it has 28 entries, and fold the 8 singleton platforms into it. The Unix file was roughly grouped into Linux, Apple, BSD, and everything else, roughly in alphabetical order. Alphabetically order them to make it easier to maintain and discard the Unix-specific groups to generalize it to all platforms.

I'd prefer to have no fallback implementation, as I consider it a bug; however TEEOS, Trusty, and Xous have no definitions here. Since they otherwise have `pal` abstractions, that indicates that there are several platforms without `pal` abstractions which are also missing here. To support unsupported, create a little macro to handle the fallback case and not introduce ordering between the `cfg`s like `cfg_if!`.

I've named the module `std::sys::env_consts`, because they are used in `std::env::consts` and I intend to use the name `std::sys::env` for the combination of `Args` and `Vars`.

cc `@joboet` `@ChrisDenton`

Tracked in rust-lang#117276.
github-actions bot pushed a commit to model-checking/verify-rust-std that referenced this issue Apr 19, 2025
Move `args` into `std::sys`

Move platform definitions of `args` into `std::sys`, as part of rust-lang#117276.

cc ``@joboet``
ChrisDenton added a commit to ChrisDenton/rust that referenced this issue Apr 19, 2025
…=joboet

Move `pal::env` to `std::sys::env_consts`

Combine the `std::env::consts` platform implementations as a single file. Use the Unix file as the base, since it has 28 entries, and fold the 8 singleton platforms into it. The Unix file was roughly grouped into Linux, Apple, BSD, and everything else, roughly in alphabetical order. Alphabetically order them to make it easier to maintain and discard the Unix-specific groups to generalize it to all platforms.

I'd prefer to have no fallback implementation, as I consider it a bug; however TEEOS, Trusty, and Xous have no definitions here. Since they otherwise have `pal` abstractions, that indicates that there are several platforms without `pal` abstractions which are also missing here. To support unsupported, create a little macro to handle the fallback case and not introduce ordering between the `cfg`s like `cfg_if!`.

I've named the module `std::sys::env_consts`, because they are used in `std::env::consts` and I intend to use the name `std::sys::env` for the combination of `Args` and `Vars`.

cc `@joboet` `@ChrisDenton`

Tracked in rust-lang#117276.
rust-timer added a commit to rust-lang-ci/rust that referenced this issue Apr 20, 2025
Rollup merge of rust-lang#139868 - thaliaarchi:move-env-consts-pal, r=joboet

Move `pal::env` to `std::sys::env_consts`

Combine the `std::env::consts` platform implementations as a single file. Use the Unix file as the base, since it has 28 entries, and fold the 8 singleton platforms into it. The Unix file was roughly grouped into Linux, Apple, BSD, and everything else, roughly in alphabetical order. Alphabetically order them to make it easier to maintain and discard the Unix-specific groups to generalize it to all platforms.

I'd prefer to have no fallback implementation, as I consider it a bug; however TEEOS, Trusty, and Xous have no definitions here. Since they otherwise have `pal` abstractions, that indicates that there are several platforms without `pal` abstractions which are also missing here. To support unsupported, create a little macro to handle the fallback case and not introduce ordering between the `cfg`s like `cfg_if!`.

I've named the module `std::sys::env_consts`, because they are used in `std::env::consts` and I intend to use the name `std::sys::env` for the combination of `Args` and `Vars`.

cc `@joboet` `@ChrisDenton`

Tracked in rust-lang#117276.
@thaliaarchi
Copy link
Contributor

Some more to add to the list:

github-actions bot pushed a commit to model-checking/verify-rust-std that referenced this issue Apr 22, 2025
…=joboet

Move `pal::env` to `std::sys::env_consts`

Combine the `std::env::consts` platform implementations as a single file. Use the Unix file as the base, since it has 28 entries, and fold the 8 singleton platforms into it. The Unix file was roughly grouped into Linux, Apple, BSD, and everything else, roughly in alphabetical order. Alphabetically order them to make it easier to maintain and discard the Unix-specific groups to generalize it to all platforms.

I'd prefer to have no fallback implementation, as I consider it a bug; however TEEOS, Trusty, and Xous have no definitions here. Since they otherwise have `pal` abstractions, that indicates that there are several platforms without `pal` abstractions which are also missing here. To support unsupported, create a little macro to handle the fallback case and not introduce ordering between the `cfg`s like `cfg_if!`.

I've named the module `std::sys::env_consts`, because they are used in `std::env::consts` and I intend to use the name `std::sys::env` for the combination of `Args` and `Vars`.

cc `@joboet` `@ChrisDenton`

Tracked in rust-lang#117276.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-tracking-issue Category: An issue tracking the progress of sth. like the implementation of an RFC E-help-wanted Call for participation: Help is requested to fix this issue. T-libs Relevant to the library team, which will review and decide on the PR/issue.
Projects
None yet
Development

No branches or pull requests

4 participants