Skip to content

Commit 007cbfd

Browse files
committed
Revise the documentation for try_clone.
On Unix, describe these in terms of the underlying "file description". On Windows, describe them in terms of the underlying "object".
1 parent 5d0eae8 commit 007cbfd

File tree

3 files changed

+8
-6
lines changed

3 files changed

+8
-6
lines changed

library/std/src/os/fd/owned.rs

+4-2
Original file line numberDiff line numberDiff line change
@@ -77,8 +77,8 @@ impl BorrowedFd<'_> {
7777
}
7878

7979
impl OwnedFd {
80-
/// Creates a new `OwnedFd` instance that shares the same underlying file handle
81-
/// as the existing `OwnedFd` instance.
80+
/// Creates a new `OwnedFd` instance that shares the same underlying file
81+
/// description as the existing `OwnedFd` instance.
8282
#[stable(feature = "io_safety", since = "1.63.0")]
8383
pub fn try_clone(&self) -> crate::io::Result<Self> {
8484
self.as_fd().try_clone_to_owned()
@@ -108,6 +108,8 @@ impl BorrowedFd<'_> {
108108
Ok(unsafe { OwnedFd::from_raw_fd(fd) })
109109
}
110110

111+
/// Creates a new `OwnedFd` instance that shares the same underlying file
112+
/// description as the existing `BorrowedFd` instance.
111113
#[cfg(target_arch = "wasm32")]
112114
#[stable(feature = "io_safety", since = "1.63.0")]
113115
pub fn try_clone_to_owned(&self) -> crate::io::Result<OwnedFd> {

library/std/src/os/windows/io/handle.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -177,8 +177,8 @@ impl TryFrom<HandleOrNull> for OwnedHandle {
177177
}
178178

179179
impl OwnedHandle {
180-
/// Creates a new `OwnedHandle` instance that shares the same underlying file handle
181-
/// as the existing `OwnedHandle` instance.
180+
/// Creates a new `OwnedHandle` instance that shares the same underlying
181+
/// object as the existing `OwnedHandle` instance.
182182
#[stable(feature = "io_safety", since = "1.63.0")]
183183
pub fn try_clone(&self) -> crate::io::Result<Self> {
184184
self.as_handle().try_clone_to_owned()

library/std/src/os/windows/io/socket.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -82,8 +82,8 @@ impl BorrowedSocket<'_> {
8282
}
8383

8484
impl OwnedSocket {
85-
/// Creates a new `OwnedSocket` instance that shares the same underlying socket
86-
/// as the existing `OwnedSocket` instance.
85+
/// Creates a new `OwnedSocket` instance that shares the same underlying
86+
/// object as the existing `OwnedSocket` instance.
8787
#[stable(feature = "io_safety", since = "1.63.0")]
8888
pub fn try_clone(&self) -> io::Result<Self> {
8989
self.as_socket().try_clone_to_owned()

0 commit comments

Comments
 (0)