-
Notifications
You must be signed in to change notification settings - Fork 12.8k
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
Conversation
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. |
Thanks! @bors r+ |
📌 Commit fbc2aad has been approved by |
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.
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
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 aFile
internally instead of aRawFd
, so that the niche can be taken advantage of. However, doing so will currently result in worse performance asIntoRawFd
,FromRawFd
andAsRawFd
are not inlined. This change adds#[inline]
to those methods on std types that wrap file descriptors, handles or sockets.