Add documentation about BorrowedFd::to_owned.#93354
Conversation
Following up on rust-lang#88564, this adds documentation explaining why `BorrowedFd::to_owned` returns another `BorrowedFd` rather than an `OwnedFd`. And similar for `BorrowedHandle` and `BorrowedSocket`.
|
What happened with the idea of just omitting the Copy and Clone impls to avoid confusion? |
|
@joshtriplett I added this comment to #88564. It turns out, there are places where having |
|
Also, if #93869 is accepted, we should expect using |
#93869 is now replaced by #93888, but this concern still applies. The common pattern for pub fn library_func<Fd: AsFd>(fd: Fd) {
...
}so user code that does something simple like this: fn user_code(fd: BorrowedFd) {
library_func(fd);
library_func(fd);
}ends up depending on |
|
This seems like the best of a bunch of bad options here. We can't make it @bors r+ rollup |
|
📌 Commit 47aaf79 has been approved by |
…rrowedfd-toowned, r=joshtriplett Add documentation about `BorrowedFd::to_owned`. Following up on rust-lang#88564, this adds documentation explaining why `BorrowedFd::to_owned` returns another `BorrowedFd` rather than an `OwnedFd`. And similar for `BorrowedHandle` and `BorrowedSocket`. r? `@joshtriplett`
…rrowedfd-toowned, r=joshtriplett Add documentation about `BorrowedFd::to_owned`. Following up on rust-lang#88564, this adds documentation explaining why `BorrowedFd::to_owned` returns another `BorrowedFd` rather than an `OwnedFd`. And similar for `BorrowedHandle` and `BorrowedSocket`. r? ``@joshtriplett``
…rrowedfd-toowned, r=joshtriplett Add documentation about `BorrowedFd::to_owned`. Following up on rust-lang#88564, this adds documentation explaining why `BorrowedFd::to_owned` returns another `BorrowedFd` rather than an `OwnedFd`. And similar for `BorrowedHandle` and `BorrowedSocket`. r? ```@joshtriplett```
…rrowedfd-toowned, r=joshtriplett Add documentation about `BorrowedFd::to_owned`. Following up on rust-lang#88564, this adds documentation explaining why `BorrowedFd::to_owned` returns another `BorrowedFd` rather than an `OwnedFd`. And similar for `BorrowedHandle` and `BorrowedSocket`. r? ````@joshtriplett````
Rollup of 9 pull requests Successful merges: - rust-lang#92061 (update char signess for openbsd) - rust-lang#93072 (Compatible variants suggestion with desugaring) - rust-lang#93354 (Add documentation about `BorrowedFd::to_owned`.) - rust-lang#93663 (Rename `BorrowedFd::borrow_raw_fd` to `BorrowedFd::borrow_raw`.) - rust-lang#94375 (Adt copy suggestions) - rust-lang#94433 (Improve allowness of the unexpected_cfgs lint) - rust-lang#94499 (Documentation was missed when demoting Windows XP to no_std only) - rust-lang#94505 (Restore the local filter on mono item sorting) - rust-lang#94529 (Unused doc comments blocks) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
This corresponds to rust-lang/rust#93354, which was recently merged.
This corresponds to rust-lang/rust#93354, which was recently merged.
Following up on #88564, this adds documentation explaining why
BorrowedFd::to_ownedreturns anotherBorrowedFdrather than anOwnedFd. And similar forBorrowedHandleandBorrowedSocket.r? @joshtriplett