Description
I/O Safety (#87074) uses types which are repr(transparent)
wrappers around file descriptors or sockets, and which have a niche at -1 which is an invalid fd/socket. Those types use rustc_nonnull_optimization_guaranteed
, which together with the niche, allows using things like Option<OwnedFd>
in FFI.
(The attribute remains unstable, and is misnamed at this point since it shouldn't say "nonnull"; it should be something like rustc_niche_optimization_guaranteed
, but that shouldn't block this issue.)
Before stabilizing those types, we'd like to confirm T-lang consensus that we have no objections to exposing a type with a guaranteed non-zero niche (in this case, a guaranteed niche at -1). This commits us to continuing to provide some mechanism (even if perma-unstable) for declaring non-zero niches and allowing their use in FFI.