Split apart create_config and run_core
This commit is contained in:
parent
caeb3335c0
commit
0ac58f7bf8
|
@ -273,12 +273,9 @@ where
|
||||||
(lint_opts, lint_caps)
|
(lint_opts, lint_caps)
|
||||||
}
|
}
|
||||||
|
|
||||||
crate fn run_core(
|
/// Parse, resolve, and typecheck the given crate.
|
||||||
options: RustdocOptions,
|
fn create_config(
|
||||||
) -> (clean::Crate, RenderInfo, RenderOptions, Lrc<Session>) {
|
RustdocOptions {
|
||||||
// Parse, resolve, and typecheck the given crate.
|
|
||||||
|
|
||||||
let RustdocOptions {
|
|
||||||
input,
|
input,
|
||||||
crate_name,
|
crate_name,
|
||||||
proc_macro_crate,
|
proc_macro_crate,
|
||||||
|
@ -294,21 +291,10 @@ crate fn run_core(
|
||||||
lint_opts,
|
lint_opts,
|
||||||
describe_lints,
|
describe_lints,
|
||||||
lint_cap,
|
lint_cap,
|
||||||
default_passes,
|
|
||||||
manual_passes,
|
|
||||||
display_warnings,
|
display_warnings,
|
||||||
render_options,
|
|
||||||
output_format,
|
|
||||||
..
|
..
|
||||||
} = options;
|
}: RustdocOptions,
|
||||||
|
) -> rustc_interface::Config {
|
||||||
let extern_names: Vec<String> = externs
|
|
||||||
.iter()
|
|
||||||
.filter(|(_, entry)| entry.add_prelude)
|
|
||||||
.map(|(name, _)| name)
|
|
||||||
.cloned()
|
|
||||||
.collect();
|
|
||||||
|
|
||||||
// Add the doc cfg into the doc build.
|
// Add the doc cfg into the doc build.
|
||||||
cfgs.push("doc".to_string());
|
cfgs.push("doc".to_string());
|
||||||
|
|
||||||
|
@ -374,7 +360,7 @@ crate fn run_core(
|
||||||
..Options::default()
|
..Options::default()
|
||||||
};
|
};
|
||||||
|
|
||||||
let config = interface::Config {
|
interface::Config {
|
||||||
opts: sessopts,
|
opts: sessopts,
|
||||||
crate_cfg: interface::parse_cfgspecs(cfgs),
|
crate_cfg: interface::parse_cfgspecs(cfgs),
|
||||||
input,
|
input,
|
||||||
|
@ -417,7 +403,25 @@ crate fn run_core(
|
||||||
}),
|
}),
|
||||||
make_codegen_backend: None,
|
make_codegen_backend: None,
|
||||||
registry: rustc_driver::diagnostics_registry(),
|
registry: rustc_driver::diagnostics_registry(),
|
||||||
};
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
crate fn run_core(
|
||||||
|
options: RustdocOptions,
|
||||||
|
) -> (clean::Crate, RenderInfo, RenderOptions, Lrc<Session>) {
|
||||||
|
let extern_names: Vec<String> = options
|
||||||
|
.externs
|
||||||
|
.iter()
|
||||||
|
.filter(|(_, entry)| entry.add_prelude)
|
||||||
|
.map(|(name, _)| name)
|
||||||
|
.cloned()
|
||||||
|
.collect();
|
||||||
|
let default_passes = options.default_passes;
|
||||||
|
let output_format = options.output_format;
|
||||||
|
// TODO: fix this clone (especially render_options)
|
||||||
|
let manual_passes = options.manual_passes.clone();
|
||||||
|
let render_options = options.render_options.clone();
|
||||||
|
let config = create_config(options);
|
||||||
|
|
||||||
interface::create_compiler_and_run(config, |compiler| {
|
interface::create_compiler_and_run(config, |compiler| {
|
||||||
compiler.enter(|queries| {
|
compiler.enter(|queries| {
|
||||||
|
|
Loading…
Reference in New Issue