Change:
running only builds the html doc, but builds the json doc. I expected the json flag to act as the documentation says (): using the master branch of this repo commit running with a library profile.
I can't reproduce this. The files show up for me in .
Seems to reproduce, I could totally have overlooked a step tho
oh no it's even simpler than that lol it's calling the wrong function that should be JsonStd, not Std
Should I make the PR or are you gonna do it ?
If you could make a PR that would be great :)
Made the PR but since just changing the ensure wasn't enough there's a thing I'm unsure about (tested it, worked, but could be cleaner)

Discussion:
use crate::channel; use crate::compile; use crate::config::TargetSelection; <ins> use crate::doc::DocumentationFormat; </ins> use crate::tarball::{GeneratedTarball, OverlayKind, Tarball}; use crate::tool::{self, Tool}; use crate::util::{exe, is_dylib, output, t, timeit};

/// Builds the `rust-docs-json` installer component. fn run(self, builder: &Builder<'_>) -> Option<GeneratedTarball> { let host = self.host; <del> builder.ensure(crate::doc::JsonStd { stage: builder.top_stage, target: host }); </del> <ins> builder.ensure(crate::doc::Std { stage: builder.top_stage, target: host, format: DocumentationFormat::JSON, }); </ins> let dest = "share/doc/rust/json";

pub struct Std { pub stage: u32, pub target: TargetSelection, <ins> pub format: DocumentationFormat, </ins> } impl Step for Std {

} fn make_run(run: RunConfig<'_>) { <del> run.builder.ensure(Std { stage: run.builder.top_stage, target: run.target }); </del> <ins> run.builder.ensure(Std { stage: run.builder.top_stage, target: run.target, format: if run.builder.config.cmd.json() { DocumentationFormat::JSON } else { DocumentationFormat::HTML }, }); </ins> } /// Compile all standard library documentation.

fn run(self, builder: &Builder<'_>) { let stage = self.stage; let target = self.target; <del> let out = builder.doc_out(target); </del> <ins> let out = match self.format { DocumentationFormat::HTML => builder.doc_out(target), DocumentationFormat::JSON => builder.json_doc_out(target), }; </ins> t!(fs::create_dir_all(&out)); builder.ensure(SharedAssets { target: self.target }); let index_page = builder.src.join("src/doc/index.md").into_os_string(); <del> let mut extra_args = vec![ OsStr::new("--markdown-css"), OsStr::new("rust.css"), OsStr::new("--markdown-no-toc"), OsStr::new("--index-page"), &index_page, ]; </del> <ins> let mut extra_args = match self.format { DocumentationFormat::HTML => vec![ OsStr::new("--markdown-css"), OsStr::new("rust.css"), OsStr::new("--markdown-no-toc"), OsStr::new("--index-page"), &index_page, ], DocumentationFormat::JSON => vec![OsStr::new("--output-format"), OsStr::new("json")], }; </ins> if !builder.config.docs_minification { extra_args.push(OsStr::new("--disable-minification"));

}) .collect::<Vec<_>>(); <del> doc_std( builder, DocumentationFormat::HTML, stage, target, &out, &extra_args, &requested_crates, ); </del> <ins> doc_std(builder, self.format, stage, target, &out, &extra_args, &requested_crates); // Don't open if the format is json if let DocumentationFormat::JSON = self.format { return; } </ins> // Look for library/std, library/core etc in the `x.py doc` arguments and // open the corresponding rendered docs.

} } <del> #[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)] pub struct JsonStd { pub stage: u32, pub target: TargetSelection, } impl Step for JsonStd { type Output = (); const DEFAULT: bool = false; fn should_run(run: ShouldRun<'_>) -> ShouldRun<'_> { let default = run.builder.config.docs && run.builder.config.cmd.json(); run.all_krates("test").path("library").default_condition(default) } fn make_run(run: RunConfig<'_>) { run.builder.ensure(Std { stage: run.builder.top_stage, target: run.target }); } /// Build JSON documentation for the standard library crates. /// /// This is largely just a wrapper around `cargo doc`. fn run(self, builder: &Builder<'_>) { let stage = self.stage; let target = self.target; let out = builder.json_doc_out(target); t!(fs::create_dir_all(&out)); let extra_args = [OsStr::new("--output-format"), OsStr::new("json")]; doc_std(builder, DocumentationFormat::JSON, stage, target, &out, &extra_args, &[]) } } </del> /// Name of the crates that are visible to consumers of the standard library. /// Documentation for internal crates is handled by the rustc step, so internal crates will show /// up there.

const STD_PUBLIC_CRATES: [&str; 5] = ["core", "alloc", "std", "proc_macro", "test"]; #[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)] <del> enum DocumentationFormat { </del> <ins> pub enum DocumentationFormat { </ins> HTML, JSON, }

use crate::compile; use crate::config::TargetSelection; use crate::dist; <ins> use crate::doc::DocumentationFormat; </ins> use crate::flags::Subcommand; use crate::native; use crate::tool::{self, SourceType, Tool};

command.arg("--test-file").arg(path); } } <del> builder.ensure(crate::doc::Std { target: self.target, stage: builder.top_stage }); </del> <ins> builder.ensure(crate::doc::Std { target: self.target, stage: builder.top_stage, format: DocumentationFormat::HTML, }); </ins> builder.run(&mut command); } else { builder.info("No nodejs found, skipping "src/test/rustdoc-js-std" tests");