|
| 1 | +--- |
| 2 | +layout: post |
| 3 | +title: "Changes to x.py defaults" |
| 4 | +author: Joshua Nelson |
| 5 | +team: the compiler team <https://www.rust-lang.org/governance/teams/compiler> |
| 6 | +--- |
| 7 | + |
| 8 | +Recently, the defaults for [`x.py`], the tool used to [bootstrap] the Rust compiler from source, changed. If you regularly contribute to Rust, this might affect your workflow. |
| 9 | + |
| 10 | +## What changes were made? |
| 11 | + |
| 12 | +- The default stage is now dependent on the subcommand: |
| 13 | + + `dist`: stage 2 |
| 14 | + + `build`: stage 1 |
| 15 | + + `test`: stage 1 |
| 16 | + + `doc`: stage 0 |
| 17 | + |
| 18 | +- stage 1 `rustc` artifacts are no longer built by `x.py build --stage 1`. To get the old behavior back, use `x.py build --stage 1 src/rustc`. The new behavior for `build --stage 1` builds everything except `rustc`, which includes the standard library, `rustdoc`, and various other tools (if the tools are enabled). |
| 19 | + |
| 20 | +- `debuginfo` now defaults to `1` when `debug = true`. Previously, the default was 2. |
| 21 | + |
| 22 | +## Why were the changes made? |
| 23 | + |
| 24 | +Previously, `x.py build` would build `rustc` twice: |
| 25 | + |
| 26 | +1. `build/stage0-std` |
| 27 | +2. `build/stage0-rustc` |
| 28 | +3. `build/stage1-std` |
| 29 | +4. `build/stage1-rustc` |
| 30 | + |
| 31 | +Normally, contributors only want to build the compiler once, which lets them test their changes quickly. After this change, that's now the default: |
| 32 | + |
| 33 | +1. `build/stage0-std` |
| 34 | +2. `build/stage0-rustc` |
| 35 | +3. `build/stage1-std` |
| 36 | + |
| 37 | +`debuginfo = 2` generates several gigabytes of debug information, |
| 38 | +making the previous default settings for `debug = true` very painful. |
| 39 | + |
| 40 | +For a detailed rationale of the changes, as well as more information about the alternatives considered, see |
| 41 | + |
| 42 | +- [the MCP] |
| 43 | +- the [implementation PR] |
| 44 | +- the [Zulip stream] |
| 45 | + |
| 46 | +[`x.py`]: https://rustc-dev-guide.rust-lang.org/building/how-to-build-and-run.html#what-is-xpy |
| 47 | +[bootstrap]: https://rustc-dev-guide.rust-lang.org/building/bootstrapping.html |
| 48 | +[the MCP]: https://github.com/rust-lang/compiler-team/issues/326 |
| 49 | +[implementation PR]: https://github.com/rust-lang/rust/pull/73964 |
| 50 | +[Zulip stream]: https://rust-lang.zulipchat.com/#narrow/stream/233931-xxx/topic/Use.20sane.20defaults.20in.20x.py.20compiler-team.23326 |
0 commit comments