Skip to content
This repository was archived by the owner on May 28, 2025. It is now read-only.

Commit e730947

Browse files
committed
Separate run_global_ctxt into a separate function
1 parent d252798 commit e730947

File tree

1 file changed

+14
-8
lines changed

1 file changed

+14
-8
lines changed

src/librustdoc/core.rs

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ use std::rc::Rc;
3232

3333
use crate::clean;
3434
use crate::clean::{AttributesExt, MAX_DEF_ID};
35-
use crate::config::RenderInfo;
35+
use crate::config::{RenderInfo, OutputFormat};
3636
use crate::config::{Options as RustdocOptions, RenderOptions};
3737
use crate::passes::{self, Condition::*, ConditionalPass};
3838

@@ -299,8 +299,8 @@ pub fn run_core(options: RustdocOptions) -> (clean::Crate, RenderInfo, RenderOpt
299299
lint_opts,
300300
describe_lints,
301301
lint_cap,
302-
mut default_passes,
303-
mut manual_passes,
302+
default_passes,
303+
manual_passes,
304304
display_warnings,
305305
render_options,
306306
output_format,
@@ -457,7 +457,14 @@ pub fn run_core(options: RustdocOptions) -> (clean::Crate, RenderInfo, RenderOpt
457457

458458
let mut global_ctxt = abort_on_err(queries.global_ctxt(), sess).take();
459459

460-
global_ctxt.enter(|tcx| {
460+
global_ctxt.enter(|tcx| run_global_ctxt(tcx, resolver, default_passes, manual_passes, render_options, output_format))
461+
})
462+
})
463+
}
464+
465+
fn run_global_ctxt(tcx: TyCtxt<'_>, resolver: Rc<RefCell<interface::BoxedResolver>>,
466+
mut default_passes: passes::DefaultPassOption, mut manual_passes: Vec<String>,
467+
render_options: RenderOptions, output_format: Option<OutputFormat>) -> (clean::Crate, RenderInfo, RenderOptions) {
461468
// Certain queries assume that some checks were run elsewhere
462469
// (see https://github.com/rust-lang/rust/pull/73566#issuecomment-656954425),
463470
// so type-check everything other than function bodies in this crate before running lints.
@@ -476,13 +483,15 @@ pub fn run_core(options: RustdocOptions) -> (clean::Crate, RenderInfo, RenderOpt
476483
}
477484
});
478485
tcx.sess.abort_if_errors();
479-
sess.time("missing_docs", || {
486+
tcx.sess.time("missing_docs", || {
480487
rustc_lint::check_crate(tcx, rustc_lint::builtin::MissingDoc::new);
481488
});
489+
tcx.sess.time("check_mod_attrs", || {
482490
for &module in tcx.hir().krate().modules.keys() {
483491
let local_def_id = tcx.hir().local_def_id(module);
484492
tcx.ensure().check_mod_attrs(local_def_id);
485493
}
494+
});
486495

487496
let access_levels = tcx.privacy_access_levels(LOCAL_CRATE);
488497
// Convert from a HirId set to a DefId set since we don't always have easy access
@@ -629,9 +638,6 @@ pub fn run_core(options: RustdocOptions) -> (clean::Crate, RenderInfo, RenderOpt
629638
ctxt.sess().abort_if_errors();
630639

631640
(krate, ctxt.renderinfo.into_inner(), ctxt.render_options)
632-
})
633-
})
634-
})
635641
}
636642

637643
/// Due to https://github.com/rust-lang/rust/pull/73566,

0 commit comments

Comments
 (0)