Commit Graph

3112 Commits

Author SHA1 Message Date
Corey Farwell 25bfa15371 Manually code-sign after running install_name_tool 2020-12-10 18:51:30 -05:00
Corey Farwell d1911dd075 If "aarch64-apple-darwin", copy sanitizers. 2020-12-10 00:18:43 -05:00
Corey Farwell 5940c19315 Enable ASan, TSan, UBSan for aarch64-apple-darwin. 2020-12-09 23:53:53 -05:00
Joshua Nelson 8909c4dc31 Fix rustup support in default_build_triple for python3
bootstrap completely ignores all errors when detecting a rustup version,
so this wasn't noticed before.

Fixes the following error:

```
rustup not detected: a bytes-like object is required, not 'str'
falling back to auto-detect
```

This also takes the opportunity to only call rustup and other external
commands only once during startup.
2020-12-08 19:38:25 -05:00
Matthias Krüger dbe3acfaeb don't wrap code block in Ok() (clipppy::unit_arg) 2020-12-08 20:27:48 +01:00
Nixon Enraght-Moony 1098cce27a Add tests for rustdoc json
Move rustdoc/rustdoc-json to rustdoc-json

Scaffold rustdoc-json test mode

Implement run_rustdoc_json_test

Fix up python

Make tidy happy
2020-12-01 18:34:39 +00:00
Mara Bos f45e6953d7
Rollup merge of #79527 - jyn514:intra-doc-tests, r=Manishearth
Move intra-doc link tests into a subdirectory

They were starting to get unwieldy.

r? ``@Manishearth``
2020-12-01 10:50:19 +00:00
Mara Bos 99e075ff29
Rollup merge of #79525 - jyn514:feature-gate-normalize, r=GuillaumeGomez
Add -Z normalize-docs and enable it for compiler docs

Works around https://github.com/rust-lang/rust/issues/79459 by only enabling normalization for the compiler itself (and anyone who opts-in on nightly). Eventually I want to remove this and enable normalization by default, but that's turned out to be [really hard](https://rust-lang.zulipchat.com/#narrow/stream/182449-t-compiler.2Fhelp/topic/How.20do.20I.20normalize.20projection.20types.20to.20a.20single.20type.3F/near/218125195).

This uses a command line option instead of a feature gate so it's easier to pass it to all crates at once. Theoretically it's better to use a feature gate instead so that it's easier for people to use on docs.rs, but I'm also not terribly concerned with how easy it to use a temporary hack.

Addresses https://github.com/rust-lang/rust/issues/77459.
2020-12-01 10:50:18 +00:00
Mara Bos 36ce8db229
Rollup merge of #79522 - ehuss:lint-check-validate, r=Mark-Simulacrum
Validate lint docs separately.

This addresses some concerns raised in https://github.com/rust-lang/rust/pull/76549#issuecomment-727638552 about errors with the lint docs being confusing and cumbersome. Errors from validating the lint documentation were being generated during `x.py doc` (and `x.py dist`), since extraction and validation are being done in a single step. This changes it so that extraction and validation are separated, so that `x.py doc` will not error if there is a validation problem, and tests are moved to `x.py test src/tools/lint-docs`.

This includes the following changes:

* Separate validation to `x.py test`.
* Added some more documentation on how to more easily modify and test the docs.
* Added more help to the error messages to hopefully provide more information on how to fix things.

The first commit just moves the code around, so you may consider looking at the other commits for a smaller diff.
2020-12-01 10:50:16 +00:00
Joshua Nelson 95a6427d2c Add -Z normalize-docs and enable it for compiler docs 2020-11-29 17:21:24 -05:00
Joshua Nelson 872acb0c35 Move `src/test/rustdoc-ui` intra-doc tests into a subdirectory
This also changes the builder to allow using
`x.py test src/test/rustdoc-ui/intra-doc`; before, it would panic that
no paths were found.
2020-11-28 21:14:09 -05:00
nooberfsh 331d52643a Fix a bootstrap comment 2020-11-29 10:02:24 +08:00
Eric Huss d2d91b42a5 lint-docs: Add --validate flag to validate lint docs separately. 2020-11-28 13:39:02 -08:00
Joseph Rafael Ferrer 6b47920c69 Convert UNC path to local path to satisfy install script on Windows 2020-11-23 22:37:51 +08:00
bors d806d65657 Auto merge of #79115 - cuviper:rust-description, r=Mark-Simulacrum
x.py: allow a custom string appended to the version

This adds `rust.description` to the config as a descriptive string to be
appended to `rustc --version` output, which is also used in places like
debuginfo `DW_AT_producer`. This may be useful for supplementary build
information, like distro-specific package versions.

For example, in Fedora 33, `gcc --version` outputs:

    gcc (GCC) 10.2.1 20201016 (Red Hat 10.2.1-6)

With this change, we can add similar vendor info to `rustc --version`.
2020-11-21 15:43:09 +00:00
Dylan DPC d5ee4edee1
Rollup merge of #79183 - cuviper:compiletest-test-sysroot, r=Mark-Simulacrum
Make compiletest testing use the local sysroot

We already set `compiletest` to use the local sysroot in #68019, but
that missed the configuration for testing `compiletest` itself.
2020-11-19 23:58:40 +01:00
Dylan DPC de62272548
Rollup merge of #79156 - jyn514:relative-llvm, r=Mark-Simulacrum
Allow using `download-ci-llvm` from directories other than the root

Previously, bootstrap.py would attempt to find the LLVM commit from
`src/llvm-project`. However, it assumed it was always being run from the
top-level directory, which isn't always the case.

Before:

```
downloading https://ci-artifacts.rust-lang.org/rustc-builds//rust-dev-nightly-x86_64-unknown-linux-gnu.tar.gz

curl: (22) The requested URL returned error: 404
failed to run: curl -# -y 30 -Y 10 --connect-timeout 30 --retry 3 -Sf -o /tmp/tmppyh4w8 https://ci-artifacts.rust-lang.org/rustc-builds//rust-dev-nightly-x86_64-unknown-linux-gnu.tar.gz
Build completed unsuccessfully in 0:00:02
```

After:

```
downloading https://ci-artifacts.rust-lang.org/rustc-builds/430feb24a46993e5073c1bb1b39da190d83fa2bf/rust-dev-nightly-x86_64-unknown-linux-gnu.tar.gz
 ###################################################################################################################################################################### 100.0%
extracting /home/joshua/rustc/src/bootstrap/build/cache/llvm-430feb24a46993e5073c1bb1b39da190d83fa2bf-False/rust-dev-nightly-x86_64-unknown-linux-gnu.tar.gz
```

r? ```@Mark-Simulacrum```
cc ```@pnkfelix```
2020-11-19 16:26:42 +01:00
Dylan DPC 3b857a5a3a
Rollup merge of #79155 - 12101111:fix-profiler-config, r=Mark-Simulacrum
fix handling the default config for profiler and sanitizers

#78354 don't handle the case that user don't add any target-specific config in `[target.*]` of `config.toml`:
```toml
changelog-seen = 2
[llvm]
link-shared = true
[build]
sanitizers = true
profiler = true
[install]
[rust]
[dist]
```

The previes code handle the default config in `Config::prase()`:

```rust
target.sanitizers = cfg.sanitizers.unwrap_or(build.sanitizers.unwrap_or_default());
target.profiler = cfg.profiler.unwrap_or(build.profiler.unwrap_or_default());
config.target_config.insert(TargetSelection::from_user(&triple), target);
```

In this case, `toml.target` don't contain any target, so the above code won't execute. Instead, a default `Target` is insert in c919f490bb/src/bootstrap/sanity.rs (L162-L166)

The default value for `bool` is false, hence the issue in #79124

This fix change the type of `sanitizers` and `profiler` to `Option<bool>`, so the default value is `None`, and fallback config is handled in  `Config::sanitizers_enabled` and `Config::profiler_enabled`

fix #79124

cc `@Mark-Simulacrum` `@richkadel`
2020-11-19 16:26:40 +01:00
Josh Stone 566e8771a5 Make compiletest testing use the local sysroot
We already set `compiletest` to use the local sysroot in #68019, but
that missed the configuration for testing `compiletest` itself.
2020-11-18 14:41:27 -08:00
Joshua Nelson 5163912e56 Allow using `download-ci-llvm` from directories other than the root
Previously, bootstrap.py would attempt to find the LLVM commit from
`src/llvm-project`. However, it assumed it was always being run from the
top-level directory, which isn't always the case.

Before:

```
downloading https://ci-artifacts.rust-lang.org/rustc-builds//rust-dev-nightly-x86_64-unknown-linux-gnu.tar.gz

curl: (22) The requested URL returned error: 404
failed to run: curl -# -y 30 -Y 10 --connect-timeout 30 --retry 3 -Sf -o /tmp/tmppyh4w8 https://ci-artifacts.rust-lang.org/rustc-builds//rust-dev-nightly-x86_64-unknown-linux-gnu.tar.gz
Build completed unsuccessfully in 0:00:02
```

After:

```
downloading https://ci-artifacts.rust-lang.org/rustc-builds/430feb24a46993e5073c1bb1b39da190d83fa2bf/rust-dev-nightly-x86_64-unknown-linux-gnu.tar.gz
 ###################################################################################################################################################################### 100.0%
extracting /home/joshua/rustc/src/bootstrap/build/cache/llvm-430feb24a46993e5073c1bb1b39da190d83fa2bf-False/rust-dev-nightly-x86_64-unknown-linux-gnu.tar.gz
```
2020-11-17 22:09:08 -05:00
12101111 36972b0d63 fix handling the default config for profiler and sanitizers 2020-11-18 10:33:07 +08:00
Pietro Albini d17874ff60 bootstrap: use the same version number for rustc and cargo
Historically the stable tarballs were named after the version number of
the specific tool, instead of the version number of Rust. For example,
both of the following tarballs were part of the same release:

    rustc-1.48.0-x86_64-unknown-linux-gnu.tar.xz
    cargo-0.49.0-x86_64-unknown-linux-gnu.tar.xz

PR #77336 changed the dist code to instead use Rust's version number for
all the tarballs, regardless of the tool they contain:

    rustc-1.48.0-x86_64-unknown-linux-gnu.tar.xz
    cargo-1.48.0-x86_64-unknown-linux-gnu.tar.xz

Because of that there is no need anymore to have a separate `cargo`
field in src/stage0.txt, as the Cargo version will always be the same as
the rustc version. This PR removes the field, simplifying the code and
the maintenance work required while producing releases.
2020-11-17 09:14:02 -05:00
Josh Stone 5f08568042 x.py: allow a custom string appended to the version
This adds `rust.description` to the config as a descriptive string to be
appended to `rustc --version` output, which is also used in places like
debuginfo `DW_AT_producer`. This may be useful for supplementary build
information, like distro-specific package versions.

For example, in Fedora 33, `gcc --version` outputs:

    gcc (GCC) 10.2.1 20201016 (Red Hat 10.2.1-6)

With this change, we can add similar vendor info to `rustc --version`.
2020-11-16 14:08:21 -08:00
bors f4d014cee7 Auto merge of #79074 - Mark-Simulacrum:fix-ci-llvm, r=jyn514
Install CI llvm into the library directory

In other words, my concern in https://github.com/rust-lang/rust/issues/78932#issuecomment-725781767 was perfectly justified by something we were already doing. For now just special case CI LLVM, but in the future we may want a more general fix.

Fixes #79071.

r? `@alexcrichton`
2020-11-16 00:40:04 +00:00
Mark Rousskov 4feaa35f39 Install CI llvm into the library directory 2020-11-15 08:59:53 -05:00
Jonas Schievink c8ac745040
Rollup merge of #79059 - jyn514:cranelift, r=Mark-Simulacrum
Print 'checking cranelift artifacts' to easily separate it from other artifacts

Before:

```
Checking rustdoc artifacts (x86_64-unknown-linux-gnu -> x86_64-unknown-linux-gnu)
    Checking rustdoc v0.0.0 (/home/joshua/rustc/src/librustdoc)
    Checking rustdoc-tool v0.0.0 (/home/joshua/rustc/src/tools/rustdoc)
    Finished release [optimized] target(s) in 2.08s
    Checking regalloc v0.0.31
    Checking gimli v0.22.0
    Checking object v0.21.1
    Checking cranelift-codegen v0.67.0 (https://github.com/bytecodealliance/wasmtime/?branch=main#44cbdece)
    Checking cranelift-module v0.67.0 (https://github.com/bytecodealliance/wasmtime/?branch=main#44cbdece)
    Checking cranelift-native v0.67.0 (https://github.com/bytecodealliance/wasmtime/?branch=main#44cbdece)
    Checking cranelift-frontend v0.67.0 (https://github.com/bytecodealliance/wasmtime/?branch=main#44cbdece)
    Checking cranelift-object v0.67.0 (https://github.com/bytecodealliance/wasmtime/?branch=main#44cbdece)
    Checking cranelift-simplejit v0.67.0 (https://github.com/bytecodealliance/wasmtime/?branch=main#44cbdece)
    Checking rustc_codegen_cranelift v0.1.0 (/home/joshua/rustc/compiler/rustc_codegen_cranelift)
    Finished release [optimized] target(s) in 10.55s

```

After:

```
Checking rustdoc artifacts (x86_64-unknown-linux-gnu -> x86_64-unknown-linux-gnu)
    Checking rustdoc v0.0.0 (/home/joshua/rustc/src/librustdoc)
    Checking rustdoc-tool v0.0.0 (/home/joshua/rustc/src/tools/rustdoc)
    Finished release [optimized] target(s) in 2.08s
Checking cranelift artifacts (x86_64-unknown-linux-gnu -> x86_64-unknown-linux-gnu)
    Checking cranelift-codegen v0.67.0 (https://github.com/bytecodealliance/wasmtime/?branch=main#44cbdece)
```

r? `@bjorn3`
`@bors` delegate=bjorn3
2020-11-15 13:40:05 +01:00
Jonas Schievink e0c378a673
Rollup merge of #79004 - jyn514:bacon, r=Mark-Simulacrum
Add `--color` support to bootstrap

When running under external utilities which wrap x.py, it can be convenient to force color support on.
2020-11-15 13:39:45 +01:00
Dylan DPC e3d52b8051
Rollup merge of #78986 - Mark-Simulacrum:fix-llvm, r=alexcrichton
Avoid installing external LLVM dylibs

If the LLVM was externally provided, then we don't currently copy artifacts into
the sysroot. This is not necessarily the right choice (in particular, it will
require the LLVM dylib to be in the linker's load path at runtime), but the
common use case for external LLVMs is distribution provided LLVMs, and in that
case they're usually in the standard search path (e.g., /usr/lib) and copying
them here is going to cause problems as we may end up with the wrong files and
isn't what distributions want.

This behavior may be revisited in the future though.

Fixes #78932.
2020-11-15 03:02:55 +01:00
Dylan DPC 3fe2abafe5
Rollup merge of #78968 - zec:add-llvm-as, r=Mark-Simulacrum
Include llvm-as in llvm-tools-preview component

Including `llvm-as` adds the ability to include assembly language fragments that can be inlined using LTO while making sure the correct version of LLVM is always used.
2020-11-15 03:02:49 +01:00
Joshua Nelson 6900dcbc03 Print 'checking cranelift artifacts' to easily separate it from other artifacts
Before:

```
Checking rustdoc artifacts (x86_64-unknown-linux-gnu -> x86_64-unknown-linux-gnu)
    Checking rustdoc v0.0.0 (/home/joshua/rustc/src/librustdoc)
    Checking rustdoc-tool v0.0.0 (/home/joshua/rustc/src/tools/rustdoc)
    Finished release [optimized] target(s) in 2.08s
    Checking regalloc v0.0.31
    Checking gimli v0.22.0
    Checking object v0.21.1
    Checking cranelift-codegen v0.67.0 (https://github.com/bytecodealliance/wasmtime/?branch=main#44cbdece)
    Checking cranelift-module v0.67.0 (https://github.com/bytecodealliance/wasmtime/?branch=main#44cbdece)
    Checking cranelift-native v0.67.0 (https://github.com/bytecodealliance/wasmtime/?branch=main#44cbdece)
    Checking cranelift-frontend v0.67.0 (https://github.com/bytecodealliance/wasmtime/?branch=main#44cbdece)
    Checking cranelift-object v0.67.0 (https://github.com/bytecodealliance/wasmtime/?branch=main#44cbdece)
    Checking cranelift-simplejit v0.67.0 (https://github.com/bytecodealliance/wasmtime/?branch=main#44cbdece)
    Checking rustc_codegen_cranelift v0.1.0 (/home/joshua/rustc/compiler/rustc_codegen_cranelift)
    Finished release [optimized] target(s) in 10.55s

```

After:

```
Checking rustdoc artifacts (x86_64-unknown-linux-gnu -> x86_64-unknown-linux-gnu)
    Checking rustdoc v0.0.0 (/home/joshua/rustc/src/librustdoc)
    Checking rustdoc-tool v0.0.0 (/home/joshua/rustc/src/tools/rustdoc)
    Finished release [optimized] target(s) in 2.08s
Checking cranelift artifacts (x86_64-unknown-linux-gnu -> x86_64-unknown-linux-gnu)
    Checking cranelift-codegen v0.67.0 (https://github.com/bytecodealliance/wasmtime/?branch=main#44cbdece)
```
2020-11-14 17:37:37 -05:00
Joshua Nelson 31741aad39 Add `--color` support to bootstrap
This allows using bootstrap with https://github.com/Canop/bacon.
2020-11-12 16:31:21 -05:00
Mark Rousskov 3747df71fa Avoid installing external LLVM dylibs
If the LLVM was externally provided, then we don't currently copy artifacts into
the sysroot. This is not necessarily the right choice (in particular, it will
require the LLVM dylib to be in the linker's load path at runtime), but the
common use case for external LLVMs is distribution provided LLVMs, and in that
case they're usually in the standard search path (e.g., /usr/lib) and copying
them here is going to cause problems as we may end up with the wrong files and
isn't what distributions want.

This behavior may be revisited in the future though.
2020-11-12 09:49:45 -05:00
DevJPM 6830f1c6e2 Bump the minimal supported LLVM version in the bootstrapping code to 9.0 2020-11-12 14:39:47 +01:00
Zachary Catlin e4a43fce3b Merge changes from rust-lang/rust 2020-11-11 21:17:45 -05:00
Zachary Catlin 562d50eb7b Include llvm-as in llvm-tools-preview component
Including llvm-as adds the ability to include assembly language fragments
that can be inlined using LTO.
2020-11-11 21:10:31 -05:00
Jonas Schievink 61c0a2c4ac
Rollup merge of #78947 - dalance:llvm_cov, r=Mark-Simulacrum
Ship llvm-cov through llvm-tools

`llvm-cov` is used to generate coverage report with LLVM InstrProf-based code coverage #34701.
So if `llvm-cov` is shipped through llvm-tools, users can try it easily accorging to the instruction of [The Rust Unstable Book](https://doc.rust-lang.org/nightly/unstable-book/compiler-flags/source-based-code-coverage.html).
2020-11-11 20:59:14 +01:00
Jonas Schievink 194b96852f
Rollup merge of #78354 - 12101111:rustbuild_profiler, r=Mark-Simulacrum
Support enable/disable sanitizers/profiler per target

This PR add options under `[target.*]` of `config.toml` which can enable or disable sanitizers/profiler runtime for corresponding target.
If these options are empty, the global options under `[build]` will take effect.

Fix #78329
2020-11-11 20:58:56 +01:00
bors 7afc517230 Auto merge of #78790 - Gankra:rust-src-vendor, r=Mark-Simulacrum
Vendor libtest's dependencies in the rust-src component

This is the Rust side of https://github.com/rust-lang/wg-cargo-std-aware/issues/23

Note that this won't produce a useful result for `cargo -Zbuild-std` if there are multiple versions of a crate vendored, but will otherwise produce a valid vendor dir.

See https://github.com/rust-lang/cargo/pull/8834 for the other half of this change.
2020-11-11 16:24:43 +00:00
dalance 2453ce717a Ship llvm-cov through llvm-tools 2020-11-12 00:03:09 +09:00
Dylan DPC 7ac079f047
Rollup merge of #78566 - JRF63:polly, r=Mark-Simulacrum
Enable LLVM Polly via llvm-args.

I think doing it this way is better than in #51061. Polly has other useful options and we probably don't want to create a `-Z` flag for each one of them.

![results](https://user-images.githubusercontent.com/7283601/97695555-338f7180-1adf-11eb-82bd-5130e0e6fa89.png)

[Benchmark](https://gist.github.com/JRF63/9a6268b91720958e90dbe7abffe20298)

I noticed that `-lto` seems to interfere with polly in this specific microbenchmark, as enabling it causes the perf to drop to that of non-polly builds.

Other related PRs: #75615
2020-11-09 19:06:51 +01:00
Dylan DPC 62d3a4f9c2
Rollup merge of #78513 - jyn514:rustup-toolchain, r=Mark-Simulacrum
Infer the default host target from the host toolchain if possible

- `beta-x86_64-unknown-linux-gnu` has beta stripped
- `rustc2` is ignored

This fixes ongoing issues where x.py will detect the wrong host triple
between MSVC and GNU.

I don't think this will break anyone's workflow - I'd be very surprised if you a) had no `[build]` section in `config.toml`, b) had rustc installed, and c) expected the default target to be something other than the default target used by `rustc`. But I could be wrong - I'm happy to hear user stories :)

Fixes https://github.com/rust-lang/rust/issues/78150.

r? ``@Mark-Simulacrum``
cc ``@Lokathor``
2020-11-09 19:06:49 +01:00
Alexis Beingessner ceba2befb4 Vendor libtest's dependencies in the rust-src component
This is the Rust side of https://github.com/rust-lang/wg-cargo-std-aware/issues/23
2020-11-09 11:20:12 -05:00
bors 25f6938da4 Auto merge of #78201 - joshtriplett:rustc-tls-model, r=Mark-Simulacrum
Compile rustc crates with the initial-exec TLS model

This should produce more efficient code, with fewer calls to
__tls_get_addr. The tradeoff is that libraries using it won't work with
dlopen, but that shouldn't be a problem for rustc's internal libraries.
2020-11-09 11:08:07 +00:00
Mara Bos cb90042049
Rollup merge of #78842 - shepmaster:bootstrap-rustfmt, r=Mark-Simulacrum
Honor the rustfmt setting in config.toml

Prior to this, setting the rustfmt configuration was ignored:

```
% mkdir example

% cd example

% ../configure --set build.rustfmt=/usr/bin/true

% ../x.py fmt
./x.py fmt is not supported on this channel
failed to run: /Users/shep/Projects/rust/example/build/bootstrap/debug/bootstrap fmt
Build completed unsuccessfully in 0:00:01
```

And after:

```
% ../x.py fmt
Build completed successfully in 0:00:11
```

r? `@Mark-Simulacrum`
2020-11-08 13:36:25 +01:00
Mara Bos a619e25398
Rollup merge of #78706 - bjorn3:fix_run_make_without_llvm, r=Mark-Simulacrum
Fix run-make tests running when LLVM is disabled

The `--cc`, `--cxx`, `--cflags` and `--ar` flags were only passed to compiletest when `builder.config.llvm_enabled()` returned true. This is preventing me from running the tests on cg_clif.
2020-11-08 13:36:12 +01:00
Jake Goulding 8cae2f167c Honor the rustfmt setting in config.toml
Prior to this, setting the rustfmt configuration was ignored:

```
% mkdir example

% cd example

% ../configure --set build.rustfmt=/usr/bin/true

% ../x.py fmt
./x.py fmt is not supported on this channel
failed to run: /Users/shep/Projects/rust/example/build/bootstrap/debug/bootstrap fmt
Build completed unsuccessfully in 0:00:01
```

And after:

```
% ../x.py fmt
Build completed successfully in 0:00:11
```
2020-11-07 13:36:42 -05:00
Josh Triplett 0328e69287 Compile tools and internal libraries with the initial-exec TLS model
This should produce more efficient code, with fewer calls to
__tls_get_addr. The tradeoff is that libraries using it won't work with
dlopen, but that shouldn't be a problem for tools or for our own
internal libraries.

Co-authored-by: Mark Rousskov <mark.simulacrum@gmail.com>
2020-11-06 15:07:05 -08:00
Yuki Okushi 3f5723c6c5
Rollup merge of #78705 - Mark-Simulacrum:nicer-failure-compiletest, r=jyn514
Print a summary of which test suite failed

Especially on CI, where cross-compiling is common and single builder may end up
with multiple hosts and multiple targets, it can be annoying to scroll back to
the nearest start of test marker. This prints out a summary of the test suite
being run directly in compiletest.

For example, on a mir-opt failure, this would show something like this:

```
failures:
    [mir-opt] mir-opt/while-storage.rs

test result: FAILED. 140 passed; 1 failed; 2 ignored; 0 measured; 0 filtered out

Some tests failed in compiletest suite=mir-opt mode=mir-opt host=x86_64-unknown-linux-gnu target=x86_64-unknown-linux-gnu
```

Fixes #78517
2020-11-07 01:02:16 +09:00
Yuki Okushi 8ca753108c
Rollup merge of #78514 - jyn514:setup-number, r=Mark-Simulacrum
Allow using 1/2/3/4 for `x.py setup` options

This undocumented feature allows you to typo 'a' as '1'.

r? ```@Mark-Simulacrum```
cc ```@Lokathor```
2020-11-07 01:02:07 +09:00
bors dc06a36074 Auto merge of #77351 - jyn514:clippy-sysroot, r=Mark-Simulacrum
Fix `x.py clippy`

I don't think this ever worked.

Fixes https://github.com/rust-lang/rust/issues/77309. `--fix` support is a work in progress, but works for a very small subset of `libtest`.

This works by using the host `cargo-clippy` driver; it does not use `stage0.txt` at all. To mitigate confusion from this, it gives an error if you don't have `rustc +nightly` as the default rustc in `$PATH`. Additionally, it means that bootstrap can't set `RUSTC`; this makes it no longer possible for clippy to detect the sysroot itself. Instead, bootstrap passes the sysroot to cargo.

r? `@ghost`
2020-11-06 11:31:18 +00:00
Joshua Nelson 8d2fa72fc8 Get `--fix` working for everything except rustdoc
Here's the error for rustdoc:

```
Checking rustdoc artifacts (x86_64-unknown-linux-gnu -> x86_64-unknown-linux-gnu)
error: no library targets found in package `rustdoc-tool`
```
2020-11-05 18:06:09 -05:00
Joshua Nelson 3863dee159 Infer the default host target from the host toolchain if possible
This fixes ongoing issues where x.py will detect the wrong host triple
between MSVC and GNU.

- Add line to changelog
2020-11-05 17:44:22 -05:00
Guillaume Gomez 99200f760b Fix even more URLs 2020-11-05 20:11:29 +01:00
bors f2bbdd0a32 Auto merge of #78740 - pietroalbini:no-more-legacy, r=Mark-Simulacrum
Remove legacy promote-release support from build-manifestg

Now that we're not running the [legacy `promote-release`](https://github.com/rust-lang/rust-central-station/tree/master/promote-release) anymore, this PR removes support from it from `bootstrap` and `build-manifest`.

r? `@Mark-Simulacrum`
2020-11-04 20:02:08 +00:00
Mara Bos a65507b47d
Rollup merge of #78709 - ehuss:fix-in_tree_crates-non-member, r=Mark-Simulacrum
Fix panic in bootstrap for non-workspace path dependencies.

If you add a `path` dependency to a `Cargo.toml` that is located outside of the workspace, then the `in_tree_crates` function can panic because it finds a path dependency that is not defined (since it uses `cargo metadata --no-deps`).  This fixes it by skipping over those entries, which are usually not things you select on the command-line.

Fixes #78617
2020-11-03 19:32:44 +01:00
Mara Bos 8a1f9e09a1
Rollup merge of #78687 - jyn514:bootstrap-help, r=Mark-Simulacrum
Suggest library/std when running all stage 0 tests

r? ``@Mark-Simulacrum``
cc ``@ijackson``

For context, this came out of a discord conversation where ``@ijackson`` was running `test --stage 1` when they were only adding doc-tests to the standard library.
2020-11-03 19:32:40 +01:00
Eric Huss 2172adbd5c Fix panic in bootstrap for non-workspace path dependencies. 2020-11-03 09:54:11 -08:00
Mark Rousskov f289a87628 Print a summary of which test suite failed
Especially on CI, where cross-compiling is common and single builder may end up
with multiple hosts and multiple targets, it can be annoying to scroll back to
the nearest start of test marker. This prints out a summary of the test suite
being run directly in compiletest.
2020-11-03 11:03:30 -05:00
bjorn3 39103ced58 Fix run-make tests running when LLVM is disabled 2020-11-03 16:55:33 +01:00
Pietro Albini 7704d35acc
build-manifest: remove legacy promote-release support
This commit removes support for the legacy promote-release, as that's
not executed anymore on the nightly channel.
2020-11-03 12:15:06 +01:00
Joshua Nelson 1aedcd33f5 Suggest library/std when running all stage 0 tests 2020-11-02 17:35:52 -05:00
Joseph Rafael Ferrer 301bb123f4 Enable LLVM Polly via llvm-args. 2020-10-30 18:23:02 +08:00
Joshua Nelson 8cf7d66d0a Create config.toml in the current directory, not the top-level directory
See https://github.com/rust-lang/rust/issues/78509 for discussion.
2020-10-29 21:23:55 -04:00
Joshua Nelson 1e737249af Allow using 1/2/3/4 for `x.py setup` options
This undocumented feature allows you to typo 'a' as '1'.
2020-10-28 23:40:40 -04:00
Yuki Okushi 2c307fab49
Rollup merge of #77703 - Keruspe:system-libunwind, r=Mark-Simulacrum
add system-llvm-libunwind config option

allows using the system-wide llvm-libunwind as the unwinder

Workaround for #76020
2020-10-27 08:44:44 +09:00
Joshua Nelson 31ecd2a124 Allow using clippy with either beta or nightly
Not 100% sure this will _always_ work, but it works currently.
2020-10-26 19:00:16 -04:00
Joshua Nelson bdbb54297a x.py fmt 2020-10-26 19:00:15 -04:00
Joshua Nelson 51f8076403 Add --fix support to `x.py clippy` 2020-10-26 18:58:52 -04:00
Joshua Nelson b3246e0cb1 Set the proper sysroot for clippy
Clippy does its own runtime detection of the sysroot, which was
incorrect in this case (it used the beta sysroot). This overrides the
sysroot to use `stage0-sysroot` instead.

- Get `x.py clippy` to work on nightly
- Give a nice error message if nightly clippy isn't installed
2020-10-26 18:56:55 -04:00
bors 35debd4c11 Auto merge of #77975 - bjorn3:cg_clif_subtree3, r=Mark-Simulacrum
Add cg_clif as optional codegen backend

Rustc_codegen_cranelift is an alternative codegen backend for rustc based on Cranelift. It has the potential to improve compilation times in debug mode. In my experience the compile time improvements over debug mode LLVM for a clean build are about 20-30% in most cases.

This PR adds cg_clif as optional codegen backend. By default it is only enabled for `./x.py check`. It can be enabled for `./x.py build` too by adding `cranelift` to the `rust.codegen-backends` array in `config.toml`.

MCP: https://github.com/rust-lang/compiler-team/issues/270

r? `@Mark-Simulacrum`
2020-10-26 16:31:38 +00:00
bjorn3 cf798c1ec6 Add support for using cg_clif to bootstrap rustc 2020-10-26 09:52:59 +01:00
12101111 b989d46b48 Support enable/disable sanitizers/profiler per target 2020-10-26 10:34:07 +08:00
bors 0dce3f606e Auto merge of #77901 - jonas-schievink:unignore-test-36710, r=Mark-Simulacrum
Unignore test for #36710 on MUSL

This now works fine thanks to autodetected `-C link-self-contained`.

Closes #36710
2020-10-25 16:37:01 +00:00
Nelson J Morais c3cbaf64d3 x.py test --test-args flag description enhancement 2020-10-23 20:06:37 +01:00
Yuki Okushi 025481a5eb
Rollup merge of #78153 - est31:downloaded_llvm_maybe_sync, r=Mark-Simulacrum
Sync LLVM submodule if it has been initialized

Since having enabled the download-ci-llvm option,
and having rebased on top of #76864,
I've noticed that I had to update the llvm-project
submodule manually if it was checked out.
Orignally, the submodule update logic was
introduced to reduce the friction for contributors
to manage the submodules, or in other words, to prevent
getting PRs that have unwanted submodule rollbacks
because the contributors didn't run git submodule update.

This commit adds logic to ensure there is no inadvertent
LLVM submodule rollback in a PR if download-ci-llvm
(or llvm-config) is enabled. It will detect whether the
llvm-project submodule is initialized, and if so, update
it in any case. If it is not initialized, behaviour is
kept to not do any update/initialization.

An alternative to the chosen implementation would
be to not pass the --init command line arg to
`git submodule update` for the src/llvm-project
submodule. This would show a confusing error message
however on all builds with an uninitialized repo.
We could pass the --silent param, but we still want
it to print something if it is initialized and has
to update something.
So we just do a manual check for whether the
submodule is initialized.
2020-10-23 18:26:32 +09:00
bors 8f0fa9d51f Auto merge of #78131 - SimonSapin:ar, r=Mark-Simulacrum
Package more llvm-* tools in the rust-dev component, for run-make-fulldeps tests

Fixes https://github.com/rust-lang/rust/issues/78110
2020-10-22 04:40:06 +00:00
Yuki Okushi 004a3aa49b
Rollup merge of #78009 - nielx:fix/CMAKE_SYSTEM_NAME, r=Mark-Simulacrum
Haiku: explicitly set CMAKE_SYSTEM_NAME when cross-compiling

This resolves issues where the cross-build of LLVM fails because it tries to
link to the host's system libraries instead of the target's system libraries.
2020-10-22 09:45:35 +09:00
Marc-Antoine Perennou 66fa42a946 allow using the system-wide llvm-libunwind as the unwinder
Signed-off-by: Marc-Antoine Perennou <Marc-Antoine@Perennou.com>
2020-10-21 14:45:58 +02:00
est31 5948e62f34 Sync LLVM submodule if it has been initialized
Since having enabled the download-ci-llvm option,
and having rebased on top of f05b47ccdf,
I've noticed that I had to update the llvm-project
submodule manually if it was checked out.
Orignally, the submodule update logic was
introduced to reduce the friction for contributors
to manage the submodules, or in other words, to prevent
getting PRs that have unwanted submodule rollbacks
because the contributors didn't run git submodule update.

This commit adds logic to ensure there is no inadvertent
LLVM submodule rollback in a PR if download-ci-llvm
(or llvm-config) is enabled. It will detect whether the
llvm-project submodule is initialized, and if so, update
it in any case. If it is not initialized, behaviour is
kept to not do any update/initialization.

An alternative to the chosen implementation would
be to not pass the --init command line arg to
`git submodule update` for the src/llvm-project
submodule. This would show a confusing error message
however on all builds with an uninitialized repo.
We could pass the --silent param, but we still want
it to print something if it is initialized and has
to update something.
So we just do a manual check for whether the
submodule is initialized.
2020-10-20 20:21:17 +02:00
Simon Sapin 99f99ca7ab Make users of `download-ci-llvm` download a new version 2020-10-20 20:07:58 +02:00
Simon Sapin bc3dbc62d6 Package more llvm-* tools in the rust-dev component, for run-make-fulldeps tests
Fixes https://github.com/rust-lang/rust/issues/78110
2020-10-20 11:31:28 +02:00
Yuki Okushi 24907f3507
Rollup merge of #77778 - jyn514:git-hook, r=mark-simulacrum
[x.py setup] Allow setting up git hooks from other worktrees

Closes https://github.com/rust-lang/rust/issues/77684
r? @caass
2020-10-20 12:11:00 +09:00
Jonas Schievink 77a7ccf869 bootstrap: configure native toolchain for run-make
This allows moving a lot of run-make-fulldeps tests to just run-make
tests, and allows running those on target-only platforms
2020-10-19 16:37:04 +02:00
Jonas Schievink 0558e6eb93 bootstrap: fall back to auto-detected CXX
This allows us to use the C++ compiler configured via
`CXX_target_triple` env vars
2020-10-19 16:37:04 +02:00
Camelid 6716c8320f bootstrap: Print units for "finished in xxx" message
It now says "finished in xxx seconds".

Also slightly improved some wording in the README.
2020-10-18 13:55:35 -07:00
Yuki Okushi 83ee319822
Rollup merge of #76607 - Mark-Simulacrum:tidy-bins, r=pnkfelix
Modify executable checking to be more universal

This uses a dummy file to check if the filesystem being used supports the executable bit in general.

Supersedes #74753.
2020-10-18 04:11:05 +09:00
Niels Sascha Reedijk 7b652d341e Haiku: explicitly set CMAKE_SYSTEM_NAME when cross-compiling
This resolves issues where the cross-build of LLVM fails because it tries to
link to the host's system libraries instead of the target's system libraries.
2020-10-16 08:32:41 +01:00
bors 19e1aac6ea Auto merge of #77756 - alarsyo:setup-llvm-detect, r=jyn514
Detect configuration for LLVM during setup

This is a first draft to address #77579, setting `download-ci-llvm` to true on Linux, but I could also implement the `if-available` setting mentioned in the issue.

On other platforms I was thinking about using [the which crate](https://crates.io/crates/which), if adding a dependency on it is considered okay of course, to detect the presence of `llvm-config` in the path, and use it if found. Still a work in progress of course.
2020-10-15 02:10:11 +00:00
Ian Jackson 636728e394 x.py setup: Avoid infinite loop if stdin is /dev/null
EOF is not an error; it just causes read_line to produce "".

Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
2020-10-14 11:40:53 +01:00
Ian Jackson e9058571ce x.py setup: Fix handling of wrong interactive input
We need a fresh input buffer each time, or we reuse the previous
data (since `read_line` appends).

Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
2020-10-14 11:40:53 +01:00
Ian Jackson 6e9e040bf8 x.py: setup: Offer keywords in interactive prompt
We understand these profile names because we use .to_str().
Mention them in the question.

Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
2020-10-14 11:40:53 +01:00
Ian Jackson b7c6041df1 x.py: setup: Provide a description of what it does
Co-authored-by: Joshua Nelson <joshua@yottadb.com>
2020-10-14 11:40:53 +01:00
Ian Jackson c4c5653a48 x.py: setup: Refactor to centralise list of profiles
Put all()'s otuput in the order we want to print things in, and add a
comment about why they are in this order.  Provide purpose() and
all_for_help().  Use these things everywhere.

Move all the abbrev character ("a", "b", etc.) processing into
interactive_path.

No functional change.

Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
2020-10-14 11:40:53 +01:00
Dylan DPC 31799bade5
Rollup merge of #77829 - gburgessiv:unused-features-var, r=alexcrichton
bootstrap: only use compiler-builtins-c if they exist

The assignment of `features` above was added in rust-lang#60981, but
never used. Presumably the intent was to replace the string literal here
with it.

While I'm in the area, `compiler_builtins_c_feature` doesn't need to be
a `String`.

I'm not entirely sure of a great way to locally test this -- `./x.py test`
passed on my machine, but 🤷‍♂️.

r? @alexcrichton
2020-10-14 02:30:44 +02:00
Yuki Okushi b4a3b5617f
Rollup merge of #77909 - pietroalbini:fix-build-manifest-path, r=Mark-Simulacrum
bootstrap: set correct path for the build-manifest binary

This changes the path of the binary inside the tarball to be:

```
build-manifest-{release}-{target}/build-manifest/bin/build-manifest
```

...instead of:

```
build-manifest-{release}-{target}/build-manifest/bin/build-manifest/build-manifest
```

r? @Mark-Simulacrum
2020-10-14 06:02:41 +09:00
Yuki Okushi c82478719b
Rollup merge of #77868 - Aaron1011:llvm-tools-opt-llc, r=Mark-Simulacrum
Include `llvm-dis`, `llc` and `opt` in `llvm-tools-preview` component

Fixes #55890

It's useful to have `llc` and `opt` available when debugging an LLVM
miscompilation,.
2020-10-14 06:02:31 +09:00
Yuki Okushi ec0cabd0fe
Rollup merge of #77786 - jyn514:rustdoc, r=Mark-Simulacrum
Mention rustdoc in `x.py setup`

This lets new contributors know which option they should pick; previously it wasn't clear 'compiler' also included rustdoc.

Unresolved questions: should this say 'compiler and tools' instead? I don't know of any tools that are modified in-tree other than rustdoc, though.

r? @Mark-Simulacrum
2020-10-14 06:02:27 +09:00
Yuki Okushi fe7e794b6a
Rollup merge of #77776 - jyn514:wrong-way, r=Mark-Simulacrum
Give an error when running `x.py test --stage 0 src/test/ui`

The error can be overridden with `COMPILETEST_FORCE_STAGE0=1`. In practice I don't know why anyone would do this.

r? @Mark-Simulacrum

Closes https://github.com/rust-lang/rust/issues/77711
2020-10-14 06:02:25 +09:00
Pietro Albini 6091538105
bootstrap: set correct path for the build-manifest binary 2020-10-13 20:37:38 +02:00
Antoine Martin b8ae4c5e36 Handle included config in bootstrap.py 2020-10-13 18:08:02 +02:00
Antoine Martin ab614b0f01 Implement "if-available" option for download-ci-llvm 2020-10-13 18:00:25 +02:00
Joshua Nelson b7080e6fd4 Give an error when running `x.py test --stage 0 src/test/ui` 2020-10-13 10:33:32 -04:00
bors d772879df3 Auto merge of #77762 - pietroalbini:dist-build-manifest, r=Mark-Simulacrum
Dist build manifest

This PR makes two changes that should remove a significant chunk of the time spent in our release process: cloning the `rust-lang/rust` monorepo, all its submodules, and building `bootstrap` to then invoke `build-manifest`:

* `build-manifest` doesn't rely on a clone of the monorepo being present anymore. The only remaining bit of information it fetched from it (the Rust version) is instead bundled in the binary.
* A new "component" is added, `build-manifest`. That component includes a prebuilt version of the tool, and it's *not* included in the Rustup manifest. This will allow `promote-release` to directly invoke the tool without interacting with our build system.
* The Linux x86_64 CI is changed to also build the component mentioned above. It's the only CI builder tasked to do so, and to cleanly support this a new `--include-default-paths` flag was added to `./x.py`.
* The `BUILD_MANIFEST_NUM_THREADS` environment variable is added to configure the number of threads at runtime.

This PR is best reviewed commit-by-commit.
r? `@Mark-Simulacrum`
2020-10-13 12:11:47 +00:00
Aaron Hill c16c8acae1
Include `llvm-dis`, `llc` and `opt` in `llvm-tools-preview` component
Fixes #55890

It's useful to have `llc` and `opt` available when debugging an LLVM
miscompilation,.
2020-10-12 17:05:48 -04:00
Yuki Okushi 93ec29b0cb
Rollup merge of #77852 - 12101111:fix-bootstrap-doc, r=jonas-schievink
update url in bootstrap README (gcc-rs -> cc-rs)

gcc-rs is renamed to cc-rs 3 years ago.
2020-10-13 04:08:05 +09:00
Yuki Okushi dde997710a
Rollup merge of #77746 - winnayx:issue-77572-fix, r=jyn514
Fix `x.py setup` sets `changelog-seen`

Fixes #77572 by setting changelog-seen in setup.rs
2020-10-13 04:07:56 +09:00
Pietro Albini 0b7ee9d522
build-manifest: bundle the rustc version in the binary 2020-10-12 19:54:40 +02:00
Pietro Albini 60ae018bf1
bootstrap: add --include-default-paths to ./x.py 2020-10-12 19:53:25 +02:00
Pietro Albini 2f387e9d11
bootstrap: add disabled by default build-manifest dist component 2020-10-12 19:53:24 +02:00
Pietro Albini 25cc75c924
build-manifest: accept the Rust version instead of the monorepo path
This commit changes the way build-manifest is invoked, to let it accept
the Rust version directly instead of requiring the path of the Rust
monorepo and letting build-manifest figure out the path on its own.

This allows to run build-manifest without a clone of the monorepo.
2020-10-12 19:53:22 +02:00
12101111 5d44402345 update url in bootstrap README 2020-10-12 21:17:11 +08:00
Winnie Xiao d7494af551 Mostly print statements to see where things are
More print statementsstatements lol

Solved the basic case of eliminating check_version ifk_version if subcommand = setup

Finished v1

checking out old bootstrap.py

checked out old irrelevant files

fixed tidy

Moved VERSION from bin/main.rs to lib.rs

Fixed semicolon return issue

x.py fmt
2020-10-11 22:32:06 +02:00
George Burgess IV ca5478a5df bootstrap: only use compiler-builtins-c if they exist
The assignment of `features` above was added in rust-lang#60981, but
never used. Presumably the intent was to replace the string literal here
with it.

While I'm in the area, `compiler_builtins_c_feature` doesn't need to be
a `String`.
2020-10-11 12:36:13 -07:00
Joshua Nelson 23c3356f9a Mention rustdoc in `x.py setup`
This also allows 'rustdoc' as a string for the compiler profile.
2020-10-10 10:27:11 -04:00
Joshua Nelson bd13567481 Allow setting up git hooks from other worktrees 2020-10-10 00:03:55 -04:00
Pietro Albini 8d2b15943b
bootstrap: always use the Rust version in package names
The format of the tarballs produced by CI is roughly the following:

    {component}-{release}-{target}.{ext}

While on the beta and nightly channels `{release}` is just the channel
name, on the stable channel is either the Rust version or the version of
the component we're shipping:

    cargo-0.47.0-x86_64-unknown-linux-gnu.tar.xz
    clippy-0.0.212-x86_64-unknown-linux-gnu.tar.xz
    llvm-tools-1.46.0-x86_64-unknown-linux-gnu.tar.xz
    miri-0.1.0-x86_64-unknown-linux-gnu.tar.xz
    rls-1.41.0-x86_64-unknown-linux-gnu.tar.xz
    rust-1.46.0-x86_64-unknown-linux-gnu.tar.xz
    ...

This makes it really hard to get the package URL without having access
to the manifest (and there is no manifest on ci-artifacts.rlo), as there
is no consistent version number to use.

This commit addresses the problem by always using the Rust version
number as `{release}` for the stable channel, regardless of the version
number of the component we're shipping. I chose that instead of "stable"
to avoid breaking the URL scheme *that* much.

Rustup should not be affected by this change, as it fetches the URLs
from the manifest. Unfortunately we don't have a way to test other
clients before making a stable release, as this change only affects the
stable channel.
2020-10-09 15:21:45 +02:00
bors 9c07010b7f Auto merge of #77631 - jyn514:helpful-changelog, r=RalfJung
Make src/bootstrap/CHANGELOG.md more helpful

Addresses fe6fc555ac (r42949241).

r? `@RalfJung`
cc `@Mark-Simulacrum`
2020-10-08 05:50:49 +00:00
Joshua Nelson 2a41342e9c Make src/bootstrap/CHANGELOG.md more helpful 2020-10-06 18:28:01 -04:00
Dylan DPC f600154be6
Rollup merge of #77624 - akoptelov:c-all-targets-fix, r=jyn514
Add c as a shorthand check alternative for new options #77603

There is a missing "c" that is a shorthand for "check" in newly added match arm for handling check-specific options.
2020-10-07 00:16:16 +02:00
Dylan DPC 59707c5748
Rollup merge of #77400 - alarsyo:xpy-setup-suggestions, r=jyn514
Fix suggestions for x.py setup

#76631 introduced a new `setup` command to x.py

By default the command prompts for a profile to use:

```
Welcome to the Rust project! What do you want to do with x.py?
a) Contribute to the standard library
b) Contribute to the compiler
c) Contribute to the compiler, and also modify LLVM or codegen
d) Install Rust from source
```

and then displays command suggestions, depending on which profile was chosen. However [the mapping between chosen profile](9cba260df0/src/bootstrap/setup.rs (L75-L85)) and [suggestion](9cba260df0/src/bootstrap/setup.rs (L42-L47)) isn't exact, leading to suggestions not being shown if the user presses `c` or `d`. (because "c" is translated to "llvm" and "d" to "maintainer", but suggestions trigger for "codegen" and "user" respectively)

A more thorough refactor would stop using "strings-as-type" to make sure this kind of error doesn't happen, but it may be overkill for that kind of "script" program?

Tagging the setup command author: @jyn514
2020-10-07 00:16:01 +02:00
Alexander Koptelov db46f43977 Add c as a shorthand check alternative for new options #77603 2020-10-06 22:05:11 +03:00
bors 9fdaeb393a Auto merge of #76356 - caass:hooks, r=jyn514
Add a command to install a git hook to automatically run `x.py test tidy --bless`

Some folks (such as myself) would probably find a lot of convenience in a pre-commit hook that automatically runs tidy before committing, to avoid burning CI time learning that your commit wasn't tidy.

I'm absolutely positive I have missed some stuff. I basically just got this to where you can run `./x.py run install-git-hook` and then clicked the commit button. Please let me know what else you'd like me to add before this can be merged!

[rustc-dev-guide companion PR](https://github.com/rust-lang/rustc-dev-guide/pull/848)
2020-10-06 14:51:51 +00:00
Antoine Martin d67a7e6cfc Use String type for Profile parse error 2020-10-06 16:40:30 +02:00
Antoine Martin 3afc004845 Show available profiles on error 2020-10-06 16:40:30 +02:00
Antoine Martin d3d3397121 Use Profile enum for x.py setup 2020-10-06 16:40:30 +02:00
Antoine Martin 6e06388a7f Fix suggestions for x.py setup 2020-10-06 15:53:58 +02:00
Yuki Okushi 54d72d73e9
Rollup merge of #77558 - thomcc:defaults-toml-extension, r=jyn514
Rename bootstrap/defaults/{config.toml.PROFILE => config.PROFILE.toml}

This allows these files to have okay syntax highlighting in editors, and helps avoid nagging from editors which want to suggest that I install a plugin for `*.library` files to view the `config.toml.library` or whatever.

It's a very minor change.

r?@jyn514
2020-10-06 16:26:07 +09:00
Cassandra Fridkin 0845627f73
Make changes based on @jyn514's comments 2020-10-05 22:00:43 -04:00
Cassandra Fridkin d585c96eaf
Add install_git_hook_maybe to setup.rs 2020-10-05 20:22:11 -04:00
Cassandra Fridkin f53d436638
Remove the rust stuff and just make it a simple shell script
It's ok, now I'm writing enough Rust that i'm able to get my fix elsewhere
2020-10-05 18:59:47 -04:00
Cassandra Fridkin 44af74f6dd
Merge branch 'master' into hooks 2020-10-05 18:49:51 -04:00
Thom Chiovoloni 5388eb41e9 Add changelog entry mentioning the renamed profile files 2020-10-04 18:39:59 -07:00
Thom Chiovoloni afe83d4c1c Rename bootstrap/defaults/{config.toml.PROFILE => config.PROFILE.toml} 2020-10-04 18:35:16 -07:00
Dylan DPC fffeaa7b83
Rollup merge of #77407 - pietroalbini:less-build-manifest, r=Mark-Simulacrum
Improve build-manifest to work with the improved promote-release

This PR makes some changes to build-manifest to have it work better with the other improvements I'm making to [promote-release](https://github.com/rust-lang/promote-release).

A new way to invoke the tool was added: `./x.py run src/tools/build-manifest`. The new invocation disables the generation of `.sha256` files and the generation of GPG signatures, as those steps are not tied to the Rust version we're building the manifest of: handling them in `promote-release` will improve the maintenability of our release process. Invocations through the old command (`./x.py dist hash-and-sign`) are referred inside the source code as "legacy". The new invocation also enables internal parallelism, disabled on legacy to avoid overloading our old server.

Improvements were also made on how the checksums included in the manifest are generated:

* The manifest is first generated with placeholder checksums, and then a function walks through the manifes and calculates only the needed hashes. Before this PR, all the hashes were calculated beforehand, including the hashes of unused files.
* Calculating the hashes is now done in parallel with rayon, to better utilize all the available disk bandwidth.
* The `sha2` crate is now used instead of the `sha256sum` CLI tool: this avoids the overhead of calling another process, but more importantly enables hardware acceleration whenever available (the `sha256sum` CLI tool doesn't support it at all).

r? @Mark-Simulacrum
This PR is best reviewed commit-by-commit.
2020-10-05 02:29:33 +02:00
Yuki Okushi 69f2cf5ad9
Rollup merge of #77473 - Mark-Simulacrum:check-limited, r=ecstatic-morse
Make --all-targets in x.py check opt-in

In particular due to #76822, making this the default is currently suboptimal.

r? @ecstatic-morse
2020-10-04 11:45:10 +09:00
ecstatic-morse eaa0186662
Add quotes around command in CHANGELOG 2020-10-03 09:29:50 -07:00
Mark Rousskov f2961638c8 Place all-targets checking behind a flag
This matches Cargo behavior and avoids the (somewhat expensive) double checking,
as well as the unfortunate duplicate error messages (#76822,
rust-lang/cargo#5128).
2020-10-03 09:53:13 -04:00
bors 6f56fbdc1c Auto merge of #77347 - jyn514:dox, r=Amanieu
Remove --cfg dox from rustdoc.rs

This was added in https://github.com/rust-lang/rust/pull/53076 because
several dependencies were using `cfg(dox)` instead of `cfg(rustdoc)` (now `cfg(doc)`).
I ran `rg 'cfg\(dox\)'` on the source tree with no matches, so I think
this is now safe to remove.

r? `@Mark-Simulacrum`
cc `@QuietMisdreavus` :)
2020-10-03 07:23:02 +00:00
bors d92d28e523 Auto merge of #77298 - jyn514:bootstrap-config, r=Mark-Simulacrum
Don't warn if the config file is somewhere other than `config.toml`

Previously, `config.config` was always hardcoded as `"config.toml"`.
I thought that it was being overridden with the actual value later, but
it turns out `flags.config` was being completely discarded. This keeps
`config.config` in sync with `flags.config`.

Fixes https://github.com/rust-lang/rust/issues/77293
r? `@Mark-Simulacrum`
cc `@davidtwco`
2020-09-30 15:03:09 +00:00
Pietro Albini d4928ad7fd
build-manifest: keep legacy behavior when invoking through ./x.py dist 2020-09-30 14:29:02 +02:00
Pietro Albini e05e2f9a94
bootstrap: add ./x.py run src/tools/build-manifest 2020-09-30 13:54:12 +02:00
bors 0d9afb6717 Auto merge of #77133 - tmandry:bootstrap-host, r=Mark-Simulacrum
bootstrap: Always build for host, even when target is given

This changes the behavior from *not* building for host whenever an
explicit target is specified. I find this much less confusing.

You can still disable host steps by passing an explicit empty list for
host.

Fixes #76990.

r? `@Mark-Simulacrum`
2020-09-30 00:59:12 +00:00
Tyler Mandry bf7aeaa617 Filter out empty items in bootstrap:🎏:split 2020-09-29 22:50:57 +00:00
Joshua Nelson 351f850d33 Remove unused --cfg stageN 2020-09-29 18:25:52 -04:00
Joshua Nelson 6533c29bea Remove --cfg dox from rustdoc.rs
This was added in https://github.com/rust-lang/rust/pull/53076 because
several dependencies were using `cfg(dox)` instead of `cfg(rustdoc)`.
I ran `rg 'cfg\(dox\)'` on the source tree with no matches, so I think
this is now safe to remove.
2020-09-29 18:00:19 -04:00
bors 9b77a6a200 Auto merge of #77145 - pietroalbini:refactor-build-manifest-versions, r=Mark-Simulacrum
Refactor versions detection in build-manifest

This PR refactors how `build-manifest` handles versions, making the following changes:

* `build-manifest` now detects the "package releases" on its own, without relying on rustbuild providing them through CLI arguments. This drastically simplifies calling the tool outside of `x.py`, and will allow to ship the prebuilt tool in a tarball in the future, with the goal of stopping to invoke `x.py` during `promote-release`.
* The `tar` command is not used to extract the version and the git hash from tarballs anymore. The `flate2` and `tar` crates are used instead. This makes detecting those pieces of data way faster, as the archive is decompressed just once and we stop parsing the archive once all the information is retrieved.
* The code to extract the version and the git hash now stores all the collected data dynamically, without requiring to add new fields to the `Builder` struct every time.

I tested the changes locally and it should behave the same as before.

r? `@Mark-Simulacrum`
2020-09-29 16:41:53 +00:00
Tyler Mandry 6bd57e3531 Bump bootstrap version and update changelog 2020-09-28 20:15:43 +00:00
Tyler Mandry 52ca5ca7b7 Remove skip_only_host_steps
And make tests explicitly list their hosts and targets.
2020-09-28 19:32:46 +00:00
Tyler Mandry e715c7f234 bootstrap: Always build for host, even when target is given
This changes the behavior from *not* building for host whenever an
explicit target is specified. I find this much less confusing.

You can still disable host steps by passing an explicit empty list for
host.

Fixes #76990.
2020-09-28 19:32:46 +00:00
Joshua Nelson d537067c97 Don't warn if the config file is somewhere other than `config.toml`
Previously, `config.config` was always hardcoded as `"config.toml"`.
I thought that it was being overridden with the actual value later, but
it turns out `flags.config` was being completely discarded. This keeps
`config.config` in sync with `flags.config`.
2020-09-28 10:28:15 -04:00
bors 6369a98ebd Auto merge of #77008 - fortanix:raoul/lvi-tests, r=Mark-Simulacrum
LVI hardening tests

Mitigating the speculative execution LVI attack against SGX enclaves requires compiler changes (i.e., adding lfences). This pull requests adds various tests to check if this happens correctly.
2020-09-28 03:28:04 +00:00
Tshepang Lekhonkhobe 58c232af6a reduce overlong line 2020-09-27 04:22:55 +02:00
Ralf Jung c39598aeea
Rollup merge of #76631 - jyn514:x.py-setup, r=Mark-Simulacrum
Add `x.py setup`

Closes #76503.

- Suggest `x.py setup` if config.toml doesn't exist yet
- Prompt for a profile if not given on the command line
- Print the configuration that will be used
- Print helpful starting commands after setup
- Link to the dev-guide after finishing
2020-09-26 12:58:13 +02:00
Jonas Schievink ba3e25f992
Rollup merge of #77146 - Mark-Simulacrum:xpyinstall, r=alexcrichton
Install std for non-host targets

It seems reasonable that when configuring various targets you'd expect all of them to get std installed, even if you're not building compiler toolchains for each of those.

cc #76990

r? @alexcrichton
2020-09-25 19:42:46 +02:00
Jonas Schievink 61dc57c85a
Rollup merge of #77126 - Mark-Simulacrum:llvm-less-often, r=alexcrichton
Invalidate local LLVM cache less often

This avoids a download of LLVM after every rebase. The downside to this is that if we land some patch affecting LLVM built in CI that breaks this option, but that PR does not update the LLVM submodule, we'll likely not notice until the next update -- but this seems unlikely to happen in practice and I am not personally worried about it.

r? @alexcrichton
2020-09-25 19:42:44 +02:00
Jonas Schievink 0a3cf02fd7
Rollup merge of #77120 - ecstatic-morse:keep-stage-std, r=Mark-Simulacrum
Add `--keep-stage-std` to `x.py` for keeping only standard library artifacts

Unlike `--keep-stage 0`, `--keep-stage-std 0` will allow the stage 0 compiler artifacts (i.e., stage1/bin/rustc) to be rebuilt if it has changed. This allows contributors to iterate on later stages of the compiler in tandem with the standard library without needing to to rebuild the entire compiler. I often run into this when working on const-checking, since I may need to add a feature gate or make a small tweak to the standard library.
2020-09-25 19:42:43 +02:00
Jonas Schievink 8621ef1159
Rollup merge of #77106 - matthiaskrgr:changelog_seen, r=Mark-Simulacrum
clarify that `changelog-seen = 1` goes to the beginning of config.toml

Fixes #77105
2020-09-25 19:42:41 +02:00
Jonas Schievink b49990cede
Rollup merge of #77086 - ehuss:src-libunwind, r=Mark-Simulacrum
Include libunwind in the rust-src component.

Some targets, such as musl, need the libunwind source to build the unwind crate (referenced [here](0da5800745/library/unwind/build.rs (L142))).

Fixes rust-lang/wg-cargo-std-aware#59
2020-09-25 19:42:37 +02:00
Raoul Strackx 159d11fb06 Patch compilation test helpers for sgx platform 2020-09-25 15:15:37 +02:00
Joshua Nelson 9baa601afd Add `x.py setup`
- Suggest `x.py setup` if config.toml doesn't exist yet (twice, once
before and once after the build)
- Prompt for a profile if not given on the command line
- Print the configuration file that will be used
- Print helpful starting commands after setup
- Link to the dev-guide after finishing
- Note that distro maintainers will see the changelog warning
2020-09-24 10:32:45 -04:00
Mark Rousskov 4de836e214 Install std for non-host targets 2020-09-24 09:37:23 -04:00
Dylan MacKenzie 16769eb19e Add entry to CHANGELOG for `--keep-stage-std` 2020-09-23 16:22:59 -07:00
Dylan MacKenzie c0ddaed2bf Remove warning about possible future deprecation 2020-09-23 16:17:11 -07:00
Mark Rousskov df004df3a7 Re-download LLVM on submodule updates only 2020-09-23 19:03:52 -04:00
Dylan MacKenzie bcbd2ccc8d Add `keep-stage-std` to `x.py`
This keeps only the `std` artifacts compiled by the given stage, not the
compiler. This is useful when working on the latter stages of the
compiler in tandem with the standard library, since you don't have to
rebuild the *entire* compiler when the standard library changes.
2020-09-23 14:25:23 -07:00
Matthias Krüger b5d47bfa3a clarify that `changelog-seen = 1` goes to the beginning of config.toml
Fixes #77105
2020-09-23 15:45:35 +02:00
bors 33aa8be8b5 Auto merge of #76864 - est31:downloaded_llvm_no_clone_sources, r=Mark-Simulacrum
Don't download/sync llvm-project submodule if download-ci-llvm is set

llvm-project takes > 1GB storage space and a long time to download.
It's better to not download it unless needed.
2020-09-23 10:38:18 +00:00
Eric Huss 9f27f3796d Include libunwind in the rust-src component. 2020-09-22 17:20:15 -07:00
bors 0da5800745 Auto merge of #76810 - Mark-Simulacrum:fix-lld-macos, r=alexcrichton
Don't dynamically link LLVM tools unless rustc is too

This PR initially tried to support link-shared on all of our target platforms (other than Windows), but ran into a number of difficulties:
 * LLVM doesn't really support a shared link on macOS (llvm-config runs into problems with the version suffix)
 * LLVM doesn't seem to support a shared link when cross-compiling (the libLLVM.so ends up empty and symbols are not found)

So, this PR has now been revised such that we don't attempt to dynamically link LLVM tools (even if that would, otherwise, be supported) on targets where LLVM is statically linked to rustc. Currently that's basically everything except for x86_64-unknown-linux-gnu (where we dynamically link to avoid rerunning ThinLTO in each stage).

Follow-up to #76708.
Fixes #76698.
2020-09-22 20:35:45 +00:00
bors cbc5e4d4d5 Auto merge of #76626 - jyn514:x.py-changelog, r=Mark-Simulacrum
Add a changelog for x.py and nag contributors until they read it

Add a changelog for x.py

- Add a changelog and instructions for updating it
- Use `changelog-seen` in `config.toml` and `VERSION` in bootstrap to determine whether the changelog has been read.  There's no way to tie reading the changelog to updating the version, so unfortunately they still have to update `config.toml` manually. Actually reading the changelog is optional, anyone can set `changelog-seen = N` without reading (although it's not recommended).
- Nag people if they haven't read the x.py changelog
  + Print message twice to make sure it's seen
- Give different error messages depending on whether the version needs to be updated or added

Closes https://github.com/rust-lang/rust/issues/76617
r? `@Mark-Simulacrum`
2020-09-22 10:36:41 +00:00
bors 44ae0b8b2d Auto merge of #76799 - Mark-Simulacrum:fix-cross-compile-dist, r=alexcrichton
Fix cross compiling dist/build invocations

I am uncertain why the first commit is not affecting CI. I suspect it's because we pass --disable-docs on most of our cross-compilation builders. The second commit doesn't affect CI because CI runs x.py dist, not x.py build.

Both commits are standalone; together they should resolve #76733. The first commit doesn't really fix that issue but rather just fixes cross-compiled x.py dist, resolving a bug introduced in #76549.
2020-09-22 06:02:21 +00:00
Joshua Nelson fe6fc555ac Add a changelog for x.py
- Add a changelog and instructions for updating it
- Use `changelog-seen` in `config.toml` and `VERSION` in bootstrap to determine whether the changelog has been read
- Nag people if they haven't read the x.py changelog
  + Print message twice to make sure it's seen
- Give different error messages depending on whether the version needs to be updated or added
2020-09-21 09:08:18 -04:00
Ralf Jung 8fa75a2b3a
Rollup merge of #76628 - jyn514:default-config-files, r=Mark-Simulacrum
Add sample defaults for config.toml

- Allow including defaults in `src/bootstrap/defaults` using `profile = "..."`.
- Add default config files, with a README noting they're experimental and asking you to open an issue if you run into trouble. The config files have comments explaining why the defaults are set.
- Combine config files using the `merge` dependency.

This introduces a new dependency on `merge` that hasn't yet been vetted.

I want to improve the output when `include = "x"` isn't found:

```
thread 'main' panicked at 'fs::read_to_string(&file) failed with No such file or directory (os error 2) ("configuration file did not exist")', src/bootstrap/config.rs:522:28
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
failed to run: /home/joshua/rustc/build/bootstrap/debug/bootstrap test tidy
Build completed unsuccessfully in 0:00:00
```

However that seems like it could be fixed in a follow-up.

Closes #76619
2020-09-21 10:40:28 +02:00
Mark Rousskov cf33aad8fd Specify output directory for bootstrap tests 2020-09-20 16:39:13 -04:00
Mark Rousskov 1aac99de25 Provide bootstrap tools with RUSTC in environment 2020-09-20 16:39:13 -04:00
Joshua Nelson c9c8fb88cf Add sample defaults for config.toml
- Allow including defaults in `src/bootstrap/defaults` using `profile = "..."`
- Add default config files
- Combine config files using the merge dependency.
- Add comments to default config files
- Add a README asking to open an issue if the defaults are bad
- Give a loud error if trying to merge `.target`, since it's not
  currently supported
- Use an exhaustive match
- Use `<none>` in config.toml.example to avoid confusion
- Fix bugs in `Merge` derives

Previously, it would completely ignore the profile defaults if there
were any settings in `config.toml`. I sent an email to the `merge` maintainer
asking them to make the behavior in this commit the default.

This introduces a new dependency on `merge` that hasn't yet been vetted.

I want to improve the output when `include = "x"` isn't found:

```
thread 'main' panicked at 'fs::read_to_string(&file) failed with No such file or directory (os error 2) ("configuration file did not exist")', src/bootstrap/config.rs:522:28
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
failed to run: /home/joshua/rustc/build/bootstrap/debug/bootstrap test tidy
Build completed unsuccessfully in 0:00:00
```

However that seems like it could be fixed in a follow-up.
2020-09-20 16:18:58 -04:00
Mark Rousskov a625ab77e8 Discover Rust toolchain without Python 2020-09-20 16:18:58 -04:00
Mark Rousskov e21eb613e0 Remove support for different src directory
This requires that bootstrap is run from the same worktree as the sources it'll
build, but this is basically required for the build to work anyway. You can
still run it from a different directory, just that the files it builds must be
beside it.
2020-09-20 16:18:58 -04:00
Mark Rousskov 6d19561587 Set BUILD_TRIPLE via build script
This moves build triple discovery for rustbuild from bootstrap.py into a build
script, meaning it will "just work" if building rustbuild via Cargo rather than
Python.
2020-09-20 16:18:58 -04:00
Ralf Jung 24980b7d8d
Rollup merge of #76878 - pietroalbini:version, r=Mark-Simulacrum
Move the version number to a plaintext file

The Rust version number is currently embedded in bootstrap's source code, which makes it hard to update it automatically or access it outside of ./x.py (as you'd have to parse the source code).

This PR moves the version number to a standalone plaintext file, which makes accessing or updating it trivial.

r? @Mark-Simulacrum
2020-09-20 15:51:56 +02:00
Ralf Jung b603143c9e
Rollup merge of #76800 - jyn514:usage, r=Mark-Simulacrum
Don't generate bootstrap usage unless it's needed

Previously, `x.py` would unconditionally run `x.py build` to get the
help message. After https://github.com/rust-lang/rust/issues/76165,
when checking the CI stage was moved into `Config`, that would cause an
assertion failure (but only only in CI!):

```
thread 'main' panicked at 'assertion failed: `(left == right)`
  left: `1`,
 right: `2`', src/bootstrap/config.rs:619:49
```

This changes bootstrap to only generate a help message when it needs
to (when someone passes `--help`).

r? @Mark-Simulacrum
This should fix the CI failures in https://github.com/rust-lang/rust/pull/76797 and https://github.com/rust-lang/rust/pull/75991.
2020-09-20 12:08:15 +02:00
Mark Rousskov 389b7ff190 Do not link LLVM tools to LLVM dylib unless rustc is
Previously we would have some platforms where LLVM was linked to rustc
statically, but to the LLVM tools dynamically. That meant we were distributing
two copies of LLVM: one as a separate dylib and one statically linked in to
librustc_driver.
2020-09-19 18:21:08 -04:00
Ralf Jung 404cce0685
Rollup merge of #76796 - jyn514:wrong-stage, r=shepmaster
Give a better error message when x.py uses the wrong stage for CI

r? @shepmaster
2020-09-19 11:47:54 +02:00
Pietro Albini 3bddfea7e2
build-manifest: stop receiving release numbers from bootstrap 2020-09-18 17:42:58 +02:00
Pietro Albini b9af3e30a9
bootstrap: move the version number to a plaintext file
The Rust version number is currently embedded in bootstrap's source
code, which makes it hard to update it automatically or access it
outside of ./x.py (as you'd have to parse the source code).

This commit moves the version number to a standalone plaintext file,
which makes accessing or updating it trivial.
2020-09-18 14:58:22 +02:00
est31 f05b47ccdf Don't download/sync llvm-project submodule if download-ci-llvm is set
llvm-project takes > 1GB storage space and a long time to download.
It's better to not download it unless needed.
2020-09-18 06:21:06 +02:00
Jonas Schievink ee1e9343b3 Distribute rustc sources as part of `rustc-dev` 2020-09-18 00:18:19 +02:00
Mark Rousskov 363aff0a9d Add test for x.py build cross-compilation 2020-09-17 16:03:42 -04:00
Mark Rousskov bd4e0af0b5 Build rustdoc for cross-compiled targets
This isn't an issue for most folks who use x.py dist, which will directly depend
on this. But for x.py build, if we don't properly set target here rustdoc will
not be built.

Currently, there is not a default-on step for generating a rustc for a given
target either, so we will fail to build a rustc as well.
2020-09-16 17:25:39 -04:00
Mark Rousskov 7e24136996 Pass --target to lint docs
Otherwise, we may not have a standard library built for the native "host" target
of the rustc being run.
2020-09-16 17:25:39 -04:00
Tyler Mandry 233937419a
Rollup merge of #76741 - Mark-Simulacrum:no-dry-run-timing, r=alexcrichton
Avoid printing dry run timings

This avoids a wall of text on CI with 0.000 as the likely time.

r? @alexcrichton
2020-09-16 12:24:14 -07:00
Tyler Mandry 2e0dbf162c
Rollup merge of #76735 - jyn514:no-clone, r=Mark-Simulacrum
Remove unnecessary `clone()`s in bootstrap

The performance difference is negligible, but it makes me feel better.

r? @Mark-Simulacrum
2020-09-16 12:24:12 -07:00
Joshua Nelson c35ce3ff17 Don't generate bootstrap usage unless it's needed
Previously, `x.py` would unconditionally run `x.py build` to get the
help message. After https://github.com/rust-lang/rust/issues/76165,
when checking the CI stage was moved into `Config`, that would cause an
assertion failure (but only only in CI!):

```
thread 'main' panicked at 'assertion failed: `(left == right)`
  left: `1`,
 right: `2`', src/bootstrap/config.rs:619:49
```

This changes bootstrap to only generate a help message when it needs
to (when someone passes `--help`).
2020-09-16 13:31:20 -04:00
Joshua Nelson be37265708 Give a better error message when x.py uses the wrong stage for CI 2020-09-16 12:00:56 -04:00
Joshua Nelson d04ca008e1 Remove unnecessary `clone()`s in bootstrap
The performance difference is negligible, but it makes me feel better.

Note that this does not remove some clones in `config`, because it would
require changing the logic around (and performance doesn't matter
for bootstrap).
2020-09-16 08:51:42 -04:00
Dylan DPC f631293565
Rollup merge of #76717 - ehuss:fix-rustc-book-libdir, r=Mark-Simulacrum
Fix generating rustc docs with non-default lib directory.

If `libdir` is set in `config.toml`, then the tool to generate the rustc docs was unable to run `rustc` because it could not find the shared libraries. The solution is to set the dylib search path to include the libdir.

I changed the API of `add_rustc_lib_path` to take `Command` instead of `Cargo` to try to share the code in several places. This is how it worked before https://github.com/rust-lang/rust/pull/64316, and I think this still retains the spirit of that change.

Fixes #76702
2020-09-16 12:34:29 +02:00
bors 5fae56971d Auto merge of #76781 - RalfJung:rollup-ve66o2j, r=RalfJung
Rollup of 10 pull requests

Successful merges:

 - #76056 (Add more info for Vec Drain doc)
 - #76062 (Vec slice example fix style and show type elision)
 - #76262 (Use inline(never) instead of cold)
 - #76335 (Make all methods of `Duration` unstably const)
 - #76366 (Add Arith Tests in Library)
 - #76369 (Move Various str tests in library)
 - #76534 (Add doc comments for From impls)
 - #76622 (Update bootstrap readme)
 - #76641 (Some cleanup changes and commenting)
 - #76662 (Fix liballoc test suite for Miri)

Failed merges:

r? `@ghost`
2020-09-16 06:46:24 +00:00
Ralf Jung 1ff91d6d59
Rollup merge of #76622 - jyn514:bootstrap-readme, r=Mark-Simulacrum
Update bootstrap readme

- Reflect changes in x.py defaults
- Remove recommendation to use nightly for incremental; it works fine on
beta
- Remove note that incremental chooses stage 1 by default; stage 1 is
already the default
- Update Discord -> Zulip

r? @Mark-Simulacrum
2020-09-16 08:24:58 +02:00
bors 1e11660d1e Auto merge of #76625 - jyn514:default-stages, r=Mark-Simulacrum
Make the default stage for x.py configurable

This also allows configuring each sub-command individually.

Possibly #76617 should land before this? I don't feel strongly either way, I don't mind waiting.

Closes https://github.com/rust-lang/rust/issues/76165.
r? `@Mark-Simulacrum`
2020-09-16 04:05:22 +00:00
Joshua Nelson 328c61c157 Make the default stage for x.py configurable
This allows configuring the default stage for each sub-command individually.

- Normalize the stage as early as possible, so there's no confusion
  about which to use.
- Don't add an explicit `stage` option in config.toml

  This offers no more flexibility than `*_stage` and makes it confusing
  which takes precedence.

- Always give `--stage N` precedence over config.toml
- Fix bootstrap tests

  This changes the tests to go through `Config::parse` so that they test
  the actual defaults, not the dummy ones provided by `default_opts`.  To
  make this workable (and independent of the environment), it does not
  read `config.toml` for tests.
2020-09-15 11:19:55 -04:00
Mark Rousskov f001a0c8dd Enable shared linking to LLVM on non-Windows
Windows doesn't quite support dynamic linking to LLVM yet, but on other
platforms we do. In #76708, it was discovered that we dynamically link to LLVM
from the LLVM tools (e.g., rust-lld), so we need the shared LLVM library to link
against. That means that if we do not have a shared link to LLVM, and want LLVM
tools to work, we'd be shipping two copies of LLVM on all of these platforms:
one in librustc_driver and one in libLLVM.

Also introduce an error into rustbuild if we do end up configured for shared
linking on Windows.
2020-09-15 10:22:02 -04:00
Mark Rousskov 05c9c0ee5d Modify executable checking to be more universal
This uses a dummy file to check if the filesystem being used supports the
executable bit in general.
2020-09-15 10:00:11 -04:00
Mark Rousskov 5f3145febd Avoid printing dry run timings 2020-09-15 08:59:34 -04:00
Eric Huss 9dad908145 Fix generating rustc docs with non-default lib directory. 2020-09-14 14:42:56 -07:00
bors b5f55b7e15 Auto merge of #76549 - ehuss:lints-comments, r=wesleywiser
Auto-generate lint documentation.

This adds a tool which will generate the lint documentation in the rustc book automatically. This is motivated by keeping the documentation up-to-date, and consistently formatted. It also ensures the examples are correct and that they actually generate the expected lint. The lint groups table is also auto-generated. See https://github.com/rust-lang/compiler-team/issues/349 for the original proposal.

An outline of how this works:
- The `declare_lint!` macro now accepts a doc comment where the documentation is written. This is inspired by how clippy works.
- A new tool `src/tools/lint-docs` scrapes the documentation and adds it to the rustc book during the build.
    - It runs each example and verifies its output and embeds the output in the book.
    - It does a few formatting checks.
    - It verifies that every lint is documented.
- Groups are collected from `rustc -W help`.

I updated the documentation for all the missing lints. I have also added an "Explanation" section to each lint providing a reason for the lint and suggestions on how to resolve it.

This can lead towards a future enhancement of possibly showing these docs via the `--explain` flag to make them easily accessible and discoverable.
2020-09-14 05:54:44 +00:00
Eric Huss ce014be0b9 Link rustdoc lint docs to the rustdoc book. 2020-09-13 08:48:03 -07:00
Eric Huss 45c1e0ae07 Auto-generate lint documentation. 2020-09-13 08:48:03 -07:00
Aleksey Kladov cf0720146e Fix CI LLVM to work on NixOS out of the box 2020-09-13 14:47:15 +02:00
bors 4e48010b95 Auto merge of #76588 - guswynn:debug_logging, r=jyn514,Mark-Simulacrum
Add a dedicated debug-logging option to config.toml

`@Mark-Simulacrum` and I were talking in zulip and we found that turning on debug/trace logging in rustc is fairly confusing, as it effectively depends on debug-assertions and is not documented as such. `@Mark-Simulacrum` mentioned that we should probably have a separate option for logging anyways.

this diff adds that, having the option follow debug-assertions (so everyone's existing config.toml should be fine) and if the option is false

to test I ran ./x.py test <something> twice, once with `debug-logging = false` and once with `debug-logging = true` and made sure i only saw trace's when it was true
2020-09-13 07:21:31 +00:00
bors 04b72b4697 Auto merge of #76349 - Mark-Simulacrum:dl-llvm, r=alexcrichton
Download LLVM from CI to bootstrap (linux-only to start)

This follows #76332, adding support for using CI-built LLVM rather than building it locally. This should essentially "just work," but is left off by default in this PR.

While we can support downloading LLVM for multiple host triples, this currently only downloads it for the build triple. That said, it should be possible to expand this relatively easily should multiple host triples be desired. Most people shouldn't be adjusting host/target triples though, so this should cover most use cases.

Currently this downloads LLVM for the last bors-authored commit in the `git log`. This is a bit suboptimal -- we want the last bors-authored commit that touched the llvm-project submodule in basically all cases. But for now this just adds an extra ~20 MB download when rebasing atop latest master. Once we have a submodule bump landing after #76332, we can fix this behavior to reduce downloads further.
2020-09-13 02:16:18 +00:00
Mark Rousskov 2e87a6e78d Set link-shared if LLVM ThinLTO is enabled in config.rs
This avoids missing a shared build when uplifting LLVM artifacts into the
sysroot. We were already producing a shared link anyway, though, so this is not
a visible change from the end user's perspective.
2020-09-12 15:10:55 -04:00
Mark Rousskov a7b092f418 Download LLVM from CI to bootstrap 2020-09-12 15:10:09 -04:00
bors 7adeb2c795 Auto merge of #76639 - Mark-Simulacrum:ci-hosts, r=pietroalbini
Add host triples to CI builders

This is a follow-up to #76415, which changed how x.py interprets cross-compilation target/host flags. This should fix the known cases, but I'm still working through CI logs before/after that PR to identify if anything else is missing.
2020-09-12 15:44:07 +00:00
Mark Rousskov e788b1a2fe Print all step timings
It is really painful to inspect differences in what was built in CI if things
are appearing and disappearing randomly as they hover around the 100ms mark. No
matter what we choose there's always going to be quite a bit of variability on
CI in timing, so we're going to see things appear and vanish.
2020-09-12 10:05:10 -04:00
Joshua Nelson 85ab152be7 Update bootstrap readme
- Reflect changes in x.py defaults
- Remove recommendation to use nightly for incremental; it works fine on
beta
- Remove note that incremental chooses stage 1 by default; stage 1 is
already the default
- Update Discord -> Zulip
2020-09-11 21:00:40 -04:00
bors 141bb23be8 Auto merge of #76415 - Mark-Simulacrum:bootstrap-cross-compilation, r=alexcrichton
rustbuild: avoid trying to inversely cross-compile for build triple from host triples

This changes rustbuild's cross compilation logic to better match what users expect,
particularly, avoiding trying to inverse cross-compile for the build triple from host triples.
That is, if build=A, host=B, target=B, we do not want to try and compile for A from B.
Indeed, the only "known to run" triple when cross-compiling is the build triple A.
When testing for a particular target we need to be able to run binaries compiled for
that target though.

The last commit also modifies the default set of host/target triples to avoid producing
needless artifacts for the build triple:

The new behavior is to respect --host and --target when passed as the *only*
configured triples (no triples are implicitly added). The default for --host is
the build triple, and the default for --target is the host triple(s), either
configured or the default build triple.

Fixes #76333

r? `@alexcrichton` if possible, otherwise we'll need to hunt down a reviewer
2020-09-11 18:10:44 +00:00
Gus Wynn 0be66d7f30 just max_level_info 2020-09-11 09:37:51 -07:00
Mark Rousskov 78125ec6b3 Stop implicitly appending triples to config.toml hosts and targets
Previously, the CLI --target/--host definitions and configured options differed
in their effect: when setting these on the CLI, only the passed triples would be
compiled for, while in config.toml we would also compile for the build triple
and any host triples. This is needlessly confusing; users expect --target and
--host to be identical to editing the configuration file.

The new behavior is to respect --host and --target when passed as the *only*
configured triples (no triples are implicitly added). The default for --host is
the build triple, and the default for --target is the host triple(s), either
configured or the default build triple.
2020-09-11 08:59:01 -04:00
Mark Rousskov b4eb099261 Verify we compile std without involving a b host compiler 2020-09-11 08:59:01 -04:00
Mark Rousskov 3193d52a21 Remove host parameter from step configurations
rustc is a natively cross-compiling compiler, and generally none of our steps
should care whether they are using a compiler built of triple A or B, just the
--target directive being passed to the running compiler. e.g., when building for
some target C, you don't generally want to build two stds: one with a host A
compiler and the other with a host B compiler. Just one std is sufficient.
2020-09-11 08:59:01 -04:00
bors d778203da2 Auto merge of #76573 - Mark-Simulacrum:bootstrap-with-external-llvm, r=alexcrichton
Only copy LLVM into rust-dev with internal LLVM

This avoids needing to figure out where to locate each of the components with an
external LLVM. This component isn't manifested for rustup consumption and
generally shouldn't matter for anyone except Rust's CI, so it is fine for it to not be
complete elsewhere.

Fixes #76572.

r? `@alexcrichton`
2020-09-11 11:16:33 +00:00
bors f5b7dd8181 Auto merge of #76381 - petrochenkov:nomingwcomp, r=Mark-Simulacrum
rustbuild: Do not use `rust-mingw` component when bootstrapping windows-gnu targets

Addresses https://github.com/rust-lang/rust/pull/76326#issuecomment-687273473 (ancient `x86_64-w64-mingw32-gcc` is selected as a linker wrapper, which is not usable in `use_lld=true` mode).

Perhaps the comment about incompatible mingw was true in the past, but many things changed since then.
With this change I was able to build everything successfully locally using a newer mingw toolchain, if it passes through the older toolchain on CI, then it should be good, I think.
2020-09-11 06:36:43 +00:00
Gus Wynn 15aa6f31b9 add debug-logging to config.toml 2020-09-10 16:39:04 -07:00
Mark Rousskov 4f2d94180d Only copy LLVM into rust-dev with internal LLVM
This avoids needing to figure out where to locate each of the components with an
external LLVM.
2020-09-10 12:04:15 -04:00
bors 25b2f48612 Auto merge of #76378 - petrochenkov:lldtest, r=Mark-Simulacrum
rustbuild: Build tests with LLD if `use-lld = true` was passed

Addresses https://github.com/rust-lang/rust/pull/76127#discussion_r479932392.

Our test suite is generally ready to run with an explicitly specified linker (https://github.com/rust-lang/rust/pull/45191),
 so LLD specified with `use-lld = true` works as well.

Only 4 tests fail (on `x86_64-pc-windows-msvc`):
```
ui/panic-runtime/lto-unwind.rs
run-make-fulldeps/debug-assertions
run-make-fulldeps/foreign-exceptions
run-make-fulldeps/test-harness
```
All of them are legitimate issues with LLD (or at least with combination Rust+LLD) and manifest in segfaults on access to TLS (https://github.com/rust-lang/rust/pull/76127#issuecomment-683473325). UPD: These issues are caused by https://github.com/rust-lang/rust/issues/72145 and appear because I had `-Ctarget-cpu=native` set.

UPD: Further commits build tests with LLD for non-MSVC targets and propagate LLD to more places when `use-lld` is enabled.
2020-09-10 10:06:44 +00:00
Tyler Mandry 9fa0794203
Rollup merge of #76472 - matthiaskrgr:llvm_cmake_vars, r=Mark-Simulacrum
rustbuild: don't set PYTHON_EXECUTABLE and WITH_POLLY cmake vars since they are no longer supported by llvm

This resolves

CMake Warning:
  Manually-specified variables were not used by the project:

    PYTHON_EXECUTABLE
    WITH_POLLY
2020-09-09 21:02:32 -07:00
Tyler Mandry f09372ab60
Rollup merge of #74787 - petrochenkov:rustllvm, r=cuviper
Move `rustllvm` into `compiler/rustc_llvm`

The `rustllvm` directory is not self-contained, it contains C++ code built by a build script of the `rustc_llvm` crate which is then linked into that crate.
So it makes sense to make `rustllvm` a part of `rustc_llvm` and move it into its directory.
I replaced `rustllvm` with more obvious `llvm-wrapper` as the subdirectory name, but something like `llvm-adapter` would work as well, other suggestions are welcome.

To make things more confusing, the Rust side of FFI functions defined in `rustllvm` can be found in `rustc_codegen_llvm` rather than in `rustc_llvm`. Perhaps they need to be moved as well, but this PR doesn't do that.

The presence of multiple LLVM-related directories in `src` (`llvm-project`, `rustllvm`, `librustc_llvm`, `librustc_codegen_llvm` and their predecessors) historically confused me and made me wonder about their purpose.
With this PR we will have LLVM itself (`llvm-project`), a FFI crate (`rustc_llvm`, kind of `llvm-sys`) and a codegen backend crate using LLVM through the FFI crate (`rustc_codegen_llvm`).
2020-09-09 21:02:24 -07:00
Tyler Mandry 09bfb7ea2b
Rollup merge of #76473 - ortem:fix-gcc-warning, r=jonas-schievink
Add missed spaces to GCC-WARNING.txt
2020-09-09 15:05:54 -07:00
Vadim Petrochenkov 10d3f8a484 Move `rustllvm` into `rustc_llvm` 2020-09-09 23:05:43 +03:00
Dylan DPC b2ca5131ed
Rollup merge of #76379 - petrochenkov:nodegen, r=Mark-Simulacrum
rustbuild: Remove `Mode::Codegen`

It's no longer used.
2020-09-09 01:35:15 +02:00
bors 5099914a16 Auto merge of #76332 - Mark-Simulacrum:bootstrap-llvm, r=pietroalbini
Add rust-dev component to support rustc development

This is preparatory work for permitting rustc developers to use CI-built LLVM rather than building it locally. Unlike distro-built LLVM, CI built LLVM is essentially guaranteed to behave perfectly for local development -- it is fully up to date, and carries all necessary patches.

This is a separate PR from #76349 because it needs to land before that one, since we want a master build with the full CI LLVM to be available for easier testing.
2020-09-08 16:01:26 +00:00
Matthias Krüger 0065e33c24 rustbuild: don't set PYTHON_EXECUTABLE and WITH_POLLY cmake vars since they are no longer supported by llvm
CMake Warning:
  Manually-specified variables were not used by the project:

    PYTHON_EXECUTABLE
    WITH_POLLY
2020-09-08 11:32:25 +02:00
ortem c8262fd87b Add missed spaces to GCC-WARNING.txt 2020-09-08 12:20:49 +03:00
Mark Rousskov aa4554f42d Dedicated rust development tarball
This currently includes libLLVM, llvm-config, and FileCheck, but will perhaps
expand to more tooling overtime. It should be considered entirely unstable and
may change at any time.
2020-09-07 16:10:29 -04:00
Mark Rousskov 2656d3414c Make bootstrap build on stable
This is generally a good idea, and will help with being able to build bootstrap
without Python over time as it means we can "just" build with cargo +beta build
rather than needing the user to set environment variables. This is a minor step,
but a necessary one on that road.
2020-09-06 21:26:09 -04:00
Vadim Petrochenkov b27fca71d4 rustbuild: Deduplicate LLD checks slightly 2020-09-07 00:40:07 +03:00
Vadim Petrochenkov 5118a51b4d rustbuild: Propagate LLD to more places when `use-lld` is enabled 2020-09-07 00:40:07 +03:00
Vadim Petrochenkov 8e6b563b93 rustbuild: Build tests with LLD if `use-lld = true` was passed (non-msvc) 2020-09-07 00:40:07 +03:00
Vadim Petrochenkov 77d11c3ce2 rustbuild: Build tests with LLD if `use-lld = true` was passed 2020-09-07 00:40:07 +03:00
bors b40abfd485 Auto merge of #76326 - mati865:use_lld-no-linker, r=Mark-Simulacrum
Fix rust.use-lld when linker is not set

Fixes https://github.com/rust-lang/rust/pull/76127#issuecomment-685419195

Previously when `[<target>].linker` was not configured `rust.use-lld` would set it to `rust-lld` on platforms where it should not.
2020-09-06 04:00:56 +00:00
Vadim Petrochenkov 8754884b78 rustbuild: Do not use `rust-mingw` component when bootstrapping windows-gnu targets 2020-09-05 20:49:59 +03:00
Vadim Petrochenkov 4fff14d3d8 rustbuild: Remove `Mode::Codegen` 2020-09-05 20:34:03 +03:00
Cassandra Fridkin a009e2838b
There isn't a way to pass --remove yet, but you can rm if u like 2020-09-04 21:00:58 -04:00
Mateusz Mikuła a2fbf39cc8 Fix rust.use-lld when linker is not set 2020-09-04 15:31:53 +02:00
Mark Rousskov af133382f2 Check test/example/benchmark on x.py check
Often when modifying compiler code you'll miss that you've changed an API used
by unit tests, since x.py check didn't previously catch that.

It's also useful to have this for editing with rust-analyzer and similar tooling
where editing tests previously didn't notify you of errors in test files.
2020-09-03 15:16:53 -04:00
Mark Rousskov 22769917b0 Avoid spurious print outs during dryrun 2020-09-02 16:00:47 -04:00
Mark Rousskov d77c351c89 Move ninja requirements to a dynamic check, when actually building
It isn't practical to determine whether we'll build LLVM very early in the
pipeline, so move the ninja checking to a dynamic check.
2020-09-01 10:13:56 -04:00
Aleksey Kladov 9caf08f052
Rollup merge of #76127 - petrochenkov:lld, r=Mark-Simulacrum
rustbuild: Remove one LLD workaround

The version of LLD shipped with Rust no longer have this issue.

Closes https://github.com/rust-lang/rust/issues/68647
2020-08-31 15:22:45 +02:00
Vadim Petrochenkov 21c624a230 rustbuild: Remove one LLD workaround 2020-08-31 00:26:07 +03:00
Vadim Petrochenkov 7dfbf59f10 cleanup: Remove duplicate library names from `Cargo.toml`s 2020-08-30 22:57:54 +03:00