Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add rustc-check-cfg directive #44

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

gretchenfrage
Copy link

@gretchenfrage gretchenfrage commented Oct 28, 2024

Closes #43 by emitting a rustc-check-cfg directive to the compiler ([relevant section of rustc book]).

Although the rustc book recommends using two colons, doing so in this repo gives this error when running cargo check --tests:

error: the `cargo::` syntax for build script output instructions was added in Rust 1.77.0, but the minimum supported Rust version of `hyper-openssl v0.10.2 (/home/phoenix/repos/h3stuff/hyper-openssl)` is 1.68.
Switch to the old `cargo:rustc-check-cfg=cfg(ossl102)` syntax (note the single colon).
See https://doc.rust-lang.org/cargo/reference/build-scripts.html#outputs-of-the-build-script for more information about build script outputs.

Using a single colon for the "old syntax" seems to work with both of the following commands:

cargo check --tests
#   Compiling hyper-openssl v0.10.2 (/home/phoenix/repos/h3stuff/hyper-openssl)
#    Finished `dev` profile [unoptimized + debuginfo] target(s) in 0.13s
rustup install 1.68 && rm Cargo.lock && CARGO_RESOLVER_INCOMPATIBLE_RUST_VERSIONS=fallback cargo +nightly -Zmsrv-policy generate-lockfile && cargo +1.68 check --tests
#info: syncing channel updates for '1.68-x86_64-unknown-linux-gnu'
#
#  1.68-x86_64-unknown-linux-gnu unchanged - rustc 1.68.2 (9eb3afe9e 2023-03-27)
#
#info: self-update is disabled for this build of rustup
#info: any updates to rustup will need to be fetched with your system package manager
#    Updating crates.io index
#     Locking 92 packages to latest Rust 1.68 compatible versions
#      Adding tokio v1.38.1 (available: v1.41.0, requires Rust 1.70)
#      Adding tokio-macros v2.3.0 (available: v2.4.0, requires Rust 1.70)
#      Adding tokio-util v0.7.11 (available: v0.7.12, requires Rust 1.70)
#   Compiling hyper-openssl v0.10.2 (/home/phoenix/repos/h3stuff/hyper-openssl)
#warning: cargo:rustc-check-cfg requires -Zcheck-cfg=output flag
#warning: cargo:rustc-check-cfg requires -Zcheck-cfg=output flag
#    Finished dev [unoptimized + debuginfo] target(s) in 0.27s

(Random note: In the second command I am having to use the experimental MSRV-aware resolver to get this compiling on Rust 1.68 due to a transitive dependency on tokio through hyper).

This fixes a warning that got printed when running `cargo check --tests`
@gretchenfrage
Copy link
Author

It looks like CI failed because of my noted MSRV complication related to hyper-openssl having a transitive dependency on tokio through hyper, with tokio having a MSRV of 1.70 for tokio versions 1.39 and above, with that version of tokio having been released this July. While it's possible to generate a lock file which lets this compile, as I demonstrated in my original post, it doesn't seem that this project's CI is doing that.

Would you consider bumping the MSRV of this project from 1.68 to 1.70? It was released over a year ago.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Running cargo check --tests emits "unexpected cfg condition name: ossl102" warning
1 participant