Commit Graph

10 Commits

Author SHA1 Message Date
Dan Gohman
2009f8286e
Sync with rustix' build.rs changes (#58)
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`.
2023-01-12 10:44:27 -08:00
Christian Meissl
8e001dd0e1
fix cross compilation with custom sysroot (#57)
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
2023-01-12 10:24:32 -08:00
Dan Gohman
7836dafaee
Remove use of rustc_attrs, which is no longer needed. (#53)
* 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.
2022-11-25 10:01:14 -08:00
Dan Gohman
cd52bb39ea
Work around a bug in std::os::wasi::io. (#47) 2022-10-20 15:08:52 -07:00
Dan Gohman
170df73e4f
Update for io_safety being stabilized. (#41)
* 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.
2022-08-16 09:57:55 -07:00
Dan Gohman
c974453c4d Avoid depending on panic in const fn, to fix compilaton on Rust <= 1.56. 2022-05-21 09:06:39 -07:00
Dan Gohman
821c181bb0 Fix rustc feature detection to work on the beta channel.
`--emit=dep-info` wasn't enough to evoke the errors we were expecting,
though only on the beta channel. So use `--emit=metadata` instead.
2021-11-19 12:59:52 -08:00
Dan Gohman
b393bf226a Use fine-grained feature detection instead of rustc_version.
Test whether rustc supports specific features, rather than assuming that
Nightly has all the features and Stable doesn't.
2021-11-19 09:03:53 -08:00
Dan Gohman
1d46947aca Update a comment. 2021-06-14 05:30:01 -07:00
Dan Gohman
6a8bfa29ea Support stable Rust.
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.
2021-06-04 08:25:31 -07:00