rustdoc: include index-page in dep-info

This commit is contained in:
Michael Howell
2026-03-29 19:06:43 -07:00
parent a15a3d15b7
commit bfaf027a3b
3 changed files with 13 additions and 4 deletions
+6 -4
View File
@@ -744,10 +744,12 @@ fn println_condition(condition: Condition) {
}
let index_page = matches.opt_str("index-page").map(|s| PathBuf::from(&s));
if let Some(ref index_page) = index_page
&& !index_page.is_file()
{
dcx.fatal("option `--index-page` argument must be a file");
if let Some(ref index_page) = index_page {
if index_page.is_file() {
loaded_paths.push(index_page.clone());
} else {
dcx.fatal("option `--index-page` argument must be a file");
}
}
let target = parse_target_triple(early_dcx, matches);
@@ -0,0 +1,3 @@
% Index page
Index page
+4
View File
@@ -19,6 +19,7 @@ fn main() {
.arg("--markdown-after-content=after.md")
.arg("--extend-css=extend.css")
.arg("--theme=theme.css")
.arg("--index-page=index-page.md")
.emit("dep-info")
.run();
@@ -31,6 +32,7 @@ fn main() {
assert_contains(&content, "before.html:");
assert_contains(&content, "extend.css:");
assert_contains(&content, "theme.css:");
assert_contains(&content, "index-page.md:");
// Now we check that we can provide a file name to the `dep-info` argument.
rustdoc().input("lib.rs").arg("-Zunstable-options").emit("dep-info=bla.d").run();
@@ -80,6 +82,7 @@ fn main() {
.arg("--markdown-after-content=after.md")
.arg("--extend-css=extend.css")
.arg("--theme=theme.css")
.arg("--index-page=index-page.md")
.emit("dep-info=example.d")
.run();
let content = rfs::read_to_string("example.d");
@@ -92,4 +95,5 @@ fn main() {
assert_contains(&content, "before.html:");
assert_contains(&content, "extend.css:");
assert_contains(&content, "theme.css:");
assert_contains(&content, "index-page.md:");
}