Skip to content

Fix '--strategy=Rustc=local' with pipelined compilation#17

Merged
dzbarsky merged 1 commit into
hermeticbuild:mainfrom
walter-zeromatter:user/wgray/hermeticbuild-pipelining-fix
Apr 17, 2026
Merged

Fix '--strategy=Rustc=local' with pipelined compilation#17
dzbarsky merged 1 commit into
hermeticbuild:mainfrom
walter-zeromatter:user/wgray/hermeticbuild-pipelining-fix

Conversation

@walter-zeromatter
Copy link
Copy Markdown

When used with local compilation strategies that disable sandboxing, rustc's -Ldependency scan can pick up the _meta.rlib alongside the full '.rlbi', producing undefined-symbol link errors. To avoid this, emit the hollow metadata rlibs into a '_meta/' subdirectory, and add an explicit link to that directory for any metadata-consuming actions.

…tc's -Ldependency scan can pick up the _meta.rlib alongside the full '.rlbi', producing undefined-symbol link errors. To avoid this, emit the hollow metadata rlibs into a '_meta/' subdirectory, and add an explicit link to that directory for any metadata-consuming actions.
@dzbarsky dzbarsky merged commit 1d8ffca into hermeticbuild:main Apr 17, 2026
1 check failed
dzbarsky pushed a commit that referenced this pull request May 8, 2026
* When '--strategy=Rustc=local' is used with pipelined compilation, rustc's -Ldependency scan can pick up the _meta.rlib alongside the full '.rlbi', producing undefined-symbol link errors. To avoid this, emit the hollow metadata rlibs into a '_meta/' subdirectory, and add an explicit link to that directory for any metadata-consuming actions. (#17)

* Add RUSTC_BOOTSTRAP guardrail for -Zno-codegen pipelining

Injects RUSTC_BOOTSTRAP=1 + -Zallow-features= (empty list) on the metadata
and full compile actions when pipelined_compilation is enabled on a
stable/beta toolchain. The bootstrap env is required for -Zno-codegen on
non-nightly rustc and must match across both actions for SVH compatibility.
The empty allow-features list prevents the bootstrap env from silently
unlocking #![feature(...)] in user code.

Nightly toolchains skip both injections: unstable features are already
allowed, and the guardrail would break legitimate #![feature(...)] usage.

Escape hatch: if the user sets RUSTC_BOOTSTRAP in rustc_env / shell env or
passes -Zallow-features=... via rustc_flags / extra_rustc_flag, rules_rust
treats their configuration as authoritative and skips both injections.

Tests:
- //test/pipelining_bootstrap_gate: manual target that #![feature(trait_alias)]
  to validate E0725 fires on stable under the guardrail.
- //test/unit/pipelined_compilation: guardrail_{baseline,user_env,user_flag,
  space_form,global_env,global_flag}_optout_test variants.
dzbarsky pushed a commit that referenced this pull request May 11, 2026
* When '--strategy=Rustc=local' is used with pipelined compilation, rustc's -Ldependency scan can pick up the _meta.rlib alongside the full '.rlbi', producing undefined-symbol link errors. To avoid this, emit the hollow metadata rlibs into a '_meta/' subdirectory, and add an explicit link to that directory for any metadata-consuming actions. (#17)

* Add RUSTC_BOOTSTRAP guardrail for -Zno-codegen pipelining

Injects RUSTC_BOOTSTRAP=1 + -Zallow-features= (empty list) on the metadata
and full compile actions when pipelined_compilation is enabled on a
stable/beta toolchain. The bootstrap env is required for -Zno-codegen on
non-nightly rustc and must match across both actions for SVH compatibility.
The empty allow-features list prevents the bootstrap env from silently
unlocking #![feature(...)] in user code.

Nightly toolchains skip both injections: unstable features are already
allowed, and the guardrail would break legitimate #![feature(...)] usage.

Escape hatch: if the user sets RUSTC_BOOTSTRAP in rustc_env / shell env or
passes -Zallow-features=... via rustc_flags / extra_rustc_flag, rules_rust
treats their configuration as authoritative and skips both injections.

Tests:
- //test/pipelining_bootstrap_gate: manual target that #![feature(trait_alias)]
  to validate E0725 fires on stable under the guardrail.
- //test/unit/pipelined_compilation: guardrail_{baseline,user_env,user_flag,
  space_form,global_env,global_flag}_optout_test variants.
dzbarsky pushed a commit that referenced this pull request May 11, 2026
* When '--strategy=Rustc=local' is used with pipelined compilation, rustc's -Ldependency scan can pick up the _meta.rlib alongside the full '.rlbi', producing undefined-symbol link errors. To avoid this, emit the hollow metadata rlibs into a '_meta/' subdirectory, and add an explicit link to that directory for any metadata-consuming actions. (#17)

* Add RUSTC_BOOTSTRAP guardrail for -Zno-codegen pipelining

Injects RUSTC_BOOTSTRAP=1 + -Zallow-features= (empty list) on the metadata
and full compile actions when pipelined_compilation is enabled on a
stable/beta toolchain. The bootstrap env is required for -Zno-codegen on
non-nightly rustc and must match across both actions for SVH compatibility.
The empty allow-features list prevents the bootstrap env from silently
unlocking #![feature(...)] in user code.

Nightly toolchains skip both injections: unstable features are already
allowed, and the guardrail would break legitimate #![feature(...)] usage.

Escape hatch: if the user sets RUSTC_BOOTSTRAP in rustc_env / shell env or
passes -Zallow-features=... via rustc_flags / extra_rustc_flag, rules_rust
treats their configuration as authoritative and skips both injections.

Tests:
- //test/pipelining_bootstrap_gate: manual target that #![feature(trait_alias)]
  to validate E0725 fires on stable under the guardrail.
- //test/unit/pipelined_compilation: guardrail_{baseline,user_env,user_flag,
  space_form,global_env,global_flag}_optout_test variants.
dzbarsky pushed a commit that referenced this pull request May 15, 2026
* When '--strategy=Rustc=local' is used with pipelined compilation, rustc's -Ldependency scan can pick up the _meta.rlib alongside the full '.rlbi', producing undefined-symbol link errors. To avoid this, emit the hollow metadata rlibs into a '_meta/' subdirectory, and add an explicit link to that directory for any metadata-consuming actions. (#17)

* Add RUSTC_BOOTSTRAP guardrail for -Zno-codegen pipelining

Injects RUSTC_BOOTSTRAP=1 + -Zallow-features= (empty list) on the metadata
and full compile actions when pipelined_compilation is enabled on a
stable/beta toolchain. The bootstrap env is required for -Zno-codegen on
non-nightly rustc and must match across both actions for SVH compatibility.
The empty allow-features list prevents the bootstrap env from silently
unlocking #![feature(...)] in user code.

Nightly toolchains skip both injections: unstable features are already
allowed, and the guardrail would break legitimate #![feature(...)] usage.

Escape hatch: if the user sets RUSTC_BOOTSTRAP in rustc_env / shell env or
passes -Zallow-features=... via rustc_flags / extra_rustc_flag, rules_rust
treats their configuration as authoritative and skips both injections.

Tests:
- //test/pipelining_bootstrap_gate: manual target that #![feature(trait_alias)]
  to validate E0725 fires on stable under the guardrail.
- //test/unit/pipelined_compilation: guardrail_{baseline,user_env,user_flag,
  space_form,global_env,global_flag}_optout_test variants.
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.

2 participants