`./x doc` with Rustdoc JSON output panics
Nobody has claimed this yet.
- Dominant language
- Rust
- Stars
- 119k
- Forks
- 16.1k
- PR merge metrics
- PR metrics pending
Description
Summary
Building the compiler crates with Rustdoc's unstable JSON output causes bootstrap to panic.
Command used
RUSTDOCFLAGS="--output-format=json" ./x doc compiler/
Expected behaviour
The process exits successfully without panicking.
Actual behaviour
The process panics with the following error message:
thread 'main' (36449512) panicked at src/bootstrap/src/core/build_steps/doc.rs:969:57:
called `Result::unwrap()` on an `Err` value: Os { code: 2, kind: NotFound, message: "No such file or directory" }
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
Note that the JSON output is still built as expected, even though bootstrap panics afterwards. The line that panics is this:
Bootstrap configuration (bootstrap.toml)
change-id = "ignore"
[build]
locked-deps = true
Operating system
MacOS 15.7.2
HEAD
b6d7ff3aa71e48e2901b0900f8b5d98126b537ed, although I've hit this error in older commits as well.
Additional context
I've tried using both the ./x doc --json and ./x doc --json-output flags, but neither seem to build the JSON output, unlike setting RUSTDOCFLAGS="--output-format=json". Do --json and --json-output do the same thing?
Build Log
thread 'main' (36452285) panicked at src/bootstrap/src/core/build_steps/doc.rs:969:57:
called `Result::unwrap()` on an `Err` value: Os { code: 2, kind: NotFound, message: "No such file or directory" }
stack backtrace:
0: __rustc::rust_begin_unwind
at /rustc/3b4dd9bf1410f8da6329baa36ce5e37673cbbd1f/library/std/src/panicking.rs:698:5
1: core::panicking::panic_fmt
at /rustc/3b4dd9bf1410f8da6329baa36ce5e37673cbbd1f/library/core/src/panicking.rs:80:14
2: core::result::unwrap_failed
at /rustc/3b4dd9bf1410f8da6329baa36ce5e37673cbbd1f/library/core/src/result.rs:1862:5
3: core::result::Result<T,E>::unwrap
at /rustc/3b4dd9bf1410f8da6329baa36ce5e37673cbbd1f/library/core/src/result.rs:1233:23
4: <bootstrap::core::build_steps::doc::Rustc as bootstrap::core::builder::Step>::run
at ./src/bootstrap/src/core/build_steps/doc.rs:969:57
5: bootstrap::core::builder::Builder::ensure
at ./src/bootstrap/src/core/builder/mod.rs:1605:36
6: <bootstrap::core::build_steps::doc::Rustc as bootstrap::core::builder::Step>::make_run
at ./src/bootstrap/src/core/build_steps/doc.rs:872:21
7: bootstrap::core::builder::StepDescription::maybe_run
at ./src/bootstrap/src/core/builder/mod.rs:465:13
8: bootstrap::core::builder::cli_paths::match_paths_to_steps_and_run
at ./src/bootstrap/src/core/builder/cli_paths.rs:231:18
9: bootstrap::core::builder::Builder::run_step_descriptions
at ./src/bootstrap/src/core/builder/mod.rs:1148:9
10: bootstrap::core::builder::Builder::execute_cli
at ./src/bootstrap/src/core/builder/mod.rs:1127:14
11: bootstrap::Build::build
at ./src/bootstrap/src/lib.rs:800:25
12: bootstrap::main
at ./src/bootstrap/src/bin/main.rs:130:11
13: core::ops::function::FnOnce::call_once
at /rustc/3b4dd9bf1410f8da6329baa36ce5e37673cbbd1f/library/core/src/ops/function.rs:250:5
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.
Traceback (most recent call last):
File "/rust/x.py", line 53, in <module>
bootstrap.main()
~~~~~~~~~~~~~~^^
File "/rust/src/bootstrap/bootstrap.py", line 1410, in main
bootstrap(args)
~~~~~~~~~^^^^^^
File "/rust/src/bootstrap/bootstrap.py", line 1370, in bootstrap
run(args, env=env, verbose=build.verbose, is_bootstrap=True)
~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/rust/src/bootstrap/bootstrap.py", line 237, in run
raise RuntimeError(err)
RuntimeError: failed to run: /rust/build/bootstrap/debug/bootstrap doc --verbose compiler
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reproducing RUSTDOCFLAGS="--output-format=json" ./x doc compiler/ and reading src/bootstrap/src/core/build_steps/doc.rs around line 969, where the panic occurs. Compare the documented ./x doc --json and --json-output entry points with the Rustdoc JSON path; done means compiler documentation builds successfully and exits without a panic.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- build-system, compilers
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 45/100