bootstrap: Move some shared source files into a new shim_utils crate - #159756
Conversation
|
The list of allowed third-party dependencies may have been modified! You must ensure that any new dependencies have compatible licenses before merging. cc @davidtwco, @BoxyUwU These commits modify the If this was unintentional then you should revert the changes before this PR is merged. Some changes occurred in src/tools/compiletest cc @jieyouxu |
|
|
No changes to any of the actual lists or logic in |
|
Local benchmarks indicate no measurable change to bootstrap build times: hyperfine --warmup=1 --runs=5 --ignore-failure --prepare="./x clean" "./x run cyclic-step" --show-output |
|
Yes! This tripped me up a few times in the past. |
| //! Code in the `shim_utils` crate can be tested here as part of `./x test bootstrap`. | ||
|
|
||
| use crate::utils::shared_helpers::parse_value_from_args; | ||
| use shim_utils::parse_value_from_args; |
There was a problem hiding this comment.
Doesn't have to be in this PR, but I think that these tests should live directly within shim_utils, and we should create a new default test step for that crate in bootstrap.
tidy: Check `proc_macro_deps.rs` by reading it, not by including it As noted at rust-lang#159756 (comment), tidy shouldn't be including this file as an submodule. Instead it should prepare an expected version of the file, then load the actual file and compare the two. That reduces the likelihood of accidentally blessing the wrong path, while avoiding awkward out-of-package `#[path(..)]` attributes.
This comment has been minimized.
This comment has been minimized.
Bootstrap's `rustc` and `rustdoc` shims are mostly self-contained, but they do share some code with each other or with other bootstrap tools. Historically that sharing was achieved using `#[path]` attributes pointing to the shared files. That's unusual, making the code harder to navigate, and making dependencies and warnings harder to manage. It also causes problems for rust-analyzer, which currently struggles with source files outside the crate root. This PR therefore takes two such source files, and moves them into a new `shim_utils` crate, which can then be used as a normal crate-path dependency. That new crate is separate from the existing `build_helper` crate, since that crate contains other code that is not of interest to the shims specifically. Former paths of the files that have been moved: - `src/bootstrap/src/utils/shared_helpers.rs` - `src/build_helper/src/arg_file_command.rs`
|
This PR was rebased onto a different main commit. Here's a range-diff highlighting what actually changed. Rebasing is a normal part of keeping PRs up to date, so no action is needed—this note is just to help reviewers. |
|
Thanks to #160325, |
|
Thank you! @bors r+ rollup |
…uwer Rollup of 5 pull requests Successful merges: - #159195 (Drop elaboration: Only create a reset block if there are flags to reset.) - #160318 (Bump thorin-dwp (0.10), gimli (0.33), and object (0.38.1)) - #159756 (bootstrap: Move some shared source files into a new `shim_utils` crate) - #160385 (Assign ownership for Renovate configuration file) - #160397 (Box::new: fix safety comment)
Rollup merge of #159756 - Zalathar:shim-utils, r=Kobzol bootstrap: Move some shared source files into a new `shim_utils` crate Bootstrap's `rustc` and `rustdoc` shims are mostly self-contained, but they do share some code with each other or with other bootstrap tools. Historically that sharing was achieved using `#[path]` attributes pointing to the shared files. That's unusual, making the code harder to navigate, and making dependencies and warnings harder to manage. It also causes problems for rust-analyzer, which currently struggles with source files outside the crate root. This PR therefore takes two such source files, and moves them into a new `shim_utils` crate, which can then be used as a normal crate-path dependency. That new crate is separate from the existing `build_helper` crate, since that crate contains other code that is not of interest to the shims specifically. Former paths of the files that have been moved: - `src/bootstrap/src/utils/shared_helpers.rs` - `src/build_helper/src/arg_file_command.rs` --- Relevant PRs that created these shared source files: - #127108 - #155439 --- r? Kobzol (or bootstrap)
Bootstrap's
rustcandrustdocshims are mostly self-contained, but they do share some code with each other or with other bootstrap tools.Historically that sharing was achieved using
#[path]attributes pointing to the shared files. That's unusual, making the code harder to navigate, and making dependencies and warnings harder to manage. It also causes problems for rust-analyzer, which currently struggles with source files outside the crate root.This PR therefore takes two such source files, and moves them into a new
shim_utilscrate, which can then be used as a normal crate-path dependency. That new crate is separate from the existingbuild_helpercrate, since that crate contains other code that is not of interest to the shims specifically.Former paths of the files that have been moved:
src/bootstrap/src/utils/shared_helpers.rssrc/build_helper/src/arg_file_command.rsRelevant PRs that created these shared source files:
dylibandbin_helpersand createshared_helpers::parse_value_from_args#127108r? Kobzol (or bootstrap)