Skip to content

Commit bfaf027

Browse files
committed
rustdoc: include index-page in dep-info
1 parent a15a3d1 commit bfaf027

3 files changed

Lines changed: 13 additions & 4 deletions

File tree

src/librustdoc/config.rs

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -744,10 +744,12 @@ impl Options {
744744
}
745745

746746
let index_page = matches.opt_str("index-page").map(|s| PathBuf::from(&s));
747-
if let Some(ref index_page) = index_page
748-
&& !index_page.is_file()
749-
{
750-
dcx.fatal("option `--index-page` argument must be a file");
747+
if let Some(ref index_page) = index_page {
748+
if index_page.is_file() {
749+
loaded_paths.push(index_page.clone());
750+
} else {
751+
dcx.fatal("option `--index-page` argument must be a file");
752+
}
751753
}
752754

753755
let target = parse_target_triple(early_dcx, matches);
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
% Index page
2+
3+
Index page

tests/run-make/rustdoc-dep-info/rmake.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ fn main() {
1919
.arg("--markdown-after-content=after.md")
2020
.arg("--extend-css=extend.css")
2121
.arg("--theme=theme.css")
22+
.arg("--index-page=index-page.md")
2223
.emit("dep-info")
2324
.run();
2425

@@ -31,6 +32,7 @@ fn main() {
3132
assert_contains(&content, "before.html:");
3233
assert_contains(&content, "extend.css:");
3334
assert_contains(&content, "theme.css:");
35+
assert_contains(&content, "index-page.md:");
3436

3537
// Now we check that we can provide a file name to the `dep-info` argument.
3638
rustdoc().input("lib.rs").arg("-Zunstable-options").emit("dep-info=bla.d").run();
@@ -80,6 +82,7 @@ fn main() {
8082
.arg("--markdown-after-content=after.md")
8183
.arg("--extend-css=extend.css")
8284
.arg("--theme=theme.css")
85+
.arg("--index-page=index-page.md")
8386
.emit("dep-info=example.d")
8487
.run();
8588
let content = rfs::read_to_string("example.d");
@@ -92,4 +95,5 @@ fn main() {
9295
assert_contains(&content, "before.html:");
9396
assert_contains(&content, "extend.css:");
9497
assert_contains(&content, "theme.css:");
98+
assert_contains(&content, "index-page.md:");
9599
}

0 commit comments

Comments
 (0)