rust icon indicating copy to clipboard operation
rust copied to clipboard

Distribute json doc

Open LukeMathWalker opened this issue 3 years ago • 23 comments

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

LukeMathWalker avatar Sep 14 '22 12:09 LukeMathWalker

Thanks for the pull request, and welcome! The Rust team is excited to review your changes, and you should hear from @jyn514 (or someone else) soon.

Please see the contribution instructions for more information.

rust-highfive avatar Sep 14 '22 12:09 rust-highfive

The job x86_64-gnu-llvm-13 failed! Check out the build log: (web) (plain)

Click to see the possible cause of the failure (guessed by this bot)

rust-log-analyzer avatar Sep 14 '22 13:09 rust-log-analyzer

cc @Mark-Simulacrum

GuillaumeGomez avatar Sep 14 '22 13:09 GuillaumeGomez

@rustbot modify labels: +A-rustdoc-json

aDotInTheVoid avatar Sep 14 '22 14:09 aDotInTheVoid

@rustbot author

jyn514 avatar Sep 14 '22 22:09 jyn514

The job mingw-check failed! Check out the build log: (web) (plain)

Click to see the possible cause of the failure (guessed by this bot)
   Compiling toml v0.5.9
error[E0382]: borrow of moved value: `run`
   --> dist.rs:100:55
    |
99  |     fn should_run(run: ShouldRun<'_>) -> ShouldRun<'_> {
    |                   --- move occurs because `run` has type `ShouldRun<'_>`, which does not implement the `Copy` trait
100 |         run.alias("rust-json-docs").default_condition(run.builder.config.docs)
    |             |
    |             |
    |             `run` moved due to this method call
    |
note: this function takes ownership of the receiver `self`, which moves `run`
    |
    |
438 |     pub fn alias(mut self, alias: &str) -> Self {
    |                      ^^^^
    = note: borrow occurs due to deref coercion to `Build`
note: deref defined here
    |
47  |     type Target = Build;
    |     ^^^^^^^^^^^

rust-log-analyzer avatar Sep 15 '22 11:09 rust-log-analyzer

@rustbot label -S-waiting-on-author +S-waiting-on-review

LukeMathWalker avatar Sep 15 '22 12:09 LukeMathWalker

The job mingw-check failed! Check out the build log: (web) (plain)

Click to see the possible cause of the failure (guessed by this bot)
configure: rust.debug-assertions := True
configure: rust.overflow-checks := True
configure: llvm.assertions      := True
configure: dist.missing-tools   := True
configure: build.configure-args := ['--enable-sccache', '--disable-manage-submodu ...
configure: writing `config.toml` in current directory
configure: 
configure: run `python /checkout/x.py --help`
Attempting with retry: make prepare
---
Build completed successfully in 0:03:30
+ RUSTDOCFLAGS=--document-private-items python3 ../x.py doc --stage 0 library/test
Building rustbuild
    Finished dev [unoptimized] target(s) in 0.05s
thread 'main' panicked at 'fs::copy(builder.src.join("src/doc/rust.css"), out.join("rust.css")) failed with No such file or directory (os error 2)', doc.rs:437:9
Build completed unsuccessfully in 0:00:00

rust-log-analyzer avatar Sep 15 '22 14:09 rust-log-analyzer

r=me with that last comment addressed and the commits squashed :) thanks for sticking with this!

jyn514 avatar Sep 15 '22 18:09 jyn514

r? @jyn514

LukeMathWalker avatar Sep 16 '22 09:09 LukeMathWalker

Thank you for guiding me through it @jyn514!

LukeMathWalker avatar Sep 16 '22 09:09 LukeMathWalker

@bors r+

jyn514 avatar Sep 16 '22 14:09 jyn514

:pushpin: Commit ccd4383ad79f2306ba74b921d1222e689c27475c has been approved by jyn514

It is now in the queue for this repository.

bors avatar Sep 16 '22 14:09 bors

@bors r- probably failed in a rollup: https://github.com/rust-lang/rust/pull/101941#issuecomment-1250101138

matthiaskrgr avatar Sep 17 '22 17:09 matthiaskrgr

I've added a check before attempting the deletion (alternatively I can add try_remove_dir method and handle the error that is returned). @rustbot label -S-waiting-on-author +S-waiting-on-review

LukeMathWalker avatar Sep 17 '22 18:09 LukeMathWalker

I noticed that after this change we'll print documenting std twice. Can you fix that while you're at it?

jyn514 avatar Sep 17 '22 18:09 jyn514

Fixed it! @jyn514

LukeMathWalker avatar Sep 17 '22 19:09 LukeMathWalker

@bors r+

jyn514 avatar Sep 17 '22 20:09 jyn514

:pushpin: Commit 235dccef2b8012e7d9da87f4b6091912d802cff2 has been approved by jyn514

It is now in the queue for this repository.

bors avatar Sep 17 '22 20:09 bors

:hourglass: Testing commit 235dccef2b8012e7d9da87f4b6091912d802cff2 with merge 8b5ebc275c2ef02347a6a6c1496ea49b411259bd...

bors avatar Sep 18 '22 06:09 bors

:broken_heart: Test failed - checks-actions

bors avatar Sep 18 '22 06:09 bors

A job failed! Check out the build log: (web) (plain)

Click to see the possible cause of the failure (guessed by this bot)

rust-log-analyzer avatar Sep 18 '22 06:09 rust-log-analyzer

curl: (56) OpenSSL SSL_read: Connection reset by peer, errno 54

@bors retry

jyn514 avatar Sep 18 '22 14:09 jyn514

:hourglass: Testing commit 235dccef2b8012e7d9da87f4b6091912d802cff2 with merge c8e12cc8bf0de646234524924f39c85d9f3c7c37...

bors avatar Sep 19 '22 02:09 bors

:sunny: Test successful - checks-actions Approved by: jyn514 Pushing c8e12cc8bf0de646234524924f39c85d9f3c7c37 to master...

bors avatar Sep 19 '22 04:09 bors

Finished benchmarking commit (c8e12cc8bf0de646234524924f39c85d9f3c7c37): comparison URL.

Overall result: no relevant changes - no action needed

@rustbot label: -perf-regression

Instruction count

This benchmark run did not return any relevant results for this metric.

Max RSS (memory usage)

Results

This is a less reliable metric that may be of interest but was not used to determine the overall result at the top of this comment.

mean[^1] range count[^2]
Regressions ❌
(primary)
- - 0
Regressions ❌
(secondary)
2.6% [1.9%, 3.4%] 2
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
-2.7% [-2.8%, -2.5%] 2
All ❌✅ (primary) - - 0

Cycles

This benchmark run did not return any relevant results for this metric.

[^1]: the arithmetic mean of the percent change [^2]: number of relevant changes

rust-timer avatar Sep 19 '22 06:09 rust-timer