Cargo version check - #72
Merged
Merged
Conversation
jprendes
force-pushed
the
cargo-version-check
branch
2 times, most recently
from
August 20, 2026 14:44
55ab615 to
26a7867
Compare
The hyperlight guest targets are described by a custom target specification JSON file. Support for those was made unstable in Rust 1.95, so on a newer stable toolchain the build failed deep inside cargo with an error that gave no hint about what to do about it. Probe the toolchain instead of guessing from its version. Once the target specification has been written to the sysroot, run `rustc --sysroot <sysroot> --target <target> --print=cfg`, which forces rustc to load it. If the plain invocation fails, retry with `-Zunstable-options`; when that succeeds the requirement is recorded in `Args::unstable_target_spec` and the flag is added to the RUSTFLAGS of the sysroot, guest and C API builds, which is what makes nightly toolchains work. If neither invocation succeeds, fail early and report rustc's own diagnostic together with guidance on picking a usable toolchain. Asking the compiler is more accurate than comparing release numbers: it distinguishes nightly from beta without hardcoding channel names, and it will keep working if custom target specifications are stabilised again. While here, propagate errors out of `main` instead of unwrapping them, so a failure to spawn cargo prints the same tidy diagnostic as any other error rather than a panic. Signed-off-by: Jorge Prendes <jorge.prendes@gmail.com>
jprendes
force-pushed
the
cargo-version-check
branch
from
August 20, 2026 15:21
26a7867 to
fa9d03b
Compare
Add a job that builds a guest with three toolchains and asserts the outcome of each: 1.94, where custom target specifications are still stable and the build must succeed; 1.95, the first release where they became unstable and the build must be rejected up front with the diagnostic that explains how to fix it; and nightly, where they are available behind `-Zunstable-options` and the build must succeed again. cargo-hyperlight itself is always built from the toolchain pinned in rust-toolchain.toml, and only the guest build runs under the toolchain being tested, so the job exercises the detection rather than whichever compiler happened to build the tool. Signed-off-by: Jorge Prendes <jorge.prendes@gmail.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.