Skip to content
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

Move unix_socket_abstract feature API to SocketAddrExt. #101967

Merged
merged 2 commits into from
Nov 15, 2022

Conversation

jmillikin
Copy link
Contributor

The pre-stabilized API for abstract socket addresses exposes methods on SocketAddr that are only enabled for cfg(any(target_os = "android", target_os = "linux")). Per discussion in #85410, moving these methods to an OS-specific extension trait is required before stabilization can be considered.

This PR makes four changes:

  1. The internal module std::os::net contains logic for the unstable feature tcp_quickack (Tracking Issue for TCP_QUICKACK support on Linux #96256). I moved that code into linux_ext/tcp.rs and tried to adjust the module tree so it could accommodate a second unstable feature there.
  2. Moves the public API out of impl SocketAddr, into impl SocketAddrExt for SocketAddr (the headline change).
  3. The existing function names and docs for unix_socket_abstract refer to addresses as being created from abstract namespaces, but a more accurate description is that they create sockets in the abstract namespace. I adjusted the function signatures correspondingly and tried to update the docs to be clearer.
  4. I also tweaked from_abstract_name so it takes an AsRef<[u8]> instead of &[u8], allowing b"" literals to be passed directly.

Issues:

  1. The public module std::os::linux::net is marked as part of tcp_quickack. I couldn't figure out how to mark a module as being part of two unstable features, so I just left the existing attributes in place. My hope is that this will be fixed as a side-effect of stabilizing either feature.

@rustbot rustbot added the T-libs Relevant to the library team, which will review and decide on the PR/issue. label Sep 18, 2022
@rust-highfive
Copy link
Collaborator

Thanks for the pull request, and welcome! The Rust team is excited to review your changes, and you should hear from @m-ou-se (or someone else) soon.

Please see the contribution instructions for more information.

@rustbot
Copy link
Collaborator

rustbot commented Sep 18, 2022

Hey! It looks like you've submitted a new PR for the library teams!

If this PR contains changes to any rust-lang/rust public library APIs then please comment with @rustbot label +T-libs-api -T-libs to tag it appropriately. If this PR contains changes to any unstable APIs please edit the PR description to add a link to the relevant API Change Proposal or create one if you haven't already. If you're unsure where your change falls no worries, just leave it as is and the reviewer will take a look and make a decision to forward on if necessary.

Examples of T-libs-api changes:

  • Stabilizing library features
  • Introducing insta-stable changes such as new implementations of existing stable traits on existing stable types
  • Introducing new or changing existing unstable library APIs (excluding permanently unstable features / features without a tracking issue)
  • Changing public documentation in ways that create new stability guarantees
  • Changing observable runtime behavior of library APIs

@rust-highfive rust-highfive added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Sep 18, 2022
@joshtriplett
Copy link
Member

LGTM. All the stability attributes look fine.

@jmillikin
Copy link
Contributor Author

@rustbot label +T-libs-api -T-libs

@rustbot rustbot added T-libs-api Relevant to the library API team, which will review and decide on the PR/issue. and removed T-libs Relevant to the library team, which will review and decide on the PR/issue. labels Sep 28, 2022
@joshtriplett
Copy link
Member

Note: posted an LGTM above, but would appreciate a second set of eyes on this.

@jmillikin
Copy link
Contributor Author

Gentle ping.

@joshtriplett
Copy link
Member

@bors r+ rollup

@bors
Copy link
Contributor

bors commented Nov 14, 2022

📌 Commit 8f1e6eb has been approved by joshtriplett

It is now in the queue for this repository.

@bors bors 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 Nov 14, 2022
matthiaskrgr added a commit to matthiaskrgr/rust that referenced this pull request Nov 14, 2022
…dr, r=joshtriplett

Move `unix_socket_abstract` feature API to `SocketAddrExt`.

The pre-stabilized API for abstract socket addresses exposes methods on `SocketAddr` that are only enabled for `cfg(any(target_os = "android", target_os = "linux"))`. Per discussion in <rust-lang#85410>, moving these methods to an OS-specific extension trait is required before stabilization can be considered.

This PR makes four changes:
1. The internal module `std::os::net` contains logic for the unstable feature `tcp_quickack` (rust-lang#96256). I moved that code into `linux_ext/tcp.rs` and tried to adjust the module tree so it could accommodate a second unstable feature there.
2. Moves the public API out of `impl SocketAddr`, into `impl SocketAddrExt for SocketAddr` (the headline change).
3. The existing function names and docs for `unix_socket_abstract` refer to addresses as being created from abstract namespaces, but a more accurate description is that they create sockets in *the* abstract namespace. I adjusted the function signatures correspondingly and tried to update the docs to be clearer.
4. I also tweaked `from_abstract_name` so it takes an `AsRef<[u8]>` instead of `&[u8]`, allowing `b""` literals to be passed directly.

Issues:
1. The public module `std::os::linux::net` is marked as part of `tcp_quickack`. I couldn't figure out how to mark a module as being part of two unstable features, so I just left the existing attributes in place. My hope is that this will be fixed as a side-effect of stabilizing either feature.
matthiaskrgr added a commit to matthiaskrgr/rust that referenced this pull request Nov 14, 2022
…dr, r=joshtriplett

Move `unix_socket_abstract` feature API to `SocketAddrExt`.

The pre-stabilized API for abstract socket addresses exposes methods on `SocketAddr` that are only enabled for `cfg(any(target_os = "android", target_os = "linux"))`. Per discussion in <rust-lang#85410>, moving these methods to an OS-specific extension trait is required before stabilization can be considered.

This PR makes four changes:
1. The internal module `std::os::net` contains logic for the unstable feature `tcp_quickack` (rust-lang#96256). I moved that code into `linux_ext/tcp.rs` and tried to adjust the module tree so it could accommodate a second unstable feature there.
2. Moves the public API out of `impl SocketAddr`, into `impl SocketAddrExt for SocketAddr` (the headline change).
3. The existing function names and docs for `unix_socket_abstract` refer to addresses as being created from abstract namespaces, but a more accurate description is that they create sockets in *the* abstract namespace. I adjusted the function signatures correspondingly and tried to update the docs to be clearer.
4. I also tweaked `from_abstract_name` so it takes an `AsRef<[u8]>` instead of `&[u8]`, allowing `b""` literals to be passed directly.

Issues:
1. The public module `std::os::linux::net` is marked as part of `tcp_quickack`. I couldn't figure out how to mark a module as being part of two unstable features, so I just left the existing attributes in place. My hope is that this will be fixed as a side-effect of stabilizing either feature.
bors added a commit to rust-lang-ci/rust that referenced this pull request Nov 15, 2022
…iaskrgr

Rollup of 11 pull requests

Successful merges:

 - rust-lang#101967 (Move `unix_socket_abstract` feature API to `SocketAddrExt`.)
 - rust-lang#102470 (Stabilize const char convert)
 - rust-lang#104223 (Recover from function pointer types with generic parameter list)
 - rust-lang#104229 (Don't print full paths in overlap errors)
 - rust-lang#104294 (Don't ICE with inline const errors during MIR build)
 - rust-lang#104332 (Fixed some `_i32` notation in `maybe_uninit`’s doc)
 - rust-lang#104349 (fix some typos in comments)
 - rust-lang#104350 (Fix x finding Python on Windows)
 - rust-lang#104356 (interpret: make check_mplace public)
 - rust-lang#104364 (rustdoc: Resolve doc links in external traits having local impls)
 - rust-lang#104378 (Bump chalk to v0.87)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
@bors bors merged commit 9f3786b into rust-lang:master Nov 15, 2022
@rustbot rustbot added this to the 1.67.0 milestone Nov 15, 2022
@gustav3d
Copy link

This is awesome !!

@jmillikin jmillikin deleted the linux-abstract-socket-addr branch November 16, 2022 13:25
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-api Relevant to the library API team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants