rustdoc: test for loading index when user said no

Also mentioned, as a perf problem, in
<https://github.com/rust-lang/cargo/pull/16309#discussion_r2586792981>
This commit is contained in:
Michael Howell 2025-12-05 20:58:02 -07:00
parent fb3a0895e0
commit 38a2a3da3c
3 changed files with 27 additions and 1 deletions

View file

@ -6,5 +6,5 @@ pub struct Dep4;
//@ hasraw crates.js 'dep1'
//@ hasraw search.index/name/*.js 'Dep1'
//@ has dep1/index.html
#[doc(alias="dep1_missing")]
#[doc(alias = "dep1_missing")]
pub struct Dep5;

View file

@ -0,0 +1,4 @@
//@ !hasraw crates.js 'dep_missing'
//@ !hasraw search.index/name/*.js 'DepMissing'
//@ has dep_missing/index.html
pub struct DepMissing;

View file

@ -61,6 +61,28 @@ fn main() {
.run();
output3.assert_stderr_not_contains("error: the compiler unexpectedly panicked. this is a bug.");
// dep_missing is different, because --parts-out-dir is not supplied
rustdoc().input("dep_missing.rs").out_dir(&out_dir).run();
assert!(parts_out_dir.join("dep2.json").exists());
rustdoc()
.input("dep1.rs")
.out_dir(&out_dir)
.arg("-Zunstable-options")
.arg(format!("--parts-out-dir={}", parts_out_dir.display()))
.arg("--merge=none")
.run();
assert!(parts_out_dir.join("dep1.json").exists());
let output4 = rustdoc()
.arg("-Zunstable-options")
.out_dir(&out_dir)
.arg(format!("--include-parts-dir={}", parts_out_dir.display()))
.arg("--merge=finalize")
.run();
output4.assert_stderr_not_contains("error: the compiler unexpectedly panicked. this is a bug.");
htmldocck().arg(&out_dir).arg("dep1.rs").run();
htmldocck().arg(&out_dir).arg("dep2.rs").run();
htmldocck().arg(&out_dir).arg("dep_missing.rs").run();
}