Hive Hive
Sign in

fix(graph): format rust feature cfg values as literals

GitHub issue · Closed

Metadata
Source
tuist/once #138
Updated
Jul 5, 2026
Domains
Once
Details

What changed

  • Formats Rust feature configuration values as raw Rust string literals when the Rust prelude lowers features and crate_features into rustc --cfg arguments.
  • 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_cfgs
  • mise exec -- cargo test -p once-frontend --test prelude prelude_rust_windows_feature_cfgs_use_response_file
  • mise exec -- cargo test -p once-frontend --test prelude prelude_rust_non_windows_feature_cfgs_stay_inline
  • mise exec -- cargo test -p once-frontend --test prelude
  • mise exec -- cargo test -p once-frontend
  • mise exec -- cargo fmt --all -- --check
  • git diff --check
  • mise exec -- cargo clippy -p once-frontend --all-targets -- -D warnings
Flights

Investigate, reproduce, or fix this item in an isolated repository. Each Flight preserves its outcome and agent session.

New Flights are paused Configure model inference, GitHub, and a sandbox provider to start another Flight. Existing results remain available below.
No Flights yet

Start a Flight and preserve its objective, outcome, and session here.

Comments

No GitHub comments yet.