Skip to content

Commit 6d6aafc

Browse files
authored
Unrolled build for #146828
Rollup merge of #146828 - el-ev:issue146646, r=GuillaumeGomez fix a crash in rustdoc merge finalize without input file - Closes #146646 `SerializedSearchIndex::union` calls `Symbol::intern`, requiring `SESSION_GLOBALS` to be set.
2 parents ce4beeb + 42ebba2 commit 6d6aafc

File tree

3 files changed

+33
-2
lines changed

3 files changed

+33
-2
lines changed

src/librustdoc/lib.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -836,8 +836,10 @@ fn main_args(early_dcx: &mut EarlyDiagCtxt, at_args: &[String]) {
836836
config::InputMode::NoInputMergeFinalize => {
837837
return wrap_return(
838838
dcx,
839-
run_merge_finalize(render_options)
840-
.map_err(|e| format!("could not write merged cross-crate info: {e}")),
839+
rustc_span::create_session_globals_then(options.edition, &[], None, || {
840+
run_merge_finalize(render_options)
841+
.map_err(|e| format!("could not write merged cross-crate info: {e}"))
842+
}),
841843
);
842844
}
843845
};
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
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::{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+
rustdoc()
13+
.input("sierra.rs")
14+
.out_dir(&out_dir)
15+
.arg("-Zunstable-options")
16+
.arg(format!("--parts-out-dir={}", parts_out_dir.display()))
17+
.arg("--merge=none")
18+
.run();
19+
assert!(parts_out_dir.join("crate-info").exists());
20+
21+
let output = rustdoc()
22+
.arg("-Zunstable-options")
23+
.out_dir(&out_dir)
24+
.arg(format!("--include-parts-dir={}", parts_out_dir.display()))
25+
.arg("--merge=finalize")
26+
.run();
27+
output.assert_stderr_not_contains("error: the compiler unexpectedly panicked. this is a bug.");
28+
}
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
pub struct Sierra;

0 commit comments

Comments
 (0)