about summary refs log tree commit diff
path: root/src/bootstrap/lib.rs
AgeCommit message (Collapse)AuthorLines
2023-01-03Add `build_helper` crate to share code between tidy and bootstrapNilstrieb-1/+2
2022-12-31Revert "Auto merge of #105058 - ↵Joshua Nelson-2/+1
Nilstrieb:no-merge-commits-for-you-only-bors-is-allowed-to-do-that, r=jyn514" This reverts commit 4839886f0abe208ab8f2bb73a3076a59fe2ab60c, reversing changes made to ce85c98575e3016cf2007d90a85be321e592aa96.
2022-12-30Add `build_helper` crate to share code between tidy and bootstrapNilstrieb-1/+2
2022-12-27Auto merge of #106168 - jyn514:clean-crates, r=Mark-Simulacrumbors-4/+0
Allow cleaning individual crates As a bonus, this stops special casing `clean` in `Builder`. ## Motivation Cleaning artifacts isn't strictly necessary to get cargo to rebuild; `touch compiler/rustc_driver/src/lib.rs` (for example) will also work. There's two reasons I thought making this part of bootstrap proper was a better approach: 1. `touch` does not *remove* artifacts, it just causes a rebuild. This is unhelpful for when you want to measure how long the compiler itself takes to build (e.g. for https://github.com/rust-lang/rust/issues/65031). 2. It seems a little more discoverable; and I want to extend it in the future to things like `x clean --stage 1 rustc`, which makes it easier to work around https://github.com/rust-lang/rust/issues/76720 without having to completely wipe all the stage 0 artifacts, or having to be intimately familiar with which directories to remove.
2022-12-26Allow cleaning individual cratesJoshua Nelson-4/+0
As a bonus, this stops special casing `clean` in `Builder`.
2022-12-26Fix panic on `x build --help --verbose`Joshua Nelson-1/+4
This also makes the panic message a little more informative in case it happens again.
2022-12-23Auto merge of #106070 - matthiaskrgr:rollup-jv9ctkl, r=matthiaskrgrbors-1/+1
Rollup of 6 pull requests Successful merges: - #105978 (Mark `proc_macro_decls_static` as always used) - #106051 (Allow building std with cranelift) - #106056 (Make `sess.bug` much less noisy) - #106057 (Give a more helpful error for "trimmed_def_paths constructed") - #106058 (Fix the issue number in comment for as_local_call_operand) - #106059 (Avoid running the `Profile` step twice on `x setup`) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
2022-12-23Rollup merge of #106051 - jyn514:cranelift-std, r=bjorn3Matthias Krüger-1/+1
Allow building std with cranelift - Don't pass llvm-specific args when using cranelift - Don't use `asm` in compiler_builtins when using cranelift r? `@bjorn3` cc `@Mark-Simulacrum`
2022-12-22Support documenting CargoJoshua Nelson-0/+1
The primary motivation is to have the cargo docs show up on https://doc.rust-lang.org/nightly/nightly-rustc/cargo, but as a nice side effect this makes `x doc cargo` work locally.
2022-12-22Allow building std with craneliftJoshua Nelson-1/+1
- Don't pass llvm-specific args when using cranelift - Don't use `asm` in compiler_builtins when using cranelift
2022-12-18Rollup merge of #96584 - bentongxyz:x-setup-h-v-should-work, r=jyn514Matthias Krüger-4/+0
Fix `x setup -h -v` should work r? `@jyn514` I have to convert profile to path and back in order to remove special-casing in bootstrap. I also check for `dry_run` so that `config.toml` and/ or `.git/hooks/pre-push` will not be created if `--dry-run` is specified. Please help me see if this is ok, thanks alot!
2022-12-17Remove special cases for setup subcommandBenjamin Tong-4/+0
- Remove setup special-casing in Flags::parse
2022-12-17Symlink `build/host` -> `build/x86_64-unknown-linux-gnu` (as appropriate per ↵Joshua Nelson-1/+18
target) This allows us to use a consistent path in the documentation, without having to worry about which platform people are using.
2022-12-10Rollup merge of #104512 - jyn514:download-ci-llvm-default, r=Mark-SimulacrumMatthias Krüger-2/+2
Set `download-ci-llvm = "if-available"` by default when `channel = dev` See https://github.com/rust-lang/compiler-team/issues/566. The motivation for changing the default is to avoid downloading and building LLVM when someone runs `x build` before running `x setup`. The motivation for only doing it on `channel = "dev"` is to avoid breaking distros or users installing from source. It works because `dev` is also the default channel. The diff looks larger than it is; most of it is moving the `llvm` branch below the `rust` so `config.channel` is set. r? `@Mark-Simulacrum` cc `@oli-obk` `@bjorn3` `@cuviper`
2022-12-05Rollup merge of #104953 - jyn514:fewer-submodule-updates, r=Mark-SimulacrumMatthias Krüger-3/+3
Ensure required submodules at the same time as updating existing submodules In practice, this would always happen at the same time, but putting them next to each other makes that more obvious and ensures it doesn't change in the future. It also avoids the difference affecting `cargo metadata` somehow. This is based on https://github.com/rust-lang/rust/pull/104952 for convenience to avoid merge conflicts, but doesn't depend on that PR.
2022-12-05Rollup merge of #104952 - jyn514:setup, r=Mark-SimulacrumMatthias Krüger-19/+25
Streamline the user experience for `x.py setup` ## Don't update submodules for x setup Before, the submodule handling was very jank and would update *between two interactive prompts*: ``` ; x setup Building rustbuild Finished dev [unoptimized] target(s) in 0.05s Welcome to the Rust project! What do you want to do with x.py? a) library: Contribute to the standard library Please choose one (a/b/c/d/e): a Updating submodule library/backtrace Submodule 'library/backtrace' (https://github.com/rust-lang/backtrace-rs.git) registered for path 'library/backtrace' error: you asked `x.py` to setup a new config file, but one already exists at `config.toml` Build completed unsuccessfully in 0:00:02 ``` That's not a great user experience because you need to wait a long time between prompts. It would be possible to move the submodule handling either before or after the prompt, but it seems better to just not require submodules to be checked out at all, to minimize the time spend waiting just to create a new configuration. ## Revamp the order setup executes - Create `config.toml` last. It's the most likely to error, and used to stop later steps from executing - Don't print an error message + exit if the git hook already exists; that's expected
2022-12-03Don't exit with an error if there are no changes to submodulesJoshua Nelson-2/+15
2022-11-27suggested changesPratush Rai-1/+0
2022-11-27suggested changesPratush Rai-2/+2
2022-11-26Ensure required submodules at the same time as updating existing submodulesJoshua Nelson-3/+3
In practice, this would always happen at the same time, but putting them next to each other makes that more obvious and ensures it doesn't change in the future. It also avoids the difference avoiding `cargo metadata` somehow.
2022-11-26Don't update submodules for `x setup`Joshua Nelson-19/+25
Before, the submodule handling was very jank and would update *between two interactive prompts*: ``` ; x setup Building rustbuild Finished dev [unoptimized] target(s) in 0.05s Welcome to the Rust project! What do you want to do with x.py? a) library: Contribute to the standard library Please choose one (a/b/c/d/e): a Updating submodule library/backtrace Submodule 'library/backtrace' (https://github.com/rust-lang/backtrace-rs.git) registered for path 'library/backtrace' error: you asked `x.py` to setup a new config file, but one already exists at `config.toml` Build completed unsuccessfully in 0:00:02 ``` That's not a great user experience because you need to wait a long time between prompts. It would be possible to move the submodule handling either before or after the prompt, but it seems better to just not require submodules to be checked out at all, to minimize the time spend waiting just to create a new configuration.
2022-11-25bootstrapPratush Rai-2/+4
2022-11-19Set `download-ci-llvm = "if-available"` by default when `channel = "dev"`Joshua Nelson-2/+2
See https://github.com/rust-lang/compiler-team/issues/566. The motivation for changing the default is to avoid downloading and building LLVM when someone runs `x build` before running `x setup`. The motivation for only doing it on `channel = "dev"` is to avoid breaking distros or users installing from source. It works because `dev` is also the default channel. The diff looks larger than it is; most of it is moving the `llvm` branch below the `rust` so `config.channel` is set.
2022-11-13Make all download functions need only Config, not BuilderJoshua Nelson-67/+34
This also adds a new `mod download` instead of scattering the download code across `config.rs` and `native.rs`.
2022-11-12Print "Checking/Building ..." message even when --dry-run is passedJoshua Nelson-3/+5
This makes it a lot easier to understand what commands will be run without having to parse the `-vv` output, which isn't meant to be user facing.
2022-11-12Distinguish `--dry-run` from the automatic dry run checkJoshua Nelson-23/+23
2022-10-26check lld version to choose correct flag for testsDaniil Belov-2/+2
2022-10-10Auto merge of #94381 - Kobzol:llvm-bolt, r=Mark-Simulacrumbors-0/+1
Use BOLT in CI to optimize LLVM This PR adds an optimization step in the Linux `dist` CI pipeline that uses [BOLT](https://github.com/llvm/llvm-project/tree/main/bolt) to optimize the `libLLVM.so` library built by boostrap. Steps: - [x] Use LLVM 15 as a bootstrap compiler and use it to build BOLT - [x] Compile LLVM with support for relocations (`-DCMAKE_SHARED_LINKER_FLAGS="-Wl,-q"`) - [x] Gather profile data using instrumented LLVM - [x] Apply profile to LLVM that has already been PGOfied - [x] Run with BOLT profiling on more benchmarks - [x] Decide on the order of optimization (PGO -> BOLT?) - [x] Decide how we should get `bolt` (currently we use the host `bolt`) - [x] Clean up The latest perf results can be found [here](https://github.com/rust-lang/rust/pull/94381#issuecomment-1258269440). The current CI build time with BOLT applied is around 1h 55 minutes.
2022-10-09Use BOLT in x64 dist CI to optimize LLVMJakub Beránek-0/+1
2022-10-02Auto merge of #100557 - dawnofmidnight:tarball-commit-info, r=Mark-Simulacrumbors-4/+10
fix: use git-commit-info for version information Fixes #33286. Fixes #86587. This PR changes the current `git-commit-hash` file that `./x.py` dist puts in the `rustc-{version}-src.tar.{x,g}z` to contain the hash, the short hash, and the commit date from which the tarball was created, assuming git was available when it was. It uses this for reading the version so that rustc has all the appropriate metadata. # Testing Testing this is kind of a pain. I did it with something like ```sh ./x.py dist # ensure that `ignore-git` is `false` in config.toml cp ./build/dist/rustc-1.65.0-dev-src.tar.gz ../rustc-1.65.0-dev-src.tar.gz cd .. && tar -xzf rustc-1.65.0-dev-src && cd rustc-1.65.0-dev-src ./x.py build ``` Then, the output of `rustc -vV` with the stage1 compiler should have the `commit-hash` and `commit-date` fields filled, rather than be `unknown`. To be completely sure, you can use `rustc --sysroot` with the stdlib that the original `./x.py dist` made, which will require that the metadata matches.
2022-10-02Rollup merge of #102557 - Joshument:master, r=jyn514Matthias Krüger-2/+3
fix issue with x.py setup running into explicit panic Fixes problem with [Issue #102555](https://github.com/rust-lang/rust/issues/102555) causing `x.py` setup to fail. Simply requires `rustfmt` be downloaded a little later.
2022-10-02Rollup merge of #102353 - bjorn3:allow_rustix_use_libc, r=Mark-SimulacrumMatthias Krüger-0/+2
Allow passing rustix_use_libc cfg using RUSTFLAGS Before this would error with ``` error: unexpected `rustix_use_libc` as condition name | = note: `-D unexpected-cfgs` implied by `-D warnings` = help: was set with `--cfg` but isn't in the `--check-cfg` expected names ``` I'm setting rustix_use_libc when testing bootstrapping rustc with cg_clif as I'm disabling inline asm here.
2022-10-01fix issue with x.py setup running into explicit panicJoshument-2/+3
2022-10-01fix: use git-commit-info for version informationdawnofmidnight-4/+10
This PR adds support for fetching version information from the `git-commit-info` file when building the compiler from a source tarball.
2022-10-01Auto merge of #101969 - reez12g:issue-101306, r=reez12gbors-0/+2
Make fmt downloaded on every invocation of bootstrap Fixes https://github.com/rust-lang/rust/issues/101306
2022-10-01Add a comment to downloading fmt statementRento Ezoe-0/+1
Co-authored-by: Joshua Nelson <github@jyn.dev>
2022-09-27Allow passing rustix_use_libc cfg using RUSTFLAGSbjorn3-0/+2
Before this would error with ``` error: unexpected `rustix_use_libc` as condition name | = note: `-D unexpected-cfgs` implied by `-D warnings` = help: was set with `--cfg` but isn't in the `--check-cfg` expected names ``` I'm setting rustix_use_libc when testing bootstrapping rustc with cg_clif as I'm disabling inline asm here.
2022-09-26fix check_cfgPietro Albini-0/+1
2022-09-26Make fmt downloaded on every invocation of bootstrapreez12g-0/+1
2022-09-24Auto merge of #98483 - dvtkrlbs:bootstrap-dist, r=jyn514bors-13/+12
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-22Auto merge of #102028 - oli-obk:miri_subtree, r=oli-obkbors-7/+2
Make miri a subtree instead of a submodule r? `@RalfJung` fixes #101867 fixes https://github.com/rust-lang/rust/issues/100134
2022-09-21Remove miri from the submodule list and require it for CI to passOli Scherer-7/+2
2022-09-21Rollup merge of #89891 - ojeda:modular-alloc, r=Mark-SimulacrumDylan DPC-0/+2
`alloc`: add unstable cfg features `no_rc` and `no_sync` In Rust for Linux we are using these to make `alloc` a bit more modular. See https://github.com/rust-lang/rust/pull/86048 and https://github.com/rust-lang/rust/pull/84266 for similar requests. Of course, the particular names are not important.
2022-09-19Auto merge of #101799 - LukeMathWalker:distribute-json-doc, r=jyn514bors-0/+5
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-17Add a new component, `rust-json-docs`, to distribute the JSON-formatted ↵Luca Palmieri-0/+5
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-16Remove the allow-list for dynamic linking of LLVM toolsChris Wailes-4/+0
This commit removes an allow-list for the dynamic linking of the LLVM tools and instead relies on the builder's linking preference only.
2022-09-14Give a better error messages when the rustc shim is missingJoshua Nelson-1/+4
2022-09-14Fix pre-existing bug in exe checkJoshua Nelson-1/+1
2022-09-14Don't hardcode the path to `bootstrap_out`Joshua Nelson-13/+9
The `rust-dev` dist component puts binaries in `bootstrap/bin`, but we expected them to be in `bootstrap/debug` to match cargo's behavior. Rather than making the dist component inconsistent with other components, make bootstrap slightly smarter and allow using any path as long as all the binaries are in the same directory. As a bonus, this greatly simplifies the logic, and makes it possible for the shell scripts to start avoiding python. Co-authored-by: Joshua Nelson <github@jyn.dev>
2022-09-02Rollup merge of #100200 - petrochenkov:zgccld2, r=lqd,Mark-SimulacrumMatthias Krüger-0/+3
Change implementation of `-Z gcc-ld` and `lld-wrapper` again This PR partially reverts https://github.com/rust-lang/rust/pull/97375 and uses the strategy described in https://github.com/rust-lang/rust/issues/97402#issuecomment-1147404520 instead, thus fixes https://github.com/rust-lang/rust/issues/97755.