Skip to content

cargo check --workspace fails on the pinned stable toolchain (nightly-only x86_64 default feature + bootloader build script in the hv1 crates) #57

Description

@wernerkasselman-au

Summary

On a clean clone against the toolchain the repo itself pins
(rust-toolchain.toml -> channel = "stable", rust-version = "1.95"),
cargo check --workspace fails for me. Two dependencies of the Type-1
(hv1-*) crates require nightly and abort the check on a stable x86_64 host.
The rest of the workspace (all hv2-* crates plus hm-cli/hm-gui) compiles
cleanly once these two are addressed.

Environment

  • rustc 1.95.0 stable, cargo 1.95.0 (matches rust-toolchain.toml and the
    workspace rust-version = "1.95")
  • Host: x86_64 Linux
  • protoc 35.1 present (so the hv2-api build is not the blocker)
  • Current master (Cargo.lock: x86_64 v0.15.4, bootloader v0.11.15)

Reproduction

$ cargo check --workspace --all-targets

Fails with exit code 101. A minimal single-crate check reproduces the primary
blocker on its own:

$ cargo check -p hv1-core

Root cause 1: x86_64 = "0.15" enables the nightly abi_x86_interrupt gate

crates/hv1-core/Cargo.toml (and crates/hv1-boot/Cargo.toml) depend on
x86_64 = "0.15" with default features. In x86_64 0.15.4,
default = ["nightly", "instructions"] and nightly pulls in
abi_x86_interrupt, which activates a nightly-only feature gate:

error[E0554]: `#![feature]` may not be used on the stable release channel
 --> x86_64-0.15.4/src/lib.rs:5
5 | #![cfg_attr(feature = "abi_x86_interrupt", feature(abi_x86_interrupt))]
error: could not compile `x86_64` (lib) due to 1 previous error

This hits the library build of hv1-core, so plain cargo check --workspace (not just --all-targets) fails. The x86_64 dependency is
target-gated to cfg(target_arch = "x86_64"), which does not help on an
x86_64 host: the gate is true, so the nightly-requiring dependency is pulled
in as normal.

Root cause 2: bootloader v0.11 build script uses nightly-only -Z flags

crates/hv1-boot has bootloader = "0.11" as a build-dependency. Its build
script invokes cargo with -Z flags, which stable cargo rejects:

error: failed to run custom build command for `bootloader v0.11.15`
  error: the `-Z` flag is only accepted on the nightly channel of Cargo, but
         this is the `stable` channel

This surfaces when --all-targets pulls in the hv1-boot bootable-image
target. Building an actual boot image is inherently a nightly task, so this
one is arguably by design; see the suggestion below.

Impact

  • A plain workspace check against the pinned toolchain does not succeed out of
    the box. New contributors following the repo's own toolchain hit a hard
    error on first cargo check.
  • Any stable CI job that runs a full cargo check --workspace on x86_64 would
    hit the same failure (target-gating does not skip the dep on an x86_64
    host).

Suggested minimal fix

Drop the x86_64 crate's nightly default feature and keep instructions (the
CPU-intrinsics / MSR-access feature the hv1 call sites I checked appear to
need; if you rely on the abi_x86_interrupt interrupt-handler surface
elsewhere you will want to keep that feature too):

# crates/hv1-core/Cargo.toml  and  crates/hv1-boot/Cargo.toml
- x86_64 = "0.15"
+ x86_64 = { version = "0.15", default-features = false, features = ["instructions"] }

For hv1-boot, since it is a genuinely nightly bootable-image crate, the
cleanest option is to keep it out of the default stable workspace build rather
than force it onto stable. Options, in order of least surprise (maintainers'
call):

  1. Document cargo +nightly build -p hv1-boot and exclude it from the stable
    cargo check --workspace lane in CI, or
  2. Move hv1-boot to exclude = [...] in the workspace with a
    # nightly-only bootimage note, or
  3. Keep it a member but add a nightly CI job for it specifically.

Minor: crates/hv1-boot/Cargo.toml carries edition = "2024" # Requires nightly Rust. Edition 2024 has been stable since Rust 1.85, so that comment
is a bit out of date; the real nightly requirement here is the bootloader
build script.

Verification

With the x86_64 change applied and hv1-boot excluded:

$ cargo check --workspace --exclude hv1-boot --all-targets
    Finished `dev` profile [unoptimized + debuginfo] target(s) in 10.67s

Finishes in about 11s on my machine (10.67s wall clock here), exit 0, zero
errors. All 13 remaining workspace crates compile on stable 1.95.0, including
hv1-core and hv1-arm (one pre-existing unused-Result warning at
crates/hv1-core/src/vm.rs:724, unrelated to this change).

Happy to open a PR for the x86_64 feature change once you have a preference
on how to handle hv1-boot (1 / 2 / 3 above), or to adjust it to match
whatever you prefer.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions