|
| 1 | +// Running --merge=finalize without an input crate root should not trigger ICE. |
| 2 | +// Issue: https://github.com/rust-lang/rust/issues/146646 |
| 3 | + |
| 4 | +//@ needs-target-std |
| 5 | + |
| 6 | +use run_make_support::{htmldocck, path, rustdoc}; |
| 7 | + |
| 8 | +fn main() { |
| 9 | + let out_dir = path("out"); |
| 10 | + let merged_dir = path("merged"); |
| 11 | + let parts_out_dir = path("parts"); |
| 12 | + |
| 13 | + rustdoc() |
| 14 | + .input("dep1.rs") |
| 15 | + .out_dir(&out_dir) |
| 16 | + .arg("-Zunstable-options") |
| 17 | + .arg(format!("--parts-out-dir={}", parts_out_dir.display())) |
| 18 | + .arg("--merge=none") |
| 19 | + .run(); |
| 20 | + assert!(parts_out_dir.join("dep1.json").exists()); |
| 21 | + |
| 22 | + let output = rustdoc() |
| 23 | + .arg("-Zunstable-options") |
| 24 | + .out_dir(&out_dir) |
| 25 | + .arg(format!("--include-parts-dir={}", parts_out_dir.display())) |
| 26 | + .arg("--merge=finalize") |
| 27 | + .run(); |
| 28 | + output.assert_stderr_not_contains("error: the compiler unexpectedly panicked. this is a bug."); |
| 29 | + |
| 30 | + rustdoc() |
| 31 | + .input("dep2.rs") |
| 32 | + .out_dir(&out_dir) |
| 33 | + .arg("-Zunstable-options") |
| 34 | + .arg(format!("--parts-out-dir={}", parts_out_dir.display())) |
| 35 | + .arg("--merge=none") |
| 36 | + .run(); |
| 37 | + assert!(parts_out_dir.join("dep2.json").exists()); |
| 38 | + |
| 39 | + let output2 = rustdoc() |
| 40 | + .arg("-Zunstable-options") |
| 41 | + .out_dir(&out_dir) |
| 42 | + .arg(format!("--include-parts-dir={}", parts_out_dir.display())) |
| 43 | + .arg("--merge=finalize") |
| 44 | + .run(); |
| 45 | + output2.assert_stderr_not_contains("error: the compiler unexpectedly panicked. this is a bug."); |
| 46 | + |
| 47 | + rustdoc() |
| 48 | + .input("dep1.rs") |
| 49 | + .out_dir(&out_dir) |
| 50 | + .arg("-Zunstable-options") |
| 51 | + .arg(format!("--parts-out-dir={}", parts_out_dir.display())) |
| 52 | + .arg("--merge=none") |
| 53 | + .run(); |
| 54 | + assert!(parts_out_dir.join("dep1.json").exists()); |
| 55 | + |
| 56 | + let output3 = rustdoc() |
| 57 | + .arg("-Zunstable-options") |
| 58 | + .out_dir(&out_dir) |
| 59 | + .arg(format!("--include-parts-dir={}", parts_out_dir.display())) |
| 60 | + .arg("--merge=finalize") |
| 61 | + .run(); |
| 62 | + output3.assert_stderr_not_contains("error: the compiler unexpectedly panicked. this is a bug."); |
| 63 | + |
| 64 | + htmldocck().arg(&out_dir).arg("dep1.rs").run(); |
| 65 | + htmldocck().arg(&out_dir).arg("dep2.rs").run(); |
| 66 | +} |
0 commit comments