Skip to content

Rollup of 7 pull requests #104043

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 23 commits into from
Nov 6, 2022
Merged
Show file tree
Hide file tree
Changes from 6 commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
6e1361f
Fixes #103816 make --json work
viandoxdev Nov 1, 2022
ffd4078
fix json running all the time
viandoxdev Nov 1, 2022
972d075
merge JsonStd and Std steps
viandoxdev Nov 2, 2022
1bc2bfa
prevent open with json
viandoxdev Nov 2, 2022
1e25882
fix #102806, suggest use .. to fill in the rest of the fields of Struct
chenyukang Oct 13, 2022
4b77e73
fake a base to suppress later extra error message
chenyukang Oct 13, 2022
cb184bb
rustdoc: clean up `.logo-container` layout CSS
notriddle Nov 4, 2022
dad3270
fix a comment in UnsafeCell::new
RalfJung Nov 5, 2022
ffb2869
Migrate test-arrow to CSS variables
GuillaumeGomez Nov 5, 2022
8e2956d
Extend GUI test for run button
GuillaumeGomez Nov 5, 2022
04583f2
Simplify code
Noratrieb Nov 5, 2022
27e0f03
Add internal descriptions to a few queries
Noratrieb Nov 5, 2022
900af41
fix out dir being wrong in json
viandoxdev Nov 5, 2022
2189480
rustdoc: add test case for huge logo
notriddle Nov 5, 2022
84fe2ee
Add more nonsense to weird-exprs.rs.
m-ou-se Nov 6, 2022
28d82dd
Fix typo
compiler-errors Nov 6, 2022
58f5d57
Rollup merge of #103012 - chenyukang:fix-102806, r=davidtwco,compiler…
matthiaskrgr Nov 6, 2022
131ef95
Rollup merge of #103851 - viandoxdev:103816_bootstrap_fix_json_doc, r…
matthiaskrgr Nov 6, 2022
c013962
Rollup merge of #103990 - notriddle:notriddle/logo-container, r=Guill…
matthiaskrgr Nov 6, 2022
d93b520
Rollup merge of #104002 - RalfJung:unsafecell-new, r=JohnTitor
matthiaskrgr Nov 6, 2022
ef0d79f
Rollup merge of #104014 - GuillaumeGomez:run-button-css-var, r=notriddle
matthiaskrgr Nov 6, 2022
13e62be
Rollup merge of #104016 - Nilstrieb:query-descs-more, r=compiler-errors
matthiaskrgr Nov 6, 2022
619add3
Rollup merge of #104035 - m-ou-se:weird-expr-closure-match, r=compile…
matthiaskrgr Nov 6, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion src/bootstrap/dist.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ use crate::cache::{Interned, INTERNER};
use crate::channel;
use crate::compile;
use crate::config::TargetSelection;
use crate::doc::DocumentationFormat;
use crate::tarball::{GeneratedTarball, OverlayKind, Tarball};
use crate::tool::{self, Tool};
use crate::util::{exe, is_dylib, output, t, timeit};
Expand Down Expand Up @@ -97,7 +98,11 @@ impl Step for JsonDocs {
/// Builds the `rust-docs-json` installer component.
fn run(self, builder: &Builder<'_>) -> Option<GeneratedTarball> {
let host = self.host;
builder.ensure(crate::doc::JsonStd { stage: builder.top_stage, target: host });
builder.ensure(crate::doc::Std {
stage: builder.top_stage,
target: host,
format: DocumentationFormat::JSON,
});

let dest = "share/doc/rust/json";

Expand Down
83 changes: 32 additions & 51 deletions src/bootstrap/doc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -420,6 +420,7 @@ impl Step for SharedAssets {
pub struct Std {
pub stage: u32,
pub target: TargetSelection,
pub format: DocumentationFormat,
}

impl Step for Std {
Expand All @@ -432,7 +433,15 @@ impl Step for Std {
}

fn make_run(run: RunConfig<'_>) {
run.builder.ensure(Std { stage: run.builder.top_stage, target: run.target });
run.builder.ensure(Std {
stage: run.builder.top_stage,
target: run.target,
format: if run.builder.config.cmd.json() {
DocumentationFormat::JSON
} else {
DocumentationFormat::HTML
},
});
}

/// Compile all standard library documentation.
Expand All @@ -442,19 +451,26 @@ impl Step for Std {
fn run(self, builder: &Builder<'_>) {
let stage = self.stage;
let target = self.target;
let out = builder.doc_out(target);
let out = match self.format {
DocumentationFormat::HTML => builder.doc_out(target),
DocumentationFormat::JSON => builder.json_doc_out(target),
};

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();
let mut extra_args = vec![
OsStr::new("--markdown-css"),
OsStr::new("rust.css"),
OsStr::new("--markdown-no-toc"),
OsStr::new("--index-page"),
&index_page,
];
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")],
};

if !builder.config.docs_minification {
extra_args.push(OsStr::new("--disable-minification"));
Expand All @@ -478,15 +494,12 @@ impl Step for Std {
})
.collect::<Vec<_>>();

doc_std(
builder,
DocumentationFormat::HTML,
stage,
target,
&out,
&extra_args,
&requested_crates,
);
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;
}

// Look for library/std, library/core etc in the `x.py doc` arguments and
// open the corresponding rendered docs.
Expand All @@ -499,38 +512,6 @@ impl Step for Std {
}
}

#[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, &[])
}
}

/// 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.
Expand All @@ -543,7 +524,7 @@ impl Step for JsonStd {
const STD_PUBLIC_CRATES: [&str; 5] = ["core", "alloc", "std", "proc_macro", "test"];

#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)]
enum DocumentationFormat {
pub enum DocumentationFormat {
HTML,
JSON,
}
Expand Down
7 changes: 6 additions & 1 deletion src/bootstrap/test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ use crate::cache::Interned;
use crate::compile;
use crate::config::TargetSelection;
use crate::dist;
use crate::doc::DocumentationFormat;
use crate::flags::Subcommand;
use crate::native;
use crate::tool::{self, SourceType, Tool};
Expand Down Expand Up @@ -822,7 +823,11 @@ impl Step for RustdocJSStd {
command.arg("--test-file").arg(path);
}
}
builder.ensure(crate::doc::Std { target: self.target, stage: builder.top_stage });
builder.ensure(crate::doc::Std {
target: self.target,
stage: builder.top_stage,
format: DocumentationFormat::HTML,
});
builder.run(&mut command);
} else {
builder.info("No nodejs found, skipping \"src/test/rustdoc-js-std\" tests");
Expand Down