Hive
fix(graph): format rust feature cfg values as literals
GitHub issue · Closed
What changed
- Formats Rust feature configuration values as raw Rust string literals when the Rust prelude lowers
featuresandcrate_featuresintorustc --cfgarguments. - Keeps generated Cargo dependency targets on the same managed Rust prelude path, so rule authors still write
features = [...]instead of hand-formatting compiler arguments. - Adds a regression test for the generated Windows Cargo dependency target shape that failed in the release workflow.
Why
The main release workflow is failing in the Windows release jobs while compiling generated Cargo dependency targets. The failing target is cargo_dependencies_x86_64_pc_windows_msvc/anyhow-1.0.102:rustc, which gets feature configuration from Cargo metadata rather than from a first-party release manifest.
Root cause
rustc --cfg requires feature values to be Rust string literals. The previous lowering relied on normal quoted values, which is fragile around response-file boundaries on Windows. The release job surfaced this as feature=default, which rustc rejects because the value is no longer a string literal.
Approach
The Rust prelude now owns the full feature configuration format by emitting values like feature=r#"default"#. This is still a Rust string literal, works when passed directly, and works in line-delimited rustc response files without shell-style quote preservation.
Impact
There is no rule authoring change. features = [...] and crate_features = [...] remain the ergonomic public surface, while the prelude handles the compiler-specific formatting detail consistently for hand-written Rust targets and generated Cargo dependency targets.
Validation
mise exec -- cargo test -p once-frontend --test prelude prelude_cargo_metadata_windows_features_escape_response_file_cfgsmise exec -- cargo test -p once-frontend --test prelude prelude_rust_windows_feature_cfgs_use_response_filemise exec -- cargo test -p once-frontend --test prelude prelude_rust_non_windows_feature_cfgs_stay_inlinemise exec -- cargo test -p once-frontend --test preludemise exec -- cargo test -p once-frontendmise exec -- cargo fmt --all -- --checkgit diff --checkmise exec -- cargo clippy -p once-frontend --all-targets -- -D warnings
Investigate, reproduce, or fix this item in an isolated repository. Each Flight preserves its outcome and agent session.
Start a Flight and preserve its objective, outcome, and session here.
No GitHub comments yet.