Skip to content

Commit

Permalink
Add safety note to library/std/src/sys/unix/fd.rs
Browse files Browse the repository at this point in the history
Co-authored-by: Elichai Turkel <elichai.turkel@gmail.com>
  • Loading branch information
notriddle and elichai committed Dec 10, 2020
1 parent 59abdb6 commit a50811a
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions library/std/src/sys/unix/fd.rs
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ const fn max_iov() -> usize {
impl FileDesc {
pub fn new(fd: c_int) -> FileDesc {
assert_ne!(fd, -1);
// SAFETY: we just asserted that the value is in the valid range and isn't `-1` (the only value bigger than `0xFF_FF_FF_FE` unsigned)
unsafe { FileDesc { fd } }
}

Expand Down

0 comments on commit a50811a

Please sign in to comment.