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

Inline most raw socket, fd and handle conversions #84541

Merged
merged 1 commit into from
Apr 26, 2021

Conversation

SabrinaJewson
Copy link
Contributor

Now that file descriptor types on Unix have niches, it is advantageous for user libraries which provide file descriptor wrappers (e.g. Socket from socket2) to store a File internally instead of a RawFd, so that the niche can be taken advantage of. However, doing so will currently result in worse performance as IntoRawFd, FromRawFd and AsRawFd are not inlined. This change adds #[inline] to those methods on std types that wrap file descriptors, handles or sockets.

@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 @kennytm (or someone else) soon.

If any changes to this PR are deemed necessary, please add them as extra commits. This ensures that the reviewer can see what has changed since they last reviewed the code. Due to the way GitHub handles out-of-date commits, this should also make it reasonably obvious what issues have or haven't been addressed. Large or tricky changes may require several passes of review and changes.

Please see the contribution instructions for more information.

@rust-highfive rust-highfive added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Apr 25, 2021
@m-ou-se
Copy link
Member

m-ou-se commented Apr 25, 2021

Thanks!

@bors r+

@bors
Copy link
Contributor

bors commented Apr 25, 2021

📌 Commit fbc2aad has been approved by m-ou-se

@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 Apr 25, 2021
@m-ou-se m-ou-se assigned m-ou-se and unassigned kennytm Apr 25, 2021
Dylan-DPC-zz pushed a commit to Dylan-DPC-zz/rust that referenced this pull request Apr 25, 2021
Inline most raw socket, fd and handle conversions

Now that file descriptor types on Unix have niches, it is advantageous for user libraries which provide file descriptor wrappers (e.g. `Socket` from socket2) to store a `File` internally instead of a `RawFd`, so that the niche can be taken advantage of. However, doing so will currently result in worse performance as `IntoRawFd`, `FromRawFd` and `AsRawFd` are not inlined. This change adds `#[inline]` to those methods on std types that wrap file descriptors, handles or sockets.
bors added a commit to rust-lang-ci/rust that referenced this pull request Apr 25, 2021
Rollup of 8 pull requests

Successful merges:

 - rust-lang#84235 (refactor StyledBuffer)
 - rust-lang#84450 (Give a better error when `std` or `core` are missing)
 - rust-lang#84486 (Handle pretty printing of `else if let` clauses without ICEing)
 - rust-lang#84499 (Tweak trait not `use`d suggestion)
 - rust-lang#84516 (Add suggestion to "use break" when attempting to implicit-break a loop)
 - rust-lang#84520 (Improve diagnostics for function passed when a type was expected.)
 - rust-lang#84541 (Inline most raw socket, fd and handle conversions)
 - rust-lang#84547 (Get rid of is_min_const_fn)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
@bors bors merged commit 25508eb into rust-lang:master Apr 26, 2021
@rustbot rustbot added this to the 1.53.0 milestone Apr 26, 2021
@SabrinaJewson SabrinaJewson deleted the inline-raw branch April 26, 2021 06:05
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.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants