Commit Graph

168 Commits

Author SHA1 Message Date
David Tolnay 6a3aae8aea
Add flag to open docs: x.py doc --open
Tested with:

       # opens doc/index.html
    x.py doc --stage 0 --open
    x.py doc --stage 0 --open src/doc

       # opens doc/book/index.html
    x.py doc --stage 0 --open src/doc/book

       # opens doc/std/index.html
    x.py doc --stage 0 --open src/libstd

       # opens doc/proc_macro/index.html
    x.py doc --stage 0 --open src/libproc_macro

       # opens both
    x.py doc --stage 0 --open src/libstd src/libproc_macro
2020-05-21 21:42:38 -07:00
Eric Huss d6336dfe01 Add an index page for nightly rustc docs. 2020-04-29 08:16:39 -07:00
Nicholas Nethercote a105c5c2c0 Build libstd with `-Cbitcode-in-rlib=yes`.
So that the rlibs will work with both LTO and non-LTO builds.
2020-04-22 15:22:18 +10:00
Alex Tokarev da5d03d09e Add missing -Z unstable-options flag 2020-03-21 19:19:54 +01:00
Matthias Krüger 5f979e9afa bootstrap: fix clippy warnings 2020-02-03 20:26:36 +01:00
bors e621797264 Auto merge of #65241 - tmiasko:no-std-san, r=alexcrichton
build-std compatible sanitizer support

### Motivation

When using `-Z sanitizer=*` feature it is essential that both user code and
standard library is instrumented. Otherwise the utility of sanitizer will be
limited, or its use will be impractical like in the case of memory sanitizer.

The recently introduced cargo feature build-std makes it possible to rebuild
standard library with arbitrary rustc flags. Unfortunately, those changes alone
do not make it easy to rebuild standard library with sanitizers, since runtimes
are dependencies of std that have to be build in specific environment,
generally not available outside rustbuild process. Additionally rebuilding them
requires presence of llvm-config and compiler-rt sources.

The goal of changes proposed here is to make it possible to avoid rebuilding
sanitizer runtimes when rebuilding the std, thus making it possible to
instrument standard library for use with sanitizer with simple, although
verbose command:

```
env CARGO_TARGET_X86_64_UNKNOWN_LINUX_GNU_RUSTFLAGS=-Zsanitizer=thread cargo test -Zbuild-std --target x86_64-unknown-linux-gnu
```

### Implementation

* Sanitizer runtimes are no long packed into crates. Instead, libraries build
  from compiler-rt are used as is, after renaming them into `librusc_rt.*`.
* rustc obtains runtimes from target libdir for default sysroot, so that
  they are not required in custom build sysroots created with build-std.
* The runtimes are only linked-in into executables to address issue #64629.
  (in previous design it was hard to avoid linking runtimes into static
  libraries produced by rustc as demonstrated by sanitizer-staticlib-link
  test, which still passes despite changes made in #64780).

cc @kennytm, @japaric, @firstyear, @choller
2020-01-10 23:26:21 +00:00
Yuki Okushi bcfb380634
Rollup merge of #68075 - ollie27:rustbuild_books, r=Mark-Simulacrum
rustbuild: Cleanup book generation

The Cargo book can be generated the same way as the other books.
2020-01-11 04:50:56 +09:00
Oliver Middleton 870ca31408 rustbuild: Cleanup book generation
The Cargo book can be generated the same way as the other books.
2020-01-09 23:57:01 +00:00
Tomasz Miąsko ae57259403 Add bootstrap step for building sanitizer runtimes 2020-01-09 07:54:02 +01:00
Andy Russell 826780772e
remove strip-hidden pass from compiler doc generation 2020-01-08 21:43:54 -05:00
Mark Rousskov a06baa56b9 Format the world 2019-12-22 17:42:47 -05:00
Alex Crichton 91b25a84df
Fix some linking of LLVM's dynamic library
Ensure it shows up in the same places it did before so tools can find it
at runtime.
2019-12-11 09:50:11 -05:00
Alex Crichton 7f23e6e8d7
rustc: Link LLVM directly into rustc again
This commit builds on #65501 continue to simplify the build system and
compiler now that we no longer have multiple LLVM backends to ship by
default. Here this switches the compiler back to what it once was long
long ago, which is linking LLVM directly to the compiler rather than
dynamically loading it at runtime. The `codegen-backends` directory of
the sysroot no longer exists and all relevant support in the build
system is removed. Note that `rustc` still supports a dynamically loaded
codegen backend as it did previously, it just no longer supports
dynamically loaded codegen backends in its own sysroot.

Additionally as part of this the `librustc_codegen_llvm` crate now once
again explicitly depends on all of its crates instead of implicitly
loading them through the sysroot. This involved filling out its
`Cargo.toml` and deleting all the now-unnecessary `extern crate`
annotations in the header of the crate. (this in turn required adding a
number of imports for names of macros too).

The end results of this change are:

* Rustbuild's build process for the compiler as all the "oh don't forget
  the codegen backend" checks can be easily removed.
* Building `rustc_codegen_llvm` is much simpler since it's simply
  another compiler crate.
* Managing the dependencies of `rustc_codegen_llvm` is much simpler since
  it's "just another `Cargo.toml` to edit"
* The build process should be a smidge faster because there's more
  parallelism in the main rustc build step rather than splitting
  `librustc_codegen_llvm` out to its own step.
* The compiler is expected to be slightly faster by default because the
  codegen backend does not need to be dynamically loaded.
* Disabling LLVM as part of rustbuild is still supported, supporting
  multiple codegen backends is still supported, and dynamic loading of a
  codegen backend is still supported.
2019-12-11 09:50:11 -05:00
Alex Crichton 0b6766d8d7 Allow adding `RUSTFLAGS` after `Builder::cargo`
This commit changes the return type of `Builder::cargo` to return a
builder that allows dynamically adding more `RUSTFLAGS` values
after-the-fact. While not used yet, this will later be used to delete
more of `rustc.rs`
2019-09-23 09:34:44 -07:00
Alex Crichton d7f64749c0 rustbuild: Copy crate doc files fewer times
Previously when building documentation for the standard library we'd
copy all the files 5 times, and these files include libcore/libstd docs
which are huge! This commit instead only copies the files after rustdoc
has been run for each crate, reducing the number of redundant copies
we're making.
2019-09-19 08:37:53 -07:00
bors 815dec9db1 Auto merge of #63869 - GuillaumeGomez:fix-build-failure, r=Mark-Simulacrum
Fix build failure in case file doesn't exist

It fixes the following issue:

```bash
$ ./x.py test src/tools/linkchecker ./build/x86_64-apple-darwin/doc/ --stage 1
Updating only changed submodules
Submodules updated in 0.05 seconds
    Finished dev [unoptimized] target(s) in 0.15s
thread 'main' panicked at 'source "/Users/imperio/rust/rust/build/x86_64-apple-darwin/doc/version_info.html" failed to get metadata: No such file or directory (os error 2)', src/build_helper/lib.rs:179:19
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace.
failed to run: /Users/imperio/rust/rust/build/bootstrap/debug/bootstrap test src/tools/linkchecker ./build/x86_64-apple-darwin/doc/ --stage 1
Build completed unsuccessfully in 0:00:01
```

If the file doesn't exist, it makes sense anyway to just run the command in order to generate it.

r? @Mark-Simulacrum
2019-09-03 04:33:08 +00:00
Guillaume Gomez a80ab3a2f8 Generate version file if it doesn't exist 2019-09-02 14:13:36 +02:00
Yuki Okushi 661141f808 Fix build src/libtest 2019-08-28 00:32:21 +09:00
Alex Crichton b47c9690d2 bootstrap: Merge the libtest build step with libstd
Since its inception rustbuild has always worked in three stages: one for
libstd, one for libtest, and one for rustc. These three stages were
architected around crates.io dependencies, where rustc wants to depend
on crates.io crates but said crates don't explicitly depend on libstd,
requiring a sysroot assembly step in the middle. This same logic was
applied for libtest where libtest wants to depend on crates.io crates
(`getopts`) but `getopts` didn't say that it depended on std, so it
needed `std` built ahead of time.

Lots of time has passed since the inception of rustbuild, however,
and we've since gotten to the point where even `std` itself is depending
on crates.io crates (albeit with some wonky configuration). This
commit applies the same logic to the two dependencies that the `test`
crate pulls in from crates.io, `getopts` and `unicode-width`. Over the
many years since rustbuild's inception `unicode-width` was the only
dependency picked up by the `test` crate, so the extra configuration
necessary to get crates building in this crate graph is unlikely to be
too much of a burden on developers.

After this patch it means that there are now only two build phasese of
rustbuild, one for libstd and one for rustc. The libtest/libproc_macro
build phase is all lumped into one now with `std`.

This was originally motivated by rust-lang/cargo#7216 where Cargo was
having to deal with synthesizing dependency edges but this commit makes
them explicit in this repository.
2019-08-23 16:46:11 -07:00
Mark Rousskov 72e2cfd934 Remove serialization of diagnostics to files
This is no longer used by the index generator and was always an unstable
compiler detail, so strip it out.

This also leaves in RUSTC_ERROR_METADATA_DST since the stage0 compiler
still needs it to be set.
2019-08-20 09:55:31 -04:00
Eric Huss 04538c680c Update mdbook, cargo, books
This updates the last of the books using mdbook 0.1, finally
removing it from the build.
2019-07-17 12:46:36 -07:00
Eric Huss 2dafa91310 Update mdbook 2019-06-20 19:47:44 -07:00
Mark Rousskov d728d27ef3 Remove unnecessary Std dependency 2019-06-13 08:57:55 -06:00
Mark Rousskov 92f5e58ccc Delete Rustbook step
There's no need to have it given it merely forwarded to RustbookSrc.
2019-06-13 08:57:55 -06:00
Mateusz Mikuła 7d3211339b Migrate rust-by-example to MdBook2 2019-06-11 11:49:38 +02:00
Mateusz Mikuła dacf19cb59 Migrate nomicon book to MdBook2 2019-05-30 14:30:59 +02:00
Mateusz Mikuła 5f929be162 Migrate rustdoc book to MdBook2 2019-05-30 14:22:33 +02:00
Mateusz Mikuła 3ffab36462 Migrate unstable-book to MdBook2 2019-05-30 13:59:12 +02:00
bors 19e0ddbb9f Auto merge of #61212 - alexcrichton:skip-rustc, r=pietroalbini
ci: Attempt to skip a full rustc compile on dist*

Currently when we're preparing cross-compiled compilers it can take
quite some time because we have to build the compiler itself three
different times. The first is the normal bootstrap, the second is a
second build for the build platform, and the third is the actual target
architecture compiler. The second compiler was historically built
exclusively for procedural macros, and long ago we didn't actually need
it.

This commit tries out avoiding that second compiled compiler, meaning we
only compile rustc for the build platform only once. Some local testing
shows that this is promising, but bors is of course the ultimate test!
2019-05-30 00:38:51 +00:00
Alex Crichton f7cc467b59 rustbuild: Tweak how stage1 compilers are selected
This commit furthers the previous one to ensure that we don't build an
extra stage of the compiler in CI. A test has been added to rustbuild to
ensure that this doesn't regress, and then in debugging this test it was
hunted down that the `dist::Std` target was the one erroneously pulling
in the wrong compiler.

The `dist::Std` step was updated to instead account for the "full
bootstrap" or not flag, ensuring that the correct compiler for compiling
the final standard library was used. This was another use of the
`force_use_stage1` function which was in theory supposed to be pretty
central, so existing users were all evaluated and a new function,
`Builder::compiler_for`, was introduced. All existing users of
`force_use_stage1` have been updated to use `compiler_for`, where the
semantics of `compiler_for` are similar to that of `compiler` except
that it doesn't guarantee the presence of a sysroot for the arguments
passed (as they may be modified).

Perhaps one day we can unify `compiler` and `compiler_for`, but the
usage of `Builder::compiler` is so ubiquitous it would take quite some
time to evaluate whether each one needs the sysroot or not, so it's
hoped that can be done in parallel.
2019-05-28 11:23:53 -07:00
Andy Russell c95be3d033
strip synstructure consts from compiler docs 2019-05-16 14:32:28 -04:00
Andy Russell b2f71fb540
remove unneeded `extern crate`s from build tools 2019-05-09 12:03:13 -04:00
Carol (Nichols || Goulding) 023487867c
Update TRPL to use mdbook 0.2 2019-04-11 07:56:25 -04:00
Mazdak Farrokhzad 20f063a939
Rollup merge of #58848 - GuillaumeGomez:fix-cache-issues, r=Mark-Simulacrum,ollie27
Prevent cache issues on version updates

Fixes #58827.

cc @rust-lang/infra
2019-03-28 08:43:30 +01:00
Guillaume Gomez 5652dd677c Fix error index CSS file name 2019-03-26 23:57:16 +01:00
Guillaume Gomez 2d6745de0e Add resource suffix for libtest and proc_macro as well 2019-03-26 22:29:30 +01:00
Guillaume Gomez 080a8e7a71 Prevent cache issues on version updates 2019-03-26 22:29:30 +01:00
Guillaume Gomez 3747868889
Rollup merge of #59197 - kornelski:redir, r=steveklabnik
Exclude old book redirect stubs from search engines

Adds `<meta name="robots" content="noindex,follow">` to the `<head>` of old stub pages pointing to the second edition of the book.

This is continuation of https://github.com/rust-lang/book/pull/1788
2019-03-26 22:26:40 +01:00
Kornel 8b5a748d50 Exclude old book redirect stubs from search engines 2019-03-14 22:56:38 +00:00
Mark Rousskov 03718ed67a Permit getting stage 0 rustdoc
This allows us to e.g. test compiletest, including doctests, in stage 0
without building a fresh compiler and rustdoc.
2019-03-03 16:32:57 -07:00
Mark Rousskov 9efc93c96d Tools built by the bootstrap compiler must be built by it
This avoids building compilers that we don't need -- most tools will work
just fine with the downloaded compiler.
2019-03-03 16:32:57 -07:00
Eric Huss 3aca176fb2 Update edition-guide 2019-02-27 21:09:10 -08:00
Taiki Endo 6343d6bc0d bootstrap: deny(rust_2018_idioms) 2019-02-25 19:30:32 +09:00
kennytm f8ccdeb0d4
Rollup merge of #57929 - GuillaumeGomez:rustodc-remove-old-style-files, r=ollie27
Rustdoc remove old style files

Reopening of #56577 (which I can't seem to reopen...).

I made the flag unstable so with this change, what was blocking the PR is now gone I assume.
2019-02-17 14:52:21 +08:00
Alexander Regueiro c3e182cf43 rustc: doc comments 2019-02-10 23:42:32 +00:00
James Munns 606e5e07f6 Add embedded book 2019-02-04 05:20:43 -05:00
Guillaume Gomez 397eb4f237 Add missing generation for test and proc_macro, remove old macro redirection 2019-01-31 23:11:14 +01:00
James Munns b98a1e1710 No consumers of MdBook2 yet 2019-01-30 09:13:17 -05:00
James Munns 7389f97cde Only the compatibility items from the embedded book PR
PR: https://github.com/rust-lang/rust/pull/56291
2019-01-30 09:13:17 -05:00
Guillaume Gomez 270151bffb Add generate-old-style-files option to rustdoc 2019-01-27 12:46:18 +01:00