-
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
Update the documentation for {As,Into,From}Raw{Fd,Handle,Socket}
.
#93562
Conversation
This change weakens the descriptions of the `{as,into,from}_raw_{fd,handle,socket}` descriptions from saying that they *do* express ownership relations to say that they are *typically used* in ways that express ownership relations. This needed needed since, for example, std's own [`RawFd`] implements `{As,From,Into}Fd` without any of the ownership relationships. This adds proper `# Safety` comments to `from_raw_{fd,handle,socket}`, adds the requirement that raw handles be not opened with the `FILE_FLAG_OVERLAPPED` flag, and merges the `OwnedHandle::from_raw_handle` comment into the main `FromRawHandle::from_raw_handle` comment. And, this changes `HandleOrNull` and `HandleOrInvalid` to not implement `FromRawHandle`, since they are intended for limited use in FFI situations, and not for generic use, and they have constraints that are stronger than the those of `FromRawHandle`. [`RawFd`]: https://doc.rust-lang.org/stable/std/os/unix/io/type.RawFd.html
(rust-highfive has picked a reviewer for you, use r? to override) |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This function is documented in more detail in the `FromRawSocket` trait.
This ports the changes proposed in rust-lang/rust#93562 to io-lifetimes. Specifically, remove the redundant comments on `OwnedHandle::from_raw_handle` and `OwnedSocket::from_raw_socket`, and remove the `FromRawHandle` impls for `HandleOrInvalid` and `HandleOrNull`.
@bors r+ rollup |
📌 Commit ba6050f has been approved by |
This ports the changes proposed in rust-lang/rust#93562 to io-lifetimes. Specifically, remove the redundant comments on `OwnedHandle::from_raw_handle` and `OwnedSocket::from_raw_socket`, and remove the `FromRawHandle` impls for `HandleOrInvalid` and `HandleOrNull`.
…joshtriplett Update the documentation for `{As,Into,From}Raw{Fd,Handle,Socket}`. This change weakens the descriptions of the `{as,into,from}_raw_{fd,handle,socket}` descriptions from saying that they *do* express ownership relations to say that they are *typically used* in ways that express ownership relations. This is needed since, for example, std's own [`RawFd`] implements `{As,From,Into}Fd` without any of the ownership relationships. This adds proper `# Safety` comments to `from_raw_{fd,handle,socket}`, adds the requirement that raw handles be not opened with the `FILE_FLAG_OVERLAPPED` flag, and merges the `OwnedHandle::from_raw_handle` comment into the main `FromRawHandle::from_raw_handle` comment. And, this changes `HandleOrNull` and `HandleOrInvalid` to not implement `FromRawHandle`, since they are intended for limited use in FFI situations, and not for generic use, and they have constraints that are stronger than the those of `FromRawHandle`. [`RawFd`]: https://doc.rust-lang.org/stable/std/os/unix/io/type.RawFd.html
…joshtriplett Update the documentation for `{As,Into,From}Raw{Fd,Handle,Socket}`. This change weakens the descriptions of the `{as,into,from}_raw_{fd,handle,socket}` descriptions from saying that they *do* express ownership relations to say that they are *typically used* in ways that express ownership relations. This is needed since, for example, std's own [`RawFd`] implements `{As,From,Into}Fd` without any of the ownership relationships. This adds proper `# Safety` comments to `from_raw_{fd,handle,socket}`, adds the requirement that raw handles be not opened with the `FILE_FLAG_OVERLAPPED` flag, and merges the `OwnedHandle::from_raw_handle` comment into the main `FromRawHandle::from_raw_handle` comment. And, this changes `HandleOrNull` and `HandleOrInvalid` to not implement `FromRawHandle`, since they are intended for limited use in FFI situations, and not for generic use, and they have constraints that are stronger than the those of `FromRawHandle`. [`RawFd`]: https://doc.rust-lang.org/stable/std/os/unix/io/type.RawFd.html
…joshtriplett Update the documentation for `{As,Into,From}Raw{Fd,Handle,Socket}`. This change weakens the descriptions of the `{as,into,from}_raw_{fd,handle,socket}` descriptions from saying that they *do* express ownership relations to say that they are *typically used* in ways that express ownership relations. This is needed since, for example, std's own [`RawFd`] implements `{As,From,Into}Fd` without any of the ownership relationships. This adds proper `# Safety` comments to `from_raw_{fd,handle,socket}`, adds the requirement that raw handles be not opened with the `FILE_FLAG_OVERLAPPED` flag, and merges the `OwnedHandle::from_raw_handle` comment into the main `FromRawHandle::from_raw_handle` comment. And, this changes `HandleOrNull` and `HandleOrInvalid` to not implement `FromRawHandle`, since they are intended for limited use in FFI situations, and not for generic use, and they have constraints that are stronger than the those of `FromRawHandle`. [`RawFd`]: https://doc.rust-lang.org/stable/std/os/unix/io/type.RawFd.html
Looks like this failed in a rollup: #94533 (comment) |
I've now added a patch which fixes the broken doc link. |
Was there discussion somewhere about why |
There may eventually be something to say about `FILE_FLAG_OVERLAPPED` here, however this appears to be independent of the other changes in this PR, so remove them from this PR so that it can be discussed separately.
@bors r+ |
|
📌 Commit 8253cfe has been approved by |
There was not; it came up from some private discussions and I had the impression it was a simple omission that would be nice to fix while I was making changes in this area. Looking into it more now, I've now found #81357 on this topic, with non-trivial considerations. In light of that, I've now removed the mention of |
…askrgr Rollup of 8 pull requests Successful merges: - rust-lang#93562 (Update the documentation for `{As,Into,From}Raw{Fd,Handle,Socket}`.) - rust-lang#94101 (rustdoc: add test cases for hidden enum variants) - rust-lang#94484 (8 - Make more use of `let_chains`) - rust-lang#94522 (Remove out-of-context line at end of E0284 message) - rust-lang#94534 (Re-export (unstable) core::ffi types from std::ffi) - rust-lang#94536 (Move transmute_undefined_repr back to nursery again) - rust-lang#94537 (Use ? operator in one instance instead of manual match) - rust-lang#94544 (Add some examples to comments in mbe code) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
OK, great, thanks. |
This change weakens the descriptions of the
{as,into,from}_raw_{fd,handle,socket}
descriptions from saying thatthey do express ownership relations to say that they are typically used
in ways that express ownership relations. This is needed since, for
example, std's own
RawFd
implements{As,From,Into}Fd
without any ofthe ownership relationships.
This adds proper
# Safety
comments tofrom_raw_{fd,handle,socket}
,adds the requirement that raw handles be not opened with the
FILE_FLAG_OVERLAPPED
flag, and merges theOwnedHandle::from_raw_handle
comment into the main
FromRawHandle::from_raw_handle
comment.And, this changes
HandleOrNull
andHandleOrInvalid
to not implementFromRawHandle
, since they are intended for limited use in FFI situations,and not for generic use, and they have constraints that are stronger than
the those of
FromRawHandle
.