about summary refs log tree commit diff
path: root/compiler/rustc_codegen_llvm/src/builder.rs
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2022-06-15 21:08:08 +0000
committerbors <bors@rust-lang.org>2022-06-15 21:08:08 +0000
commitb31f9cc22bcd720b37ddf927afe378108a5b9a54 (patch)
treede2017de0932a8e9f7bc024a39046d0412536522 /compiler/rustc_codegen_llvm/src/builder.rs
parentca983054e19afd74d63c3ed37997f3bf30fe85d0 (diff)
parentee49d65fc35d968e328ab63cc8330c1a43088bd2 (diff)
downloadrust-b31f9cc22bcd720b37ddf927afe378108a5b9a54.tar.gz
rust-b31f9cc22bcd720b37ddf927afe378108a5b9a54.zip
Auto merge of #97178 - sunfishcode:ownedfd-and-dup, r=joshtriplett
Add a `BorrowedFd::try_clone_to_owned` and accompanying documentation

Add a `BorrowedFd::try_clone_to_owned`, which returns a new `OwnedFd` sharing the underlying file description. And similar for `BorrowedHandle` and `BorrowedSocket` on WIndows.

This is similar to the existing `OwnedFd::try_clone`, but it's named differently to reflect that it doesn't return `Result<Self, ...>`. I'm open to suggestions for better names.

Also, extend the `unix::io` documentation to mention that `dup` is permitted on `BorrowedFd`.

This was originally requsted [here](https://github.com/rust-lang/rust/issues/88564#issuecomment-910786081). At the time I wasn't sure whether it was desirable, but it does have uses and it helps clarify the API. The documentation previously didn't rule out using `dup` on a `BorrowedFd`, but the API only offered convenient ways to do it from an `OwnedFd`. With this patch, the API allows one to do `try_clone` on any type where it's permitted.
Diffstat (limited to 'compiler/rustc_codegen_llvm/src/builder.rs')
0 files changed, 0 insertions, 0 deletions