bazelbuild / bazelbuild/rules_rust

`incompatible_use_unstable_no_codegen_for_pipelining`

Open
#3,977 0 comments 0 reactions 0 assignees View on GitHub
pipelining
Dominant language
Starlark
Stars
843
Forks
651
Avg merge
2d 18h
Merged PRs (30d)
15

Description

## Summary

`--@rules_rust//rust/settings:pipelined_compilation` currently runs `rustc --emit=metadata,link` and kills the process when the `.rmeta` artifact is written. This is fragile (races rustc's output), doesn't match Buck2's implementation, and leaves dep-info/incremental steps unrun.

The new implementation runs `rustc -Zno-codegen --emit=link=` to completion, producing a Buck2-style hollow rlib. Since `-Zno-codegen` is unstable, this requires `RUSTC_BOOTSTRAP=1` on the pipelined actions (set automatically; must be set on both metadata and full actions because it participates in SVH).

See PR #3870.

## Change

A new incompatible flag `incompatible_use_unstable_no_codegen_for_pipelining` has been introduced (defaulting to `false`) that switches the pipelining implementation to `-Zno-codegen`/hollow-rlib and sets `RUSTC_BOOTSTRAP=1` on pipelined actions.

Only has an effect when `pipelined_compilation` is also enabled.

## Migration

Opt in with:

```
--@rules_rust//rust/settings:incompatible_use_unstable_no_codegen_for_pipelining=true
```

If you cannot adopt `RUSTC_BOOTSTRAP=1`, leave this flag `false` until the old path is removed, or disable `pipelined_compilation`.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.