Commit Graph

203 Commits

Author SHA1 Message Date
Michael Howell fdb3e820b1 Add a `disable-minification` option for rustdoc
This way, you can debug rustdoc's JavaScript and CSS file
with normal F12 Dev Tools and you'll have useful line numbers
to work with.
2021-03-12 12:25:16 -07:00
Nixon Enraght-Moony 3e177a8e9d output rdj docs 2021-02-06 09:16:58 +00:00
Eric Huss 071d22760a rustbuild: Don't build compiler twice for error-index-generator. 2021-01-31 10:25:29 -08:00
Mark Rousskov fe031180d0 Bump bootstrap compiler to 1.50 beta 2020-12-30 09:27:19 -05:00
Dylan DPC 18be436550
Rollup merge of #80362 - jyn514:rustc-macros, r=ehuss
Document rustc_macros on nightly-rustc

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

![image](https://user-images.githubusercontent.com/23638587/103113442-b7ba2d00-4628-11eb-8a4d-c542f2d170e1.png)
![image](https://user-images.githubusercontent.com/23638587/103113448-bc7ee100-4628-11eb-8657-2d72e88de656.png)

r? ``@ehuss``
2020-12-28 14:13:16 +01:00
Joshua Nelson 82acbc8a49 Document rustc_macros on nightly-rustc 2020-12-24 20:25:40 -05:00
Eric Huss a6d377d565 Include rustdoc in the compiler docs index. 2020-12-22 16:33:36 -08:00
Joshua Nelson 9df0348299 Fix building compiler docs with stage 0 2020-12-12 17:31:35 -05: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
Joshua Nelson 95a6427d2c Add -Z normalize-docs and enable it for compiler docs 2020-11-29 17:21:24 -05:00
Eric Huss d2d91b42a5 lint-docs: Add --validate flag to validate lint docs separately. 2020-11-28 13:39:02 -08:00
12101111 b989d46b48 Support enable/disable sanitizers/profiler per target 2020-10-26 10:34:07 +08: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
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
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
Eric Huss 9dad908145 Fix generating rustc docs with non-default lib directory. 2020-09-14 14:42:56 -07: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
mark 9e5f7d5631 mv compiler to compiler/ 2020-08-30 18:45:07 +03:00
Matthias Krüger 108a3f8a5c bootstrap: fix a couple of clippy lint warnings
clippy::print_literal
clippy::clone_on_copy
clippy::single_char_pattern
clippy::into_iter_on_ref
clippy::match_like_matches_macro
2020-08-22 01:08:04 +02:00
Tomasz Miąsko 6b4c739f92 Fix opening docs for std crates with ./x.py doc --open library/*
The directories for core, alloc, std, proc_macro, and test crates now
correspond directly to the crate name and stripping the "lib" prefix is
no longer necessary.
2020-07-29 12:46:04 +02:00
Mark Rousskov 6726ca2b28 Collect library features from library/ 2020-07-28 13:03:59 -05:00
mark 2c31b45ae8 mv std libs to library/ 2020-07-27 19:51:13 -05:00
Mark Rousskov be43319b17 Do not clobber RUSTDOCFLAGS
We were setting these in both Builder::cargo and here, which ended up only
setting the first of the two.
2020-07-19 10:42:06 -04:00
Jake Goulding e2b337dc57 Teach bootstrap about target files vs target triples
`rustc` allows passing in predefined target triples as well as JSON
target specification files. This change allows bootstrap to have the
first inkling about those differences. This allows building a
cross-compiler for an out-of-tree architecture (even though that
compiler won't work for other reasons).

Even if no one ever uses this functionality, I think the newtype
around the `Interned<String>` improves the readability of the code.
2020-07-17 10:08:04 -04:00
Eric Huss 83344195ee Use local links in the alloc docs. 2020-07-14 23:24:03 -07:00
Tamir Duberstein 62cf767a4a
Avoid "whitelist"
Other terms are more inclusive and precise.
2020-07-10 07:39:28 -04:00
Eric Huss 561d5acb9e Fix occasional bootstrap panic in docs. 2020-07-07 06:37:47 -07:00
Manish Goregaokar 218d96ed6b
Rollup merge of #70563 - GuillaumeGomez:page-hash-handling, r=ollie27,kinnison
[rustdoc] Page hash handling

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

A good example to see the change is to use this URL: https://doc.rust-lang.org/nightly/std/string/struct.String.html#from_iter.v-3

After the change, it actually goes to the target element (and change the page hash to something more clear for the users).

r? @kinnison

cc @ollie27
2020-07-06 17:45:15 -07:00
Guillaume Gomez e955bebcda Remove render-redirect-pages option in rustdoc 2020-07-02 14:14:59 +02:00
Eric Huss 0b9bc79738 Tests for number of times rustdoc is built with x.py test and doc. 2020-07-01 15:51:35 -07:00
Eric Huss 9154863647 Compile rustdoc less often. 2020-06-29 22:35:02 -07:00
Eric Huss 75983e137e Support configurable deny-warnings for all in-tree crates. 2020-06-25 21:17:21 -07:00
Eric Huss 607e85110e Switch bootstrap metadata to --no-deps.
This should run much faster.

There are also some drive-by cleanups here to try to simplify things.
Also, the paths for in-tree crates are now displayed as relative
in `x.py test -h -v`.
2020-06-14 15:57:21 -07:00
David Tolnay 07b1de4e9a
Report error from opener in bootstrap
On my machine, an error looks like:

    Finished release [optimized] target(s) in 0.29s
    Opening doc /git/rust/build/x86_64-unknown-linux-gnu/doc/std/index.html
    command 'xdg-open (internal)' did not execute successfully; exit code: 4
    command stderr:
    gio: file:///git/rust/build/x86_64-unknown-linux-gnu/doc/std/index.html: Error when getting information for file “/git/rust/build/x86_64-unknown-linux-gnu/doc/std/index.html”: No such file or directory

    Build completed successfully in 0:00:08
2020-05-22 09:51:46 -07:00
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