# Bootstrap warning "Use \`--keep-stage-std\` ..." persists even when the option is used

**URL:** <https://internals.rust-lang.org/t/bootstrap-warning-use-keep-stage-std-persists-even-when-the-option-is-used/20139>\
**Category:** compiler\
**Created:** [January 4, 2024, 9:19am UTC](https://internals.rust-lang.org/t/bootstrap-warning-use-keep-stage-std-persists-even-when-the-option-is-used/20139 "2024-01-04T09:19:22Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![cushionbadak](https://sea2.discourse-cdn.com/flex002/user_avatar/internals.rust-lang.org/cushionbadak/32/11667_2.png) [@cushionbadak](https://internals.rust-lang.org/u/cushionbadak)\
**Post date:** [January 4, 2024, 9:19am UTC](https://internals.rust-lang.org/t/bootstrap-warning-use-keep-stage-std-persists-even-when-the-option-is-used/20139/1 "2024-01-04T09:19:22Z")

</div>

~~A pull request [Add `--keep-stage-std` to `x.py` for keeping only standard library artifacts by ecstatic-morse · Pull Request #77120 · rust-lang/rust · GitHub](https://github.com/rust-lang/rust/pull/77120) introduces an option `--keep-stage-std` for bootstrapping (`./x`), but it does not provide any meaningful action, but it is just another syntactic bloat of `--keep-stage` option.~~

~~As you can see in the pull request, it pipes the option `--keep-stage-std` value to `config.keep_stage_std` and `flags.keep_stage_std`, but I cannot find any unique functionality of `config.keep_stage_std` value compared to `config.keep_stage`.~~

~~I think keeping this option is unnecessary. Am I missing something?~~

~~Reference: Following is the only part~~ I found where `config.keep_stage_std` value used:

> <https://github.com/rust-lang/rust/blob/139fb2214675fed8143a12f6287a3a1e6e2e866d/src/bootstrap/src/core/build_steps/compile.rs#L141-L151>

EDIT: I discovered another logic that distinguishes `keep_stage` and `keep_stage_std`:

> <https://github.com/rust-lang/rust/blob/090d5eac722000906cc00d991f2bf052b0e388c3/src/bootstrap/src/core/build_steps/compile.rs#L1255-L1270>

EDIT: changed the title from "Bootstrap option --keep-stage-std is meaningless" to "Bootstrap warning "Use `--keep-stage-std` ..." persists even when the option is used". I'm rethinking whether the option is actually meaningless. Sorry for the confusion. 🫠

From my understanding:

- `keep_stage` copies third party objects and `copy_self_contained_objects`, skipping the compiler build
- `keep_stage_std` also copies these objects but doesn't skip the compiler build.

I apologize for my earlier mistake. Let's discuss this option further. My initial misunderstanding and post on this forum were prompted by a persistent warning message from the bootstrapping script `./x`. It shows "WARNING: Use `--keep-stage-std` if you want to rebuild the compiler when it changes", even if I use multiple `--keep-stage-std` options like `./x build compiler --keep-stage 0 --keep-stage 1 --keep-stage-std 0 --keep-stage-std 1`. After researching on GitHub, I realized that this warning only depends on the `keep_stage` configuration, not the presense of `keep_stage_std`.

> <https://github.com/rust-lang/rust/blob/090d5eac722000906cc00d991f2bf052b0e388c3/src/bootstrap/src/core/build_steps/compile.rs#L821-L826>

I find this rigid method of showing warning messages to be confusing and not straightforward.

---

<div class="post-metadata">

**Author:** ![system](https://sea2.discourse-cdn.com/flex002/user_avatar/internals.rust-lang.org/system/32/14092_2.png) [@system](https://internals.rust-lang.org/u/system)\
**Post date:** [April 3, 2024, 9:19am UTC](https://internals.rust-lang.org/t/bootstrap-warning-use-keep-stage-std-persists-even-when-the-option-is-used/20139/2 "2024-04-03T09:19:44Z")

</div>

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.
