io-lifetimes and rustix and a few other crates I maintain have similar
build.rs scripts. Port some of the changes from rustix to io-lifetimes
to keep them in sync.
- Add `#![allow(stable_features)]` to the `has_feature` code to allow
it to detect features that have gotten stablized.
- Redirect feature-detection stderr to null, as it's confusing.
- Rename `test_program` to `can_compile`.
compiling rust programs in yocto uses a custom
target triple with a custom sysroot
not specifying the sysroot when executing rustc
can lead to errors like "can't find crate for `std`"
this patch forwards the sysroot for testing features
* Remove use of `rustc_attrs`, which is no longer needed.
This io-lifetimes crate no longer needs this rustc_attrs code. On Rust
versions where io_safety is stabilized, we use the version in std (which
uses rustc_attrs internally). On Rust versions where it's not, rustc_attrs
isn't available to user code anyway, since it's not a stable language
feature.
This might fix#51.
* Rename `io_lifetimes_use_std` to `io_safety_is_in_std`.
This may also help fix#51.
* Update for io_safety being stabilized.
io_safety is now [stable in Rust 1.63]! This PR updates io-lifetimes to
use the standard library types and traits when available, and use its
own types and traits on older Rust versions.
The traits `FromFd` and `IntoFd` are now marked as deprecated. These are
replaced by `From<OwnedFd>` and `From<...> for OwnedFd` in the standard
library, and users should migrate accordingly.
[stable in Rust 1.63]: https://blog.rust-lang.org/2022/08/11/Rust-1.63.0.html#rust-ownership-for-raw-file-descriptorshandles-io-safety
* Disable deprecation warnings for our own uses of `FromFd` and `IntoFd`.
And, migrate the portability types and traits to use `From<OwnedFd>`
and `Into<OwnedFd>`.
* Deprecate the `from_fd` function, rather than the `FromFd` trait.
This allows the `from_into_fd` extension to continue working, for now.
Stable Rust doesn't support `rustc_attrs` outside of `std`, so
we can't do the niche optimization for `RawFd` or the FFI bindings
for `open` on stable Rust, but everything else works.