mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-23 15:23:46 +00:00
Add safety note to library/std/src/sys/unix/fd.rs
Co-authored-by: Elichai Turkel <elichai.turkel@gmail.com>
This commit is contained in:
parent
59abdb6a7e
commit
a50811a214
@ -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 } }
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user