about summary refs log tree commit diff
path: root/src/bootstrap/doc.rs
AgeCommit message (Collapse)AuthorLines
2022-10-26Rollup merge of #102706 - ferrocene:pa-ignore-doc-index, r=jyn514Dylan DPC-18/+48
Support excluding the generation of the standalone docs For Ferrocene we need to exclude the generation of the standalone docs (which include the index page, which we want to replace with our own), but with the way bootstrap is currently implemented that proved not possible. This PR aims to support that. The first problem is that the `doc::Standalone` step did two things: it generated the "standalone" documentation (which includes the index page and all the pages at the root of the documentation tree), but it also generated some files like `rust.css` and `version_info.html` that other step like `doc::TheBook` required. This meant generating the book required generating the index page, which made disabling the index page generation problematic. The approach I took to fix the first problem is to split the step into `doc::Standalone` and `doc::SharedAssets`, with `doc::TheBook` now depending on `doc::SharedAssets`. The second problem is that disabling the `doc::Standalone` proved to be tricky due to its path, `src/doc`. The path is accurate, as the source files for that step are `src/doc/*.md`. The problem is, bootstrap treats `--exclude` as a *suffix*, and so it also excluded the Cargo book whose source lives at `src/tools/cargo/src/doc`. The approach I took to fix the second problem is to add the `standalone` path in addition to `src/doc`, so that you can pass `--exclude standalone`. I'm not fully happy with the solution, and the other idea I had was to just move the standalone docs source code to `src/doc/standalone`. I feel that second approach is cleaner, but also requires more changes and might require more consensus. This PR is best reviewed commit-by-commit. r? `@jyn514`
2022-10-24use the shared assets step for building std tooPietro Albini-1/+2
2022-10-18apply joshua's suggestionPietro Albini-1/+1
Co-authored-by: Joshua Nelson <github@jyn.dev>
2022-10-12Enable `x.py check` for miriOli Scherer-29/+6
2022-10-05add a "standalone" path for doc::Standalone to be able to exclude itPietro Albini-1/+1
Before this commit, the path for the doc::Standalone step was "src/doc", which is accurate as the standalone docs source files live at the root of the "src/doc" directory tree. Unfortunately, that caused bad interactions when trying to exclude it with `--exclude src/doc`. When an exclusion is passed to bootstrap, it will exclude all steps whose path *ends with* the exclusion, which results in the Cargo book (src/tools/cargo/src/doc) to also be excluded. To work around this problem, this commit adds the "standalone" path as an alternate path for doc::Standalone, allowing `--exclude standalone` to work without side effects.
2022-10-05split steps for generating the standalone docs and the shared assetsPietro Albini-16/+45
Before this commit, the step to generate the standalone docs (which included the index page and other HTML files at the root of the documentation) was bundled with the code copying files needed by multiple pieces of documentation. This means it wasn't possible to avoid generating the standalone docs. This commit splits the step into two, allowing the standalone docs generation to be excluded while still building the rest of the docs.
2022-09-24Move style guide to rust-lang/rustJosh Triplett-0/+1
Per [RFC 3309](https://rust-lang.github.io/rfcs/3309-style-team.html).
2022-09-19Auto merge of #101799 - LukeMathWalker:distribute-json-doc, r=jyn514bors-59/+153
Distribute json doc # Overview We add a new component, `rust-json-docs`, to distribute the JSON version of rustdoc's output for public compiler crates (i.e. `std`, `alloc`, `proc_macro`, `core` and `test`). As discussed in #101383, we do not bundle this up as part of the existing `rust-docs` component since `rustdoc`'s JSON format is still unstable. # Open questions / Doubts I tried my best, but I never touched this codebase and I couldn't find much documentation on how `dist` works - I pattern-matched existing code, which might have led to some non-sensical choices in the eyes of people more familiar with the codebase. In particular, I am not sure if my choice of adding a new config flag is appropriate or if the decision to build/not build the JSON docs is more appropriately gated by one of the existing flags. Any suggestion is more than welcome. Closes #101383
2022-09-17Add a new component, `rust-json-docs`, to distribute the JSON-formatted ↵Luca Palmieri-59/+153
documentation for std crates in nightly toolchains. We also add a new flag to `x doc`, `--json`, to render the JSON-formatted version alongside the HTML-formatted one.
2022-09-16Don't add rustdoc's CSS to other doc pagesJacob Hoffman-Andrews-8/+2
This was originally added so those doc pages could use the same font files, but it turns out to be fragile. And those doc pages are just stubs that link to other pages, so they don't need fancy fonts.
2022-08-31Generate error index with mdbook instead of raw HTML pagesGuillaume Gomez-1/+1
2022-07-06Build the Clippy book as part of x.py docflip1995-0/+1
2022-07-05Rollup merge of #95503 - jyn514:build-single-crate, r=Mark-SimulacrumGuillaume Gomez-5/+7
bootstrap: Allow building individual crates This aims to be as unintrusive as possible, but did still require adding a new `tail_args` field to all `Rustc` and `Std` steps. New library and compiler crates are added to the sysroot as they are built, since it's useful to have e.g. just alloc and not std. Fixes https://github.com/rust-lang/rust/issues/44293.
2022-07-03ignore rustdoc failures for out-of-tree toolsRalf Jung-1/+11
2022-07-03Add in_tree macro literalInfRandomness-5/+18
Signed-off-by: InfRandomness <infrandomness@gmail.com>
2022-07-03Add miri to the rustc docs.rs pageInfRandomness-0/+1
This adds miri to https://doc.rust-lang.org/nightly/nightly-rustc/ Signed-off-by: InfRandomness <infrandomness@gmail.com>
2022-07-02Allow building single crates for the compiler and standard libraryJoshua Nelson-5/+7
- Add `Interned<Vec<String>>` and use it for tail args - Refactor `cache.rs` not to need a separate impl for each internable type
2022-05-22Avoid accidentally enabling unstable features in compilers (take 2)Joshua Nelson-0/+4
This allows rustbuild to control whether crates can use nightly features or not. It also prevents rustbuild from using nightly features itself.
2022-04-24Rollup merge of #95504 - jyn514:library-alias, r=Mark-SimulacrumMatthias Krüger-2/+5
Add `x {check,build,doc} {compiler,library}` aliases. While working on https://github.com/rust-lang/rust/pull/95503, I realized that it will interfere with existing command lines: Currently people run `x build library/std` expecting it to "add all library crates to the sysroot", but after that change, it will *only* build `libstd` and its dependencies (and add them to the sysroot), not libtest or libproc_macro. That will work for local testing in most cases, but could be confusing. Even if not, though, I think `x build library` is more clear about what actually happens than the current `x build library/std`. The intended end goal is something like: - For check/build/doc, we have library + compiler aliases, which correspond to basically "most possible" for that piece. This is the intended path of entry (rather than library/test or similar as today) for when you just want the thing to work -- for example, getting a compiler that is "crates.io-compatible" would be roughly `x.py build library`). #95504 - Specific crate invocations build up to that crate, which means that if you don't care about tests you probably want x.py build library/proc_macro or library/std for faster build times. #95503 Note that this is already implemented today for the `doc` command and seems to work pretty well in practice. I plan to change the dev-guide and various instructions in the README to `build library` once this is merged. `@rustbot` label +A-rustbuild
2022-04-14Don't build the library and standard library before documenting themJoshua Nelson-16/+20
Rustdoc doesn't require the build artifacts to generate the docs, and especially in the case of rustc, it greatly increases the time needed to run the build. - Statically ensure that only the top_stage of a tool is documented If another part of rustbuild tried to document a different stage, it would run into errors because `check::Rustc` unconditionally uses the top stage. - Try building rustc instead of checking to avoid duplicate artifacts Tries to workaround the following error: ``` error[E0464]: multiple matching crates for `rustc_ast` --> src/librustdoc/lib.rs:40:1 | 40 | extern crate rustc_ast; | ^^^^^^^^^^^^^^^^^^^^^^^ | = note: candidates: crate `rustc_ast`: /checkout/obj/build/x86_64-unknown-linux-gnu/stage2/lib/rustlib/x86_64-unknown-linux-gnu/lib/librustc_ast-6d7c193782263d89.rlib crate `rustc_ast`: /checkout/obj/build/x86_64-unknown-linux-gnu/stage2/lib/rustlib/x86_64-unknown-linux-gnu/lib/librustc_ast-e5d09eda5beb759c.rmeta ```
2022-03-30Add `x {check,build,doc} {compiler/library}` aliases.Joshua Nelson-2/+5
While working on https://github.com/rust-lang/rust/pull/95503, I realized that this will interfere with existing command lines: Currently people run `x build library/std` expecting it to be added to the sysroot, but after that change, it will *only* build `libstd` without making it available for the toolchain. It's debatable whether that's a breaking change that will be accepted; if so, this PR is absolutely necessary to make sure there's a command for "build the standard library and add it to the sysroot". Even if not, though, I think `x build library` is more clear about what actually happens than the current `x build library/std`. For consistency, also add support for `compiler` and all other command variants. Note that `doc compiler` was already supported, so in a sense this is just fixing an existing inconsistency. I plan to change the dev-guide and various instructions in the README to `build library` once this is merged.
2022-03-30Reduce duplication in `impl Step for doc::Rustc`Joshua Nelson-24/+13
This should have no user-visible change.
2022-03-30Remove dead code in `doc.rs`Joshua Nelson-14/+7
`run` is never called for invalid paths; they get filtered out by `should_run`.
2022-03-30Fix `x doc compiler/rustc`Joshua Nelson-12/+9
This works by mapping the local path to a crate name before trying to fetch crates it depends on.
2022-03-28bootstrap: better error message for no_std docsEric Huss-0/+6
2022-03-05Merge build_helper into utilbjorn3-2/+1
2022-03-05Remove build_helperbjorn3-3/+2
The majority of the code is only used by either rustbuild or rustc_llvm's build script. Rust_build is compiled once for rustbuild and once for every stage. This means that the majority of the code in this crate is needlessly compiled multiple times. By moving only the code actually used by the respective crates to rustbuild and rustc_llvm's build script, this needless duplicate compilation is avoided.
2022-01-21allow excluding paths only from a single modulePietro Albini-4/+4
x.py has support for excluding some steps from the invocation, but unfortunately that's not granular enough: some steps have the same name in different modules, and that prevents excluding only *some* of them. As a practical example, let's say you need to run everything in `./x.py test` except for the standard library tests, as those tests require IPv6 and need to be executed on a separate machine. Before this commit, if you were to just run this: ./x.py test --exclude library/std ...the execution would fail, as that would not only exclude running the tests for the standard library, it would also exclude generating its documentation (breaking linkchecker). This commit adds support for an optional module annotation in --exclude paths, allowing the user to choose which module to exclude from: ./x.py test --exclude test::library/std This maintains backward compatibility, but also allows for more ganular exclusion. More examples on how this works: | `--exclude` | Docs | Tests | | ------------------- | ------- | ------- | | `library/std` | Skipped | Skipped | | `doc::library/std` | Skipped | Run | | `test::library/std` | Run | Skipped | Note that the new behavior only works in the `--exclude` flag, and not in other x.py arguments or flags yet.
2021-11-08Make `compiler-docs` only control the default instead of being a hard off-switchJoshua Nelson-12/+3
This also fixes `x doc src/tools/clippy` when compiler-docs is disabled.
2021-10-28Document clippy on nightly-rustcxFrednet-0/+1
2021-09-27Auto merge of #89182 - GuillaumeGomez:boostrap-explicit-request, ↵bors-17/+14
r=Mark-Simulacrum Simplify explicit request check and allow to run "doc src/librustdoc" even without config set Originally I wanted to allow the command `doc src/librustdoc` to work when passed explicitly but then `@Mark-Simulacrum` recommended me to generalize it, so here we are! r? `@Mark-Simulacrum`
2021-09-24Enable "generate-link-to-definition" option on rust tools docs as wellGuillaume Gomez-0/+1
2021-09-24Simplify explicit request checkGuillaume Gomez-17/+14
2021-09-17Rollup merge of #88666 - GuillaumeGomez:compiler-docs, r=Mark-SimulacrumGuillaume Gomez-10/+53
Improve build command for compiler docs It was rather complicated to document rustc crates. With this, you can directly run: ```console x.py doc compiler x.py doc compiler/rustc_hir_pretty ``` The second commit adds the handling of the `--open` flag. r? `@Mark-Simulacrum`
2021-09-17Correctly handle "--open" option when building compiler docsGuillaume Gomez-0/+9
2021-09-17Allow to pass "compiler" arguments to doc subcommandGuillaume Gomez-10/+44
2021-09-16Enable rustdoc's --generate-link-to-definition for rustc docsGiacomo Stevanato-0/+1
2021-09-11explicitly link to external `ena` docslcnr-0/+8
2021-08-16Document private items for rustfmtJoshua Nelson-12/+3
This is possible now that rustdoc allows passing `--document-private-items` more than once.
2021-07-20Update all submodules that rustbuild doesn't depend on lazilyJoshua Nelson-10/+29
This only updates the submodules the first time they're needed, instead of unconditionally the first time you run x.py. Ideally, this would move *all* submodules and not exclude some tools and backtrace. Unfortunately, cargo requires all `Cargo.toml` files in the whole workspace to be present to build any crate. On my machine, this takes the time for an initial submodule clone (for `x.py --help`) from 55.70 to 15.87 seconds. This uses exactly the same logic as the LLVM update used, modulo some minor cleanups: - Use a local variable for `src.join(relative_path)` - Remove unnecessary arrays for `book!` macro and make the macro simpler to use - Add more comments
2021-07-07Document rustdoc with `--document-private-items`Justus K-4/+10
2021-07-05Auto merge of #86663 - fee1-dead:use-rustdoc-css, r=GuillaumeGomezbors-2/+8
Use rustdoc.css for error index Closes #86512.
2021-07-01Document rustfmt on nightly-rustcJoshua Nelson-5/+11
The recursion_limit attribute avoids the following error: ``` error[E0275]: overflow evaluating the requirement `std::ptr::Unique<rustc_ast::Pat>: std::marker::Send` | = help: consider adding a `#![recursion_limit="256"]` attribute to your crate (`rustfmt_nightly`) ```
2021-06-29Use a macro for documenting rustdocJoshua Nelson-67/+74
2021-06-28Add new tool to check HTML:Guillaume Gomez-2/+2
* Make html-checker run by default on rust compiler docs as well * Ensure html-checker is run on CI * Lazify tidy binary presence check
2021-06-28Make every standalone doc use rustdoc.cssDeadbeef-2/+8
2021-05-24Bootstrap: skip rustdoc fingerprint for building docs.Eric Huss-0/+3
2021-05-15Rollup merge of #85185 - ↵Guillaume Gomez-9/+22
GuillaumeGomez:generate-not-more-docs-than-necessary, r=Mark-Simulacrum Generate not more docs than necessary This is something that `@Nemo157` was talking about: they wanted that when using `x.py doc std`, it only generated `std` (and the crates "before" it). r? `@Mark-Simulacrum`
2021-05-15Don't generate more docs than necessaryGuillaume Gomez-9/+22
2021-05-11Enable `--show-type-layout` for the rustdoc API docsCamelid-0/+1