Skip to content

Commit

Permalink
Make language around ToOwned for BorrowedFd more precise
Browse files Browse the repository at this point in the history
  • Loading branch information
tbu- committed Jul 17, 2024
1 parent f431b51 commit 455bd57
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions std/src/os/fd/owned.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,11 @@ use crate::sys_common::{AsInner, FromInner, IntoInner};
/// passed as an argument, it is not captured or consumed, and it never has the
/// value `-1`.
///
/// This type's `.to_owned()` implementation returns another `BorrowedFd`
/// rather than an `OwnedFd`. It just makes a trivial copy of the raw file
/// descriptor, which is then borrowed under the same lifetime.
/// This type does not have a [`ToOwned`][crate::borrow::ToOwned]
/// implementation. Calling `.to_owned()` on a variable of this type will call
/// it on `&BorrowedFd` and use `Clone::clone()` like `ToOwned` does for all
/// types implementing `Clone`. The result will be descriptor borrowed under
/// the same lifetime.
#[derive(Copy, Clone)]
#[repr(transparent)]
#[rustc_layout_scalar_valid_range_start(0)]
Expand Down

0 comments on commit 455bd57

Please sign in to comment.