Commit Graph

144 Commits

Author SHA1 Message Date
Irina Popa b63d7e2b1c Rename trans to codegen everywhere. 2018-05-17 15:08:30 +03:00
Josh Stone e8e5eb58c0 Ensure libraries built in stage0 have unique metadata
Issue #50786 shows a case with local rebuild where the libraries built
by stage0 had the same suffix as stage0's own, and were accidentally
loaded by that stage0 rustc when compiling `librustc_trans`.

Now we set `__CARGO_DEFAULT_LIB_METADATA` to "bootstrap" during stage0,
rather than the release channel like usual, so the library suffix will
always be completely distinct from the stage0 compiler.
2018-05-15 17:48:02 -07:00
bors 0cd465087d Auto merge of #50105 - mixi:crt-included, r=alexcrichton
Use the correct crt*.o files when linking musl targets.

This is supposed to support optionally using the system copy of musl
libc instead of the included one if supported. This currently only
affects the start files, which is enough to allow building rustc on musl
targets.

Most of the changes are analogous to crt-static.

Excluding the start files is something musl based distributions usually patch into their copy of rustc:
  - https://github.com/alpinelinux/aports/blob/eb064c8/community/rust/musl-fix-linux_musl_base.patch
  - https://github.com/voidlinux/void-packages/blob/77400fc/srcpkgs/rust/patches/link-musl-dynamically.patch

For third-party distributions that not yet carry those patches it would be nice if it was supported without the need to patch upstream sources.

## Reasons
### What breaks?
Some start files were missed when originally writing the logic to swap in musl start files (gcc comes with its own start files, which are suppressed by -nostdlib, but not manually included later on). This caused #36710, which also affects rustc with the internal llvm copy or any other system libraries that need crtbegin/crtend.

### How is it fixed?
The system linker already has all the logic to decide which start files to include, so we can just defer to it (except of course if it doesn't target musl).

### Why is it optional?
In #40113 it was first tried to remove the start files, which broke compiling musl-targeting static binaries with a glibc-targeting compiler. This is why it eventually landed without removing the start files. Being an option side-steps the issue.

### Why are the start files still installed?
This has the nice side-effect, that the produced rust-std-* binaries can still be used by on a glibc-targeting system with a rustc built against glibc.

## Does it work?
With the following build script (using [musl-cross-make](https://github.com/richfelker/musl-cross-make)): https://shadowice.org/~mixi/rust-musl/build.sh, I was able to cross-compile a musl-host musl-targeting rustc on a glibc-based system. The resulting binaries are at https://shadowice.org/~mixi/rust-musl/binaries/. This also requires #50103 and #50104 (which are also applied to the branch the build script uses).
2018-05-11 19:46:16 +00:00
bors 57dc98434e Auto merge of #50200 - alexcrichton:compile-with-clang, r=kennytm
Compile LLVM with Clang on release builders

Attempting to cache in on some rustc compile time wins mentioned in https://github.com/rust-lang/rust/issues/49879#issuecomment-383602941
2018-05-10 10:30:02 +00:00
bors 95d0b9e967 Auto merge of #49729 - collin5:b48483, r=Mark-Simulacrum
./x.py test should be able to run individual tests

Allows user to be able to run individual tests by specifying filename i.e `./x.py test src/test/run-pass/foo.rs`

Fixes #48483
2018-05-10 02:15:40 +00:00
Alex Crichton 7e5b9ac41e ci: Compile LLVM with Clang 6.0.0
Currently on CI we predominately compile LLVM with the default system compiler
which means gcc on Linux, some version of Clang on OSX, MSVC on Windows, and
gcc on MinGW. This commit switches Linux, OSX, and Windows to all use Clang
6.0.0 to build LLVM (aka the C/C++ compiler as part of the bootstrap). This
looks to generate faster code according to #49879 which translates to a faster
rustc (as LLVM internally is faster)

The major changes here were to the containers that build Linux releases,
basically adding a new step that uses the previous gcc 4.8 compiler to compile
the next Clang 6.0.0 compiler. Otherwise the OSX and Windows scripts have been
updated to download precompiled versions of Clang 6 and configure the build to
use them.

Note that `cc` was updated here to fix using `clang-cl` with `cc-rs` on MSVC, as
well as an update to `sccache` on Windows which was needed to correctly work
with `clang-cl`. Finally the MinGW compiler is entirely left out here
intentionally as it's currently thought that Clang can't generate C++ code for
MinGW and we need to use gcc, but this should be verified eventually.
2018-05-09 14:45:34 -07:00
Collins Abitekaniza 41ee6fe147 ./x.py test should be able to run individual tests
trim and pass relative test paths as test-args

use collect for getting test_args

move suite_path to ShouldRun and make Option

append existing args to test_args

use enum for PathSet

handle Suites differently from Paths

Error out if part of test suite but not file

refactor, make requested changes
2018-05-07 16:51:58 +03:00
bors 6f721f54c6 Auto merge of #50466 - kennytm:rustbuild-stage0-lib-test, r=Mark-Simulacrum
rustbuild: Allow quick testing of libstd and libcore at stage0

This PR implemented two features:

1. Added a `--no-doc` flag to allow testing a crate *without* doc tests. In this mode, we don't need to build rustdoc, and thus we can skip building the stage2 compiler. (Ideally stage0 test should use the bootstrap rustdoc, but I don't want to mess up the core builder logic here)

2. Moved all libcore tests externally and added a tidy test to ensure we don't accidentally add `#[test]` into libcore.

After this PR, one could run `./x.py test --stage 0 --no-doc src/libstd` to test `libstd` without building the compiler, thus enables us to quickly test new library features.
2018-05-06 06:33:53 +00:00
kennytm 05af55bd80
s/DocTestsOption/DocTests/g 2018-05-06 03:30:42 +08:00
John Kåre Alsaker e24cbe2da0 Misc tweaks 2018-05-05 20:36:46 +02:00
kennytm be9d6690b2
Added test case. 2018-05-06 02:34:07 +08:00
kennytm 1733f5e1c0
Added `./x.py test --no-doc` option.
This enables `./x.py test --stage 0 src/libstd --no-doc` and ensures the
stage2-rustc and rustdoc need to be built.
2018-05-06 01:27:22 +08:00
Johannes Nixdorf ec2b861c2f bootstrap: pass crt-static for the compiler host as well 2018-04-29 11:30:56 +02:00
kennytm d403d82b0a
Rollup merge of #49707 - steveklabnik:rustc-book, r=QuietMisdreavus
Add "the Rustc book"

This PR introduces a new book into the documentation, "The rustc book". We already have books for Cargo, and for Rustdoc, rustc should have some too. This book is focused on *users* of rustc, and provides a nice place to write documentation for users.

I haven't put content here, but plan on scaffolding it out very soon, and wanted this PR open for a few discussions first. One of those is "what exactly should said TOC be?" I plan on having a proposed one up tomorrow, but figured I'd let people know to start thinking about it now.

The big one is that we also will want to put https://github.com/rust-lang-nursery/rustc-guide in-tree as well, and the naming is... tough. I'm proposing:

* doc.rust-lang.org/rustc is "The Rustc book", to mirror the other tools' books.
* doc.rust-lang.org/rustc-contribution is "The Rustc contribution guide", and contains that book

@nikomatsakis et al, any thoughts on this? I'm not attached to it in particular, but had to put something together to get this discussion going. I think mirroring the other tools is a good idea for this work, but am not sure where exactly that leaves yours.

Fixes https://github.com/rust-docs/team/issues/11
2018-04-27 14:16:42 +08:00
varkor 261da7108d Ensure CleanTools is run for check rustdoc 2018-04-19 19:20:55 +01:00
varkor baf940d580 Add rustdoc to x.py check
This can often encounter errors after modifying rustc, so it's useful to include it in the steps that are checked.
2018-04-19 19:06:34 +01:00
bors 78fc510743 Auto merge of #49890 - varkor:xpy-check-rustc_trans, r=alexcrichton
Add rustc_trans to x.py check

r? @Mark-Simulacrum

I looked at `bootstrap/compile.rs` and `bootstrap/check.rs` to try to work out which steps were appropriate, but I'm sure I've overlooked some details here, so it's worth checking carefully I've got all the steps right (e.g. I wasn't sure whether we want to build LLVM if necessary with `x.py check`, though I thought it was probably better to than to not).

From a quick test, it seems to be working, though.
2018-04-19 06:19:27 +00:00
bors e0f9b32357 Auto merge of #50022 - nrc:doc-analysis, r=mark-simulacrum
Only emit save-analysis data for `cargo build` tasks

Previously, we were emittinng analysis data for all tasks, including `doc`. That meant we got two sets of save-analysis data, one from the normal build and one from the docs. That means indexing with the RLS took twice as long and made downloads larger and build times longer.

cc https://github.com/rust-lang-nursery/rls/issues/826

r? @Mark-Simulacrum
2018-04-18 22:30:00 +00:00
varkor 1db9fabdf7 Do not rebuild LLVM for x.py check 2018-04-18 10:49:00 +01:00
varkor b53468f500 Add rustc_trans to x.py check 2018-04-18 10:44:09 +01:00
Mark Simulacrum be1e7893d5 Remove uses of Build across Builder steps 2018-04-17 19:50:50 -06:00
Nick Cameron de34735ab2 Only emit save-analysis data for `cargo build` tasks
Previously, we were emittinng analysis data for all tasks, including `doc`. That meant we got two sets of save-analysis data, one from the normal build and one from the docs. That means indexing with the RLS took twice as long and made downloads larger and build times longer.

cc https://github.com/rust-lang-nursery/rls/issues/826
2018-04-17 21:35:10 +12:00
bors 8728c7a726 Auto merge of #49542 - GuillaumeGomez:intra-link-resolution-error, r=GuillaumeGomez
Add warning if a resolution failed

r? @QuietMisdreavus
2018-04-17 09:02:03 +00:00
Guillaume Gomez b2192ae157 Add rustdoc-ui test suite 2018-04-16 23:37:11 +02:00
Josh Stone bc7403d067 Avoid specific claims about debuginfo size 2018-04-13 21:57:53 -07:00
Josh Stone cc2906cb26 rustbuild: allow building tools with debuginfo
Debugging information for the extended tools is currently disabled for
concerns about the size.  This patch adds `--enable-debuginfo-tools` to
let one opt into having that debuginfo.

This is useful for debugging the tools in distro packages.  We always
strip debuginfo into separate packages anyway, so the extra size is not
a concern in regular use.
2018-04-13 16:52:54 -07:00
steveklabnik b99418d4b0 Add rustc book to the build system 2018-04-09 14:04:10 -04:00
Mark Simulacrum c115cc655c Move deny(warnings) into rustbuild
This permits easier iteration without having to worry about warnings
being denied.

Fixes #49517
2018-04-08 16:59:14 -06:00
Mark Simulacrum a727447f59 Refactor to use a dry-run config instead of cfg(test)
This ensures that each build will support the testing design of "dry
running" builds. It's also checked that a dry run build is equivalent
step-wise to a "wet" run build; the graphs we generate when running are
directly compared node/node and edge/edge, both for order and contents.
2018-04-03 11:43:14 -06:00
Mark Simulacrum b0dbc7c15d Implement generating graphs of the build steps 2018-04-03 11:43:12 -06:00
Mark Simulacrum f4620a3d14 Stub out less code 2018-04-03 11:41:51 -06:00
Mark Simulacrum 42fde21c27 Add tests to rustbuild
In order to run tests, previous commits have cfg'd out various parts of
rustbuild. Generally speaking, these are filesystem-related operations
and process-spawning related parts. Then, rustbuild is run "as normal"
and the various steps that where run are retrieved from the cache and
checked against the expected results.

Note that this means that the current implementation primarily tests
"what" we build, but doesn't actually test that what we build *will*
build. In other words, it doesn't do any form of dependency verification
for any crate. This is possible to implement, but is considered future
work.

This implementation strives to cfg out as little code as possible; it
also does not currently test anywhere near all of rustbuild. The current
tests are also not checked for "correctness," rather, they simply
represent what we do as of this commit, which may be wrong.

Test cases are drawn from the old implementation of rustbuild, though
the expected results may vary.
2018-04-03 11:41:50 -06:00
Mark Simulacrum cd33d3a0e4 Stub out various functions during testing 2018-04-03 11:39:16 -06:00
Mark Simulacrum a5e56b62c5 Permit constructing Builder without executing 2018-04-03 11:39:16 -06:00
Petr Hosek c6bae16dc2 Only include space in RUSTFLAGS extra flags if not empty
When the RUSTFLAGS_STAGE_{1,2} is not set, including a space means
the string will always be non-empty and RUSTFLAGS will be always be
reset which breaks other ways of setting these such as through config
in CARGO_HOME.
2018-03-30 19:37:08 -07:00
kennytm 311814a1a9
Rollup merge of #49193 - davidtwco:issue-29893, r=alexcrichton
Host compiler documentation

Fixes #29893. Rust Central Station PR: rust-lang/rust-central-station#40

r? @alexcrichton
2018-03-25 01:26:33 +08:00
Alex Crichton 7df6f4161c rustc: Add a `#[wasm_custom_section]` attribute
This commit is an implementation of adding custom sections to wasm artifacts in
rustc. The intention here is to expose the ability of the wasm binary format to
contain custom sections with arbitrary user-defined data. Currently neither our
version of LLVM nor LLD supports this so the implementation is currently custom
to rustc itself.

The implementation here is to attach a `#[wasm_custom_section = "foo"]`
attribute to any `const` which has a type like `[u8; N]`. Other types of
constants aren't supported yet but may be added one day! This should hopefully
be enough to get off the ground with *some* custom section support.

The current semantics are that any constant tagged with `#[wasm_custom_section]`
section will be *appended* to the corresponding section in the final output wasm
artifact (and this affects dependencies linked in as well, not just the final
crate). This means that whatever is interpreting the contents must be able to
interpret binary-concatenated sections (or each constant needs to be in its own
custom section).

To test this change the existing `run-make` test suite was moved to a
`run-make-fulldeps` folder and a new `run-make` test suite was added which
applies to all targets by default. This test suite currently only has one test
which only runs for the wasm target (using a node.js script to use `WebAssembly`
in JS to parse the wasm output).
2018-03-22 13:16:38 -07:00
bors 5092c6b01a Auto merge of #49264 - kennytm:rollup, r=kennytm
Rollup of 23 pull requests

- Successful merges: #48374, #48596, #48759, #48939, #49029, #49069, #49093, #49109, #49117, #49140, #49158, #49188, #49189, #49209, #49211, #49216, #49225, #49231, #49234, #49242, #49244, #49105, #49038
- Failed merges:
2018-03-22 16:58:57 +00:00
David Wood 178652a298
Add support to rustbuild for a 'rustc docs' component tarball 2018-03-21 19:02:53 +00:00
John Kåre Alsaker 859640a3ca Run the `run-make` tests last, so more tests run on Windows when `make` is unavailable 2018-03-20 15:33:22 +01:00
Alex Crichton 1b5eb17d61 ci: Print out how long each step takes on CI
This commit updates CI configuration to inform rustbuild that it should print
out how long each step takes on CI. This'll hopefully allow us to track the
duration of steps over time and follow regressions a bit more closesly (as well
as have closer analysis of differences between two builds).

cc #48829
2018-03-20 07:17:37 -07:00
kennytm 2a7dac05e7
Rollup merge of #48943 - comex:verbose, r=kennytm
Support extra-verbose builds

- The bootstrap crate currently passes -v to Cargo if itself invoked with -vv.  But Cargo supports -vv (to show build script output), so make bootstrap pass that if itself invoked with -vvv.  (More specifically, pass N '-v's to Cargo if invoked with N+1 of them.)

- bootstrap.py currently tries to pass on up to two '-v's to cargo when building bootstrap, but incorrectly ('-v' is marked as 'store_true', so argparse stores either False or True, ignoring multiple '-v's).  Fix this, allow passing any number of '-v's, and make it consistent with bootstrap's invocation of Cargo (i.e. subtract one from the number of '-v's).

- Also improve bootstrap.py's config.toml 'parsing' to support arbitrary verbosity levels, + allow command line to override it.
2018-03-17 17:20:41 +08:00
QuietMisdreavus bda584386e re-enable resting librustdoc 2018-03-16 11:38:06 -05:00
comex ec49234f44 Support extra-verbose builds:
- The bootstrap crate currently passes -v to Cargo if itself invoked
with -vv.  But Cargo supports -vv (to show build script output), so make
bootstrap pass that if itself invoked with -vvv.  (More specifically,
pass N '-v's to Cargo if invoked with N+1 of them.)

- bootstrap.py currently tries to pass on up to two '-v's to cargo when
building bootstrap, but incorrectly ('-v' is marked as 'store_true', so
argparse stores either False or True, ignoring multiple '-v's).  Fix
this, allow passing any number of '-v's, and make it consistent with
bootstrap's invocation of Cargo (i.e. subtract one from the number of
'-v's).

- Also improve bootstrap.py's config.toml 'parsing' to support arbitrary
verbosity levels, + allow command line to override it.
2018-03-15 17:17:10 -07:00
kennytm 68a602efa9
Rollup merge of #48892 - alexcrichton:thinlto-again, r=Mark-Simulacrum
rustbuild: Remove ThinLTO-related configuration

This commit removes some ThinLTO/codegen unit cruft primarily only needed during
the initial phase where we were adding ThinLTO support to rustc itself. The
current bootstrap compiler knows about ThinLTO and has it enabled by default for
multi-CGU builds which are also enabled by default. One CGU builds (aka
disabling ThinLTO) can be achieved by configuring the number of codegen units to
1 for a particular builds.

This also changes the defaults for our dist builders to go back to multiple
CGUs. Unfortunately we're seriously bleeding for cycle time on the bots right
now so we need to recover any time we can.
2018-03-16 01:49:41 +08:00
bors 178becdd7c Auto merge of #48549 - alexcrichton:update-cargo, r=Mark-Simulacrum
Update Cargo submodule

Hopefully a routine update...
2018-03-11 20:28:34 +00:00
Alex Crichton 994bfd4141 Update Cargo submodule
Required moving all fulldeps tests depending on `rand` to different locations as
now there's multiple `rand` crates that can't be implicitly linked against.
2018-03-11 10:59:28 -07:00
Alex Crichton ff227c4a2d rustbuild: Remove ThinLTO-related configuration
This commit removes some ThinLTO/codegen unit cruft primarily only needed during
the initial phase where we were adding ThinLTO support to rustc itself. The
current bootstrap compiler knows about ThinLTO and has it enabled by default for
multi-CGU builds which are also enabled by default. One CGU builds (aka
disabling ThinLTO) can be achieved by configuring the number of codegen units to
1 for a particular builds.

This also changes the defaults for our dist builders to go back to multiple
CGUs. Unfortunately we're seriously bleeding for cycle time on the bots right
now so we need to recover any time we can.
2018-03-09 13:21:37 -08:00
Mark Simulacrum 29a852970b Refactor run_host_only to have the proper effect.
Previously it was set to true when we didn't run HOSTS steps.
2018-03-08 20:30:00 -07:00
Mark Simulacrum 1c8f3b011c Remove ONLY_BUILD.
All uses are replaced with not accessing run.target/run.host, and
instead directly using run.builder.build.build.
2018-03-08 20:30:00 -07:00