Skip to content

Commit 38988e6

Browse files
committed
Use interface::run_compiler for markdown::render.
It turns out `markdown::render` is more complex than it first appears, because it can invoke `doctest::make_test`, which requires session globals and a thread pool. So this commit changes it to use `interface::run_compiler`. Three of the four paths in `main_args` now use `interface::run_compiler`.
1 parent 63db9e5 commit 38988e6

File tree

1 file changed

+10
-3
lines changed

1 file changed

+10
-3
lines changed

Diff for: src/librustdoc/lib.rs

+10-3
Original file line numberDiff line numberDiff line change
@@ -742,11 +742,18 @@ fn main_args(at_args: &[String]) -> MainResult {
742742
(true, true) => return wrap_return(&diag, markdown::test(options)),
743743
(true, false) => return doctest::run(options),
744744
(false, true) => {
745-
// Session globals are required for symbol interning.
745+
let input = options.input.clone();
746+
let render_options = options.render_options.clone();
747+
let edition = options.edition;
748+
let config = core::create_config(options);
749+
750+
// `markdown::render` can invoke `doctest::make_test`, which
751+
// requires session globals and a thread pool, so we use
752+
// `run_compiler`.
746753
return wrap_return(
747754
&diag,
748-
rustc_span::create_session_globals_then(options.edition, || {
749-
markdown::render(&options.input, options.render_options, options.edition)
755+
interface::run_compiler(config, |_compiler| {
756+
markdown::render(&input, render_options, edition)
750757
}),
751758
);
752759
}

0 commit comments

Comments
 (0)