about summary refs log tree commit diff
path: root/src/bootstrap/builder.rs
AgeCommit message (Collapse)AuthorLines
2022-11-09Rollup merge of #104046 - RalfJung:run-miri-run, r=oli-obkMichael Goulet-1/+2
bootstrap: add support for running Miri on a file This enables: ``` ./x.py run src/tools/miri --stage 0 --args src/tools/miri/tests/pass/hello.rs ``` That can be super helpful for debugging. Also avoid sharing the Miri sysroot dir with a system-wide (rustup-managed) installation of Miri. Fixes https://github.com/rust-lang/rust/issues/76666
2022-11-06bootstrap: add support for running Miri on a fileRalf Jung-1/+2
2022-11-03move browser opening logic in BuilderPietro Albini-0/+18
This allows open() to be called from other places in bootstrap (I need this for Ferrocene), and it simplifies the callers by moving the "was_invoked_explicitly" check into the function.
2022-10-31Detect unused files in `src/test/mir-opt` and error on them in tidy.Jakob Degen-0/+1
2022-10-31Auto merge of #102950 - oli-obk:check_miri, r=RalfJungbors-0/+1
Enable `x.py check` for miri Now that the miri subtree is working properly, let's add it to x.py check. cc `@rust-lang/miri`
2022-10-26Add cargo miri to x.py checkOli Scherer-0/+1
2022-10-12Rollup merge of #102239 - joshtriplett:style-guide, r=calebcartwrightDylan DPC-0/+1
Move style guide to rust-lang/rust Per [RFC 3309](https://rust-lang.github.io/rfcs/3309-style-team.html).
2022-09-26Rollup merge of #102178 - RalfJung:bootstrap-backtrace, r=Mark-Simulacrumfee1-dead-3/+2
bootstrap: the backtrace feature is stable, no need to allow it any more
2022-09-24Auto merge of #98483 - dvtkrlbs:bootstrap-dist, r=jyn514bors-0/+1
Distribute bootstrap in CI This pre-compiles bootstrap from source and adds it to the existing `rust-dev` component. There are two main goals here: 1. Make it faster to build rust from source, both the first time and incrementally 2. Make it easier to add non-python entrypoints, since they can call out to bootstrap directly rather than having to figure out the right flags to pre-compile it. This second part is still in a bit of flux, see the tracking issue below for more information. There are also several changes to make bootstrap able to run on a machine other than the one it was built (particularly around `config.src` and `config.out` detection). I (`@jyn514)` am slightly concerned these will regress unless tested - maybe we should add an automated test that runs bootstrap in a chroot or something? Unclear whether the effort is worth the test coverage. Helps with https://github.com/rust-lang/rust/issues/94829.
2022-09-24Move style guide to rust-lang/rustJosh Triplett-0/+1
Per [RFC 3309](https://rust-lang.github.io/rfcs/3309-style-team.html).
2022-09-23bootstrap: the backtrace feature is stable, no need to allow it any moreRalf Jung-3/+2
2022-09-19Auto merge of #101799 - LukeMathWalker:distribute-json-doc, r=jyn514bors-0/+1
Distribute json doc # Overview We add a new component, `rust-json-docs`, to distribute the JSON version of rustdoc's output for public compiler crates (i.e. `std`, `alloc`, `proc_macro`, `core` and `test`). As discussed in #101383, we do not bundle this up as part of the existing `rust-docs` component since `rustdoc`'s JSON format is still unstable. # Open questions / Doubts I tried my best, but I never touched this codebase and I couldn't find much documentation on how `dist` works - I pattern-matched existing code, which might have led to some non-sensical choices in the eyes of people more familiar with the codebase. In particular, I am not sure if my choice of adding a new config flag is appropriate or if the decision to build/not build the JSON docs is more appropriately gated by one of the existing flags. Any suggestion is more than welcome. Closes #101383
2022-09-17Auto merge of #101949 - matthiaskrgr:rollup-xu5cqnd, r=matthiaskrgrbors-0/+3
Rollup of 7 pull requests Successful merges: - #101093 (Initial version of 1.64 release notes) - #101713 (change AccessLevels representation) - #101821 (Bump Unicode to version 15.0.0, regenerate tables) - #101826 (Enforce "joined()" and "joined_with_noop()" test) - #101835 (Allow using vendoring when running bootstrap from outside the source root) - #101942 (Revert "Copy stage0 binaries into stage0-sysroot") - #101943 (rustdoc: remove unused CSS `.non-exhaustive { margin-bottom }`) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
2022-09-17Add a new component, `rust-json-docs`, to distribute the JSON-formatted ↵Luca Palmieri-0/+1
documentation for std crates in nightly toolchains. We also add a new flag to `x doc`, `--json`, to render the JSON-formatted version alongside the HTML-formatted one.
2022-09-16Improve handing of env vars during bootstrap processChris Wailes-6/+7
This CL modifies the handing of env vars during the bootstrap process in two ways: 1. Replaces '-' characters with '_' characters in target names to increase compatibility with different shells 2. Passes Stage0 snapshot compiler related env vars to early invocations of Cargo
2022-09-14Allow using vendoring when running bootstrap from outside the current ↵Joshua Nelson-0/+3
working directory
2022-09-14Distribute bootstrap in CI artifactsTuna-0/+1
- Add a new `bootstrap` component Originally, we planned to combine this with the `rust-dev` component. However, I realized that would force LLVM to be redownloaded whenever bootstrap is modified. LLVM is a much larger download, so split this to get better caching. - Build bootstrap for all tier 1 and 2 targets
2022-08-31Fix a bunch of typoDezhi Wu-2/+2
This PR will fix some typos detected by [typos]. I only picked the ones I was sure were spelling errors to fix, mostly in the comments. [typos]: https://github.com/crate-ci/typos
2022-08-27Sunset RLSEric Huss-2/+0
2022-08-27Add replace-version-placeholder toolest31-1/+7
This tool is to be ran at specific points in the release process to replace the version place holder made by stabilizations with the version number.
2022-08-26Auto merge of #98051 - davidtwco:split-dwarf-stabilization, r=wesleywiserbors-16/+14
session: stabilize split debuginfo on linux Stabilize the `-Csplit-debuginfo` flag... - ...on Linux for all values of the flag. Split DWARF has been implemented for a few months, hasn't had any bug reports and has had some promising benchmarking for incremental debug build performance. - ..on other platforms for the default value. It doesn't make any sense that `-Csplit-debuginfo=packed` is unstable on Windows MSVC when that's the default behaviour, but keep the other values unstable.
2022-08-18session: stabilize split debuginfo on linuxDavid Wood-16/+14
Stabilize the `-Csplit-debuginfo` flag... - ...on Linux for all values of the flag. Split DWARF has been implemented for a few months, hasn't had any bug reports and has had some promising benchmarking for incremental debug build performance. - ..on other platforms for the default value. It doesn't make any sense that `-Csplit-debuginfo=packed` is unstable on Windows MSVC when that's the default behaviour, but keep the other values unstable. Signed-off-by: David Wood <david.wood@huawei.com>
2022-08-16bootstrap: don't apply `-Ztls-model=initial-exec` to proc macrosAlex Macleod-1/+1
2022-07-27Ship `rust-analyzer-proc-macro-srv` binary with dist::RustcAmos Wenger-0/+1
This builds `src/tools/rust-analyzer/crates/proc-macro-srv-cli` and ships it as part of Rustc's dist component. This allows rust-analyzer's proc macro support to work on all rustc versions (stable, beta and nightly) starting now.
2022-07-24Add test step for rust-analyzer, run it by defaultAmos Wenger-0/+1
2022-07-24Add check step, stuck on 'no output generated for libgoto_def-hash rmeta'Amos Wenger-0/+1
2022-07-24Convert rust-analyzer to 'in-tree' tool, pass 'in-rust-tree' feature by defaultAmos Wenger-1/+1
2022-07-20Auto merge of #98843 - Urgau:check-cfg-stage0, r=Mark-Simulacrumbors-38/+32
Enable check-cfg in stage0 Now that the bootstrap cargo supports `rustc-check-cfg` we can now enable it with `-Zcheck-cfg=output` and use it in `rustc_llvm` to unblock `--check-cfg` support in stage0. r? `@Mark-Simulacrum`
2022-07-14solaris: unbreak build on native platformPetr Sumbera-0/+1
Fixes: #99208
2022-07-13Rollup merge of #98848 - flip1995:clippy-book, r=jyn514Guillaume Gomez-0/+1
Build the Clippy book as part of x.py doc r? ``@ehuss`` since you said you would be interested in helping moving this forward. cc ``@jyn514`` as part of the bootstrap team.
2022-07-08Rollup merge of #98798 - jyn514:download-rustc-cached, r=Mark-SimulacrumMatthias Krüger-0/+1
Fix caching bug in `download-rustc = true` When moving this to rustbuild, I introduced a bug: if you had the file already downloaded, but deleted the sysroot for whatever reason, rustbuil would fail to unpack the cached tarball. This only affects people if they have a cached tarball, which is probably why we haven't seen an issue yet - wiping `build/cache` would work around the issue, or just not deleting `build/$TARGET/stage2`. Fixes the following error: ``` thread 'main' panicked at 'fs::read_dir(&lib_dir) failed with No such file or directory (os error 2) ("/home/jnelson/rust-lang/rust2/build/x86_64-unknown-linux-gnu/ci-rustc/lib")', config.rs:1563:20 ``` r? ``@Mark-Simulacrum``
2022-07-07Rollup merge of #98994 - kons-9:dont_use_process_exit, r=jyn514Matthias Krüger-7/+3
replace process exit with more detailed exit in src/bootstrap/*.rs Fixes [#98830](https://github.com/rust-lang/rust/issues/98830) I implemeted "detail_exit.rs" in lib.rs, and replace all of std::process::exit. So, error code should panic in test code. ``` // lib.rs pub fn detail_exit(code: i32) -> ! { // Successful exit if code == 0 { std::process::exit(0); } if cfg!(test) { panic!("status code: {}", code); } else { std::panic::resume_unwind(Box::new(code)); } } ``` <details> <summary>% rg "exit\(" src/bootstrap/*.rs</summary> ``` builder.rs 351: crate::detail_exit(1); 1000: crate::detail_exit(1); 1429: crate::detail_exit(1); compile.rs 1331: crate::detail_exit(1); config.rs 818: crate::detail_exit(2); 1488: crate::detail_exit(1); flags.rs 263: crate::detail_exit(exit_code); 349: crate::detail_exit(exit_code); 381: crate::detail_exit(1); 602: crate::detail_exit(1); 616: crate::detail_exit(1); 807: crate::detail_exit(1); format.rs 35: crate::detail_exit(1); 117: crate::detail_exit(1); lib.rs 714: detail_exit(1); 1620: detail_exit(1); 1651:pub fn detail_exit(code: i32) -> ! { 1654: std::process::exit(0); sanity.rs 107: crate::detail_exit(1); setup.rs 97: crate::detail_exit(1); 290: crate::detail_exit(1); test.rs 676: crate::detail_exit(1); 1024: crate::detail_exit(1); 1254: crate::detail_exit(1); tool.rs 207: crate::detail_exit(1); toolstate.rs 96: crate::detail_exit(3); 111: crate::detail_exit(1); 182: crate::detail_exit(1); 228: crate::detail_exit(1); util.rs 339: crate::detail_exit(1); 378: crate::detail_exit(1); 468: crate::detail_exit(1); ``` </details>
2022-07-07squash the commitstoshiki goto-7/+3
implement detail_exit but I'm not sure it is right. not create new file and write detail exit in lib.rs replace std::process::exit to detail_exit that is not related to code runnning. remove pub
2022-07-06Build the Clippy book as part of x.py docflip1995-0/+1
2022-07-05Rollup merge of #95503 - jyn514:build-single-crate, r=Mark-SimulacrumGuillaume Gomez-6/+13
bootstrap: Allow building individual crates This aims to be as unintrusive as possible, but did still require adding a new `tail_args` field to all `Rustc` and `Std` steps. New library and compiler crates are added to the sysroot as they are built, since it's useful to have e.g. just alloc and not std. Fixes https://github.com/rust-lang/rust/issues/44293.
2022-07-03Add miri to the rustc docs.rs pageInfRandomness-0/+1
This adds miri to https://doc.rust-lang.org/nightly/nightly-rustc/ Signed-off-by: InfRandomness <infrandomness@gmail.com>
2022-07-03Enable check-cfg in stage0Urgau-38/+32
2022-07-02Allow building single crates for the compiler and standard libraryJoshua Nelson-3/+12
- Add `Interned<Vec<String>>` and use it for tail args - Refactor `cache.rs` not to need a separate impl for each internable type
2022-07-01Fix caching bug in `download-rustc = true`Joshua Nelson-0/+1
When moving this to rustbuild, I introduced a bug: if you had the file already downloaded, but deleted the sysroot for whatever reason, rustbuil would fail to unpack the cached tarball. This only affects people if they have a cached tarball, which is probably why we haven't seen an issue yet - wiping `build/cache` would work around the issue, or just not deleting `build/$TARGET/stage2`.
2022-07-01bootstrap: illumos platform flags for split-debuginfoAndy Fiddaman-1/+2
Bootstrap currently provides `-Zunstable-options` for platforms when using split debuginfo - this commit adds it for the illumos target too.
2022-06-26Only call default steps once, not once for each PathSetJoshua Nelson-3/+1
Running steps multiple times defeats the whole point of #96501, since lint messages will be duplicated.
2022-06-18Auto merge of #96501 - jyn514:individual-paths, r=Mark-Simulacrumbors-50/+124
Pass all paths to `Step::run` at once when using `ShouldRun::krate` Helps with https://github.com/rust-lang/rust/pull/95503. The goal is to run `cargo test -p rustc_data_structures -p rustc_lint_defs` instead of `cargo test -p rustc_data_structures; cargo test -p rustc_lint_defs`, which should both recompile less and avoid replaying cached warnings. This was surprisingly complicated. The main changes are: 1. Invert the order of iteration in `StepDescription::run`. Previously, it did something like: ```python for path in paths: for (step, should_run) in should_runs: if let Some(set) = should_run.pathset_for_path(path): step.run(builder, set) ``` That worked ok for individual paths, but didn't allow passing more than one path at a time to `Step::run` (since `pathset_for_paths` only had one path available to it). Change it to instead look at the intersection of `paths` and `should_run.paths`: ```python for (step, should_run) in should_runs: if let Some(set) = should_run.pathset_for_paths(paths): step.run(builder, set) ``` 2. Change `pathset_for_path` to take multiple pathsets. The goal is to avoid `x test library/alloc` testing *all* library crates, instead of just alloc. The changes here are similarly subtle, to use the intersection between the paths rather than all paths in `should_run.paths`. I added a test for the behavior to try and make it more clear. Note that we use pathsets instead of just paths to allow for sets with multiple aliases (*cough* `all_krates` *cough*). See the documentation added in the next commit for more detail. 3. Change `StepDescription::run` to explicitly handle 0 paths. Before this was implicitly handled by the `for` loop, which just didn't excute when there were no paths. Now it needs a check, to avoid trying to run all steps (this is a problem for steps that use `default_condition`). 4. Change `RunDescription` to have a list of pathsets, rather than a single path. 5. Remove paths as they're matched This allows checking at the end that no invalid paths are left over. Note that if two steps matched the same path, this will no longer run both; but that's a bug anyway. 6. Handle suite paths separately from regular sets. Running multiple suite paths at once instead of in separate `make_run` invocations is both tricky and not particularly useful. The respective test Steps already handle this by introspecting the original paths. Avoid having to deal with it by moving suite handling into a seperate loop than `PathSet::Set` checks. `@rustbot` label +A-rustbuild
2022-06-18Add tests for fixed bugsJoshua Nelson-0/+4
2022-06-18Pass all paths to `Step::run` at once when using `ShouldRun::krate`Joshua Nelson-50/+120
This was surprisingly complicated. The main changes are: 1. Invert the order of iteration in `StepDescription::run`. Previously, it did something like: ```python for path in paths: for (step, should_run) in should_runs: if let Some(set) = should_run.pathset_for_path(path): step.run(builder, set) ``` That worked ok for individual paths, but didn't allow passing more than one path at a time to `Step::run` (since `pathset_for_paths` only had one path available to it). Change it to instead look at the intersection of `paths` and `should_run.paths`: ```python for (step, should_run) in should_runs: if let Some(set) = should_run.pathset_for_paths(paths): step.run(builder, set) ``` 2. Change `pathset_for_path` to take multiple pathsets. The goal is to avoid `x test library/alloc` testing *all* library crates, instead of just alloc. The changes here are similarly subtle, to use the intersection between the paths rather than all paths in `should_run.paths`. I added a test for the behavior to try and make it more clear. Note that we use pathsets instead of just paths to allow for sets with multiple aliases (*cough* `all_krates` *cough*). See the documentation added in the next commit for more detail. 3. Change `StepDescription::run` to explicitly handle 0 paths. Before this was implicitly handled by the `for` loop, which just didn't excute when there were no paths. Now it needs a check, to avoid trying to run all steps (this is a problem for steps that use `default_condition`). 4. Change `RunDescription` to have a list of pathsets, rather than a single path. 5. Remove paths as they're matched This allows checking at the end that no invalid paths are left over. Note that if two steps matched the same path, this will no longer run both; but that's a bug anyway. 6. Handle suite paths separately from regular sets. Running multiple suite paths at once instead of in separate `make_run` invocations is both tricky and not particularly useful. The respective test Steps already handle this by introspecting the original paths. Avoid having to deal with it by moving suite handling into a seperate loop than `PathSet::Set` checks.
2022-06-09future-proof adding more protocolsPietro Albini-2/+11
2022-06-09load configuration for downloading artifacts from stage0.jsonPietro Albini-8/+2
2022-06-07Add checksum verification for rustfmt downloadsJoshua Nelson-1/+22
2022-06-07Move beta rustfmt downloads to rustbuildJoshua Nelson-1/+6
2022-06-05Auto merge of #93717 - pietroalbini:pa-ci-profiler, r=Mark-Simulacrumbors-0/+6
Add build metrics to rustbuild This PR adds a new module of rustbuild, `ci_profiler`, whose job is to gather as much information as possible about the CI build as possible and store it in a JSON file uploaded to `ci-artifacts`. Right now for each step it collects: * Type name and debug representation of the `Step` object. * Duration of the step (excluding child steps). * Systemwide CPU stats for the duration of the step (both single core and all cores). * Which child steps were executed. This is capable of replacing both the scripts to collect CPU stats and the `[TIMING]` lines in build logs (not yet removed, until we port our tooling to use the CI profiler). The format is also extensible to be able in the future to collect more information. r? `@Mark-Simulacrum`
2022-06-04Auto merge of #97529 - Urgau:bootstrap-check-cfg-features, r=Mark-Simulacrumbors-20/+17
Use new cargo argument in bootstrap for cfg checking This PR use new cargo argument in bootstrap for doing cfg checking. Follow-up to https://github.com/rust-lang/rust/pull/97044 and https://github.com/rust-lang/rust/pull/97214. r? `@Mark-Simulacrum`