about summary refs log tree commit diff
path: root/library/std/src/sys/unix/fd/tests.rs
diff options
context:
space:
mode:
authorMichael Howell <michael@notriddle.com>2020-07-27 21:25:36 -0700
committerMichael Howell <michael@notriddle.com>2020-12-10 13:31:52 -0700
commit59abdb6a7eef003b1a1b0711ceb9a1edb1d1b84c (patch)
tree6b6a7ec3769332eae8d899a0987a7c2b7d9437f4 /library/std/src/sys/unix/fd/tests.rs
parentd32c320d7eee56706486fef6be778495303afe9e (diff)
downloadrust-59abdb6a7eef003b1a1b0711ceb9a1edb1d1b84c.tar.gz
rust-59abdb6a7eef003b1a1b0711ceb9a1edb1d1b84c.zip
Mark `-1` as an available niche for file descriptors
Based on discussion from https://internals.rust-lang.org/t/can-the-standard-library-shrink-option-file/12768,
the file descriptor -1 is chosen based on the POSIX API designs that use it as a sentinel to report errors.
A bigger niche could've been chosen, particularly on Linux, but would not necessarily be portable.

This PR also adds a test case to ensure that the -1 niche
(which is kind of hacky and has no obvious test case) works correctly.
It requires the "upper" bound, which is actually -1, to be expressed in two's complement.
Diffstat (limited to 'library/std/src/sys/unix/fd/tests.rs')
0 files changed, 0 insertions, 0 deletions