-
Notifications
You must be signed in to change notification settings - Fork 12.9k
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
Add rustc_nonnull_optimization_guaranteed to Owned/Borrowed Fd/Socket #96947
Add rustc_nonnull_optimization_guaranteed to Owned/Borrowed Fd/Socket #96947
Conversation
PR rust-lang#94586 added support for using `rustc_nonnull_optimization_guaranteed` on values where the "null" value is the all-ones bitpattern. Now that rust-lang#94586 has made it to the stage0 compiler, add `rustc_nonnull_optimization_guaranteed` to `OwnedFd`, `BorrowedFd`, `OwnedSocket`, and `BorrowedSocket`, since these types all exclude all-ones bitpatterns. This allows `Option<OwnedFd>`, `Option<BorrowedFd>`, `Option<OwnedSocket>`, and `Option<BorrowedSocket>` to be used in FFI declarations, as described in the [I/O safety RFC]. [I/O safety RFC]: https://github.com/rust-lang/rfcs/blob/master/text/3128-io-safety.md#ownedfd-and-borrowedfdfd-1
Hey! It looks like you've submitted a new PR for the library teams! If this PR contains changes to any Examples of
|
(rust-highfive has picked a reviewer for you, use r? to override) |
This comment has been minimized.
This comment has been minimized.
This ports in the new tests added in rust-lang/rust#96947.
This ports in the new tests added in rust-lang/rust#96947.
@bors r+ |
📌 Commit 5c60951 has been approved by |
Rollup of 4 pull requests Successful merges: - rust-lang#96947 (Add rustc_nonnull_optimization_guaranteed to Owned/Borrowed Fd/Socket) - rust-lang#97021 (Added note in documentation) - rust-lang#97042 (Add new eslint rule about brace style) - rust-lang#97060 (Fix use of SetHandleInformation on UWP) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
@scottmcm I removed the needs-fcp here; this PR only affects |
PR #94586 added support for using
rustc_nonnull_optimization_guaranteed
on values where the "null" valueis the all-ones bitpattern.
Now that #94586 has made it to the stage0 compiler, add
rustc_nonnull_optimization_guaranteed
toOwnedFd
,BorrowedFd
,OwnedSocket
, andBorrowedSocket
, since these types all excludeall-ones bitpatterns.
This allows
Option<OwnedFd>
,Option<BorrowedFd>
,Option<OwnedSocket>
,and
Option<BorrowedSocket>
to be used in FFI declarations, as describedin the I/O safety RFC.