about summary refs log tree commit diff
path: root/src/bootstrap
AgeCommit message (Collapse)AuthorLines
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-18Revert "Use ICF (identical code folding) for building rustc"Jakub Beránek-6/+0
2022-07-17Use LLD linker for compiling rustc on Linux x64 and use ICF for binary size ↵Jakub Beránek-0/+6
optimization
2022-07-14Don't build std for switchleo60228-1/+1
2022-07-14Don't use host linker for switchleo60228-1/+2
2022-07-14Rollup merge of #99236 - psumbera:Issue99208, r=Mark-SimulacrumDylan DPC-0/+1
solaris: unbreak build on native platform Fixes: #99208
2022-07-14solaris: unbreak build on native platformPetr Sumbera-0/+1
Fixes: #99208
2022-07-14Rollup merge of #99139 - jyn514:dist-tool-help, r=Mark-SimulacrumDylan DPC-1/+5
Give a better error when `x dist` fails for an optional tool Before: ``` thread 'main' panicked at 'Unable to build RLS', dist.rs:42:9 ``` After: ``` thread 'main' panicked at 'Unable to build submodule tool RLS (use `missing-tools = true` to ignore this failure) note: not all tools are available on all nightlies help: see https://forge.rust-lang.org/infra/toolstate.html for more information', dist.rs:43:9 ``` Closes https://github.com/rust-lang/rust/issues/85683 by explaining better why the error is expected.
2022-07-13Rollup merge of #98848 - flip1995:clippy-book, r=jyn514Guillaume Gomez-0/+2
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-13Auto merge of #99149 - ferrocene:pa-nightly-branch, r=Mark-Simulacrumbors-8/+6
Configure nightly branch name in `stage0.json` The beta version number detection code relies on git to know how many merge commits were made since we branched off, and in doing so hardcodes `master` as the default branch name. This works for rust-lang/rust, but is problematic for forks that use a different default branch name (in Ferrocene we use `main` instead). This PR changes the code to instead load the default branch name from `src/stage0.json`. `bump-stage0` has also been updated to remove the need to update it every time a new field is added to `stage0.json`.
2022-07-12Auto merge of #99165 - matthiaskrgr:rollup-rqpelfa, r=matthiaskrgrbors-3/+32
Rollup of 8 pull requests Successful merges: - #97210 (Support `-A`, `-W`, `-D` and `-F` when running `./x.py clippy`) - #99055 (Fix rustdoc help options) - #99075 (Fix duplicated type annotation suggestion) - #99124 (Fix sized check ICE in asm check) - #99142 (fix(doctest): treat fatal parse errors as incomplete attributes) - #99145 (Don't rerun the build script for the compiler each time on non-windows platforms) - #99146 (Do not error during method probe on `Sized` predicates for types that aren't the method receiver) - #99161 (compiletest: trim edition before passing as flag) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
2022-07-11Rollup merge of #97210 - Milo123459:clippy-args, r=jyn514Matthias Krüger-3/+32
Support `-A`, `-W`, `-D` and `-F` when running `./x.py clippy` Resolves #97059 This PR adds support for `-A`, `-W`, `-D` and `-F` when running `./x.py clippy`.
2022-07-11Auto merge of #96978 - lqd:win_pgo2, r=Mark-Simulacrumbors-3/+72
Utilize PGO for windows x64 rustc dist builds This PR adds PGO support for the CI x64 windows dist builds. These are the results from running the rustc-perf benchmarks: ![image](https://user-images.githubusercontent.com/247183/177662869-683a8034-7c95-42bf-9900-9ffd66677fcf.png) Thanks to `@Kobzol,` `@michaelwoerister,` `@wesleywiser,` `@Mark-Simulacrum` for their precious help.
2022-07-11extend bootstrap for PGO on windowsRémy Rakic-3/+72
When building LLVM/LLD as part of a build that asks LLVM to generate profiles, e.g. when doing PGO, cmake or clang-cl don't automatically link clang's profiler runtime in, causing undefined reference errors at link-time. We do that manually, by adding clang's resource library folder to the library search path: - for LLVM itself, by extending the linker args that `rustc_llvm`'s build script uses, to avoid the linker errors when linking `rustc_driver`. - for LLD, by extending cmake's linker flags during the LLD build step.
2022-07-11 configure nightly branch name in stage0.jsonPietro Albini-8/+6
2022-07-11clippy argument supportMilo-3/+32
2022-07-11Auto merge of #98369 - jyn514:configure.py, r=Mark-Simulacrumbors-5/+3
Remove unsupported options in configure.py I've seen people using `optimize = false` and `full-bootstrap = true` in the past, without knowing that they're not recommended. Remove `optimize` and a few other options that are always a bad idea, and document that full-bootstrap is only for testing reproducible builds.
2022-07-11Auto merge of #99130 - jyn514:std-cache-invalidation, r=Mark-Simulacrumbors-22/+38
Fix `x build library/std compiler/rustc` Previously, this was broken because of improper caching: 1. `StepDescription::maybe_run` builds `Compile::Std`, which only built `std` and not `proc_macro` 1. `Std` calls `builder.ensure(StdLink)` 1. `Rustc` calls `ensure(Std)`, which builds all crates, including `proc_macro` 1. `Rustc` calls `ensure(StdLink)`. `ensure` would see that it had already been run and do nothing. <-- bug is here 1. Cargo gives an error that `proc_macro` doesn't exist. This fixes the caching by adding `crates` to `StdLink`, so it will get rerun if the crates that are built change. Fixes https://github.com/rust-lang/rust/issues/99129.
2022-07-10Give a better error when `x dist` fails for an optional toolJoshua Nelson-1/+5
Before: ``` thread 'main' panicked at 'Unable to build RLS', dist.rs:42:9 ``` After: ``` thread 'main' panicked at 'Unable to build submodule tool RLS (use `missing-tools = true` to ignore this failure) note: not all tools are available on all nightlies help: see https://forge.rust-lang.org/infra/toolstate.html for more information', dist.rs:43:9 ```
2022-07-11Auto merge of #98526 - jyn514:download-llvm-outside-checkout, r=Mark-Simulacrumbors-29/+34
Allow using `download-ci-llvm = true` outside the git checkout `@bjorn3` noticed that this is already allowed today when download-llvm is disabled, but breaks with it enabled: ``` $ ./rust2/x.py build fatal: not a git repository (or any of the parent directories): .git thread 'main' panicked at 'command did not execute successfully: "git" "rev-list" "--author=bors@rust-lang.org" "-n1" "--first-parent" "HEAD" "--" "/home/jnelson/rust-lang/rust2/src/llvm-project" "/home/jnelson/rust-lang/rust2/src/bootstrap/download-ci-llvm-stamp" "/home/jnelson/rust-lang/rust2/src/version" expected success, got: exit status: 128', src/bootstrap/native.rs:134:20 note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace ``` Support it too for consistency. It's unclear to me when anyone would need to use this, but `@bjorn3` feels we should support it, and it's not much additional effort to get it working.
2022-07-10Fix `x build library/std compiler/rustc`Joshua Nelson-22/+38
Previously, this was broken because of improper caching: 1. `StepDescription::maybe_run` builds `Compile::Std`, which only built `std` and not `proc_macro` 1. `Std` calls `builder.ensure(StdLink)` 1. `Rustc` calls `ensure(Std)`, which builds all crates, including `proc_macro` 1. `Rustc` calls `ensure(StdLink)`. `ensure` would see that it had already been run and do nothing. <-- bug is here 1. Cargo gives an error that `proc_macro` doesn't exist. This fixes the caching by adding `crates` to `StdLink`, so it will get rerun if the crates that are built change. This also does the same for `RustcLink`; it doesn't matter in practice currently because nothing uses it except `impl Step for Rustc`, but it will avoid bugs if we start using it in the future (e.g. to build individual crates for rustfmt).
2022-07-11Fix `download-ci-llvm` NixOS patching for binariesoxalica-2/+2
LLVM tools should also be patched, since they are used in some tests, specially, - src/test/run-make-fulldeps/cross-lang-lto (llvm-ar) - src/test/run-make-fulldeps/cross-lang-lto-upstream-rlibs (llvm-ar) - src/test/run-make-fulldeps/issue-64153 (llvm-objdump) To be more future proof, we should patch all binaries in `bin`.
2022-07-10Allow using `download-ci-llvm = true` outside the git checkoutJoshua Nelson-29/+34
@bjorn3 noticed that this is already allowed today when download-llvm is disabled, but breaks with it enabled: ``` $ ./rust2/x.py build fatal: not a git repository (or any of the parent directories): .git thread 'main' panicked at 'command did not execute successfully: "git" "rev-list" "--author=bors@rust-lang.org" "-n1" "--first-parent" "HEAD" "--" "/home/jnelson/rust-lang/rust2/src/llvm-project" "/home/jnelson/rust-lang/rust2/src/bootstrap/download-ci-llvm-stamp" "/home/jnelson/rust-lang/rust2/src/version" expected success, got: exit status: 128', src/bootstrap/native.rs:134:20 note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace ``` Support it too for consistency. It's unclear to me when anyone would need to use this, but @bjorn3 feels we should support it, and it's not much additional effort to get it working. This also updates a bunch of other git commands that were similarly depending on the current directory.
2022-07-10Remove unsupported options in configure.pyJoshua Nelson-5/+3
I've seen people using `optimize = false` and `full-bootstrap = true` in the past, without knowing that they're not recommended. Remove `optimize` and a few other options that are always a bad idea, and document that full-bootstrap is only for testing reproducible builds.
2022-07-09Update submodule rust-installerMichael Howell-1/+1
This includes the following pull requests: * https://github.com/rust-lang/rust-installer/pull/114 * https://github.com/rust-lang/rust-installer/pull/113
2022-07-09Auto merge of #98328 - topjohnwu:fix_cross, r=jyn514bors-1/+22
Fix several issues during cross compiling - When cross compiling LLVM on an arm64 macOS machine to x86_64, CMake will produce universal binaries by default, causing link errors. Explicitly set `CMAKE_OSX_ARCHITECTURES` to the one single target architecture so that the executables and libraries will be single architecture. - When cross compiling rustc with `llvm.clang = true`, `CLANG_TABLEGEN` has to be set to the host `clang-tblgen` executable to build clang.
2022-07-08Rollup merge of #98798 - jyn514:download-rustc-cached, r=Mark-SimulacrumMatthias Krüger-1/+3
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-41/+48
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-41/+48
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/+2
2022-07-05Rollup merge of #98880 - topjohnwu:macos-dylib-cross, r=jyn514Guillaume Gomez-8/+6
Proper macOS libLLVM symlink when cross compiling Follow up of #98418 When cross compiling on macOS with `llvm.link-shared` enabled, the symlink creation will fail after compiling LLVM for the target architecture, because it will attempt to create the symlink in the host LLVM directory, which was already created when being built. This commit changes the symlink path to the actual LLVM output. r? `@jyn514`
2022-07-05Rollup merge of #95503 - jyn514:build-single-crate, r=Mark-SimulacrumGuillaume Gomez-182/+226
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-05Rollup merge of #98895 - ChrisDenton:no-elves-allowed, r=jyn514Matthias Krüger-0/+4
bootstrap.py: Always use `.exe` for Windows This ensures that it will run the Windows executable if other files in the directory (such as Linux executables) have the same file name minus the extension. I've been tripped up by this a few times where both `bootstrap` and `bootstrap.exe` end up in the same directory. This PR avoids ever having to see the following message: `OSError: [WinError 193] %1 is not a valid Win32 application`
2022-07-05Fix typo in src/bootstrap/bootstrap.pyChris Denton-1/+1
Co-authored-by: Marco Colombo <mar.colombo13@gmail.com>
2022-07-04bootstrap.py: Always use `.exe` for WindowsChris Denton-0/+4
This ensure that it will run the Windows executable if other files in the directory (such as Linux executables) have the same file name minus the extension.
2022-07-04Auto merge of #98817 - the8472:dont-optimize-ui-tests, r=Mark-Simulacrumbors-6/+3
Only obey optimize-tests flag on UI tests that are run-pass stage1 UI tests walltime on my machine: ``` optimize-tests = false, master 25.98s optimize-tests = true, master 34.69s optimize-tests = true, patched 28.79s ``` Effects: - faster UI tests - llvm asserts get exercised less on build-pass tests - the difference between opt and nopt builds shrinks a bit - aux libs don't get optimized since they don't have a pass mode and almost never have explicit compile flags
2022-07-04Proper macOS libLLVM symlink when cross compilingtopjohnwu-8/+6
When cross compiling on macOS with `llvm.link-shared` enabled, the symlink creation will fail after compiling LLVM for the target architecture, because it will attempt to create the symlink in the host LLVM directory, which was already created when being built. This commit changes the symlink path to the actual LLVM output.
2022-07-03Set CLANG_TABLEGEN when cross compiling clangtopjohnwu-0/+9
When cross compiling rustc with `llvm.clang = true`, CLANG_TABLEGEN has to be set to the host clang-tblgen executable to build clang.
2022-07-03Fix cross compiling on macOStopjohnwu-1/+13
When cross compiling LLVM on an arm64 machine to x86_64, CMake will produce universal binaries by default, causing link errors. Explicitly set CMAKE_OSX_ARCHITECTURES to the one single target architecture.
2022-07-04Auto merge of #98731 - InfRandomness:fix-#98728, r=Mark-Simulacrumbors-3/+1
Revert #95993 fix This reverts the temporary fix implemented by https://github.com/rust-lang/rust/pull/95993 since a permanent fix has been implemented by https://github.com/rust-lang/cargo/pull/10594 Fixes https://github.com/rust-lang/rust/issues/98728
2022-07-03ignore rustdoc failures for out-of-tree toolsRalf Jung-1/+11
2022-07-03Add in_tree macro literalInfRandomness-5/+18
Signed-off-by: InfRandomness <infrandomness@gmail.com>
2022-07-03Add miri to the rustc docs.rs pageInfRandomness-0/+2
This adds miri to https://doc.rust-lang.org/nightly/nightly-rustc/ Signed-off-by: InfRandomness <infrandomness@gmail.com>
2022-07-03Auto merge of #98373 - joshtriplett:bootstrap-locking, r=jyn514bors-45/+123
Move locking from bootstrap.py to rust bootstrap, using fd-lock Helps with https://github.com/rust-lang/rust/issues/94829.
2022-07-03Enable check-cfg in stage0Urgau-38/+32
2022-07-02Allow building single crates for the compiler and standard libraryJoshua Nelson-110/+182
- 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-02Use generics for interned types rather than copy-pasting implsJoshua Nelson-69/+43
This makes it much simpler to add new interned types, rather than having to add 4+ impl blocks for each type.
2022-07-02move optimize-tests flag handling from bootstrap to compiletestThe 8472-7/+1
2022-07-02Rollup merge of #98753 - jyn514:dist-rust-dev, r=Mark-SimulacrumRalf Jung-0/+2
Fix `x dist rust-dev` on a fresh checkout Previously, it required you to manually run `x build` first, because it assumed the LLVM binaries were already present.
2022-07-02Only obey optimize-tests flag on UI tests that are run-passThe 8472-1/+4
``` optimize-tests = false, master 25.98s optimize-tests = true, master 34.69s optimize-tests = true, patched 28.79s ``` Effects: - faster UI tests - llvm asserts get exercised less on build-pass tests - the difference between opt and nopt builds shrinks a bit - aux libs don't get optimized since they don't have a pass mode and almost never have explicit compile flags