Skip to content

Commit a50811a

Browse files
notriddleelichai
andcommitted
Add safety note to library/std/src/sys/unix/fd.rs
Co-authored-by: Elichai Turkel <[email protected]>
1 parent 59abdb6 commit a50811a

File tree

1 file changed

+1
-0
lines changed
  • library/std/src/sys/unix

1 file changed

+1
-0
lines changed

library/std/src/sys/unix/fd.rs

+1
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,7 @@ const fn max_iov() -> usize {
6969
impl FileDesc {
7070
pub fn new(fd: c_int) -> FileDesc {
7171
assert_ne!(fd, -1);
72+
// 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)
7273
unsafe { FileDesc { fd } }
7374
}
7475

0 commit comments

Comments
 (0)