Skip to content

Commit 455bd57

Browse files
committedJul 17, 2024
Make language around ToOwned for BorrowedFd more precise
1 parent f431b51 commit 455bd57

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed
 

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

+5-3
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,11 @@ use crate::sys_common::{AsInner, FromInner, IntoInner};
2424
/// passed as an argument, it is not captured or consumed, and it never has the
2525
/// value `-1`.
2626
///
27-
/// This type's `.to_owned()` implementation returns another `BorrowedFd`
28-
/// rather than an `OwnedFd`. It just makes a trivial copy of the raw file
29-
/// descriptor, which is then borrowed under the same lifetime.
27+
/// This type does not have a [`ToOwned`][crate::borrow::ToOwned]
28+
/// implementation. Calling `.to_owned()` on a variable of this type will call
29+
/// it on `&BorrowedFd` and use `Clone::clone()` like `ToOwned` does for all
30+
/// types implementing `Clone`. The result will be descriptor borrowed under
31+
/// the same lifetime.
3032
#[derive(Copy, Clone)]
3133
#[repr(transparent)]
3234
#[rustc_layout_scalar_valid_range_start(0)]

0 commit comments

Comments
 (0)