Skip to content

Commit

Permalink
Make misc checking 1 more parallel
Browse files Browse the repository at this point in the history
  • Loading branch information
Zoxc committed Mar 6, 2019
1 parent 1745957 commit 140a837
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 37 deletions.
6 changes: 0 additions & 6 deletions src/librustc/hir/check_attr.rs
Expand Up @@ -344,12 +344,6 @@ impl<'a, 'tcx> Visitor<'tcx> for CheckAttrVisitor<'a, 'tcx> {
}
}

pub fn check_crate<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>) {
for &module in tcx.hir().krate().modules.keys() {
tcx.ensure().check_mod_attrs(tcx.hir().local_def_id(module));
}
}

fn is_c_like_enum(item: &hir::Item) -> bool {
if let hir::ItemKind::Enum(ref def, _) = item.node {
for variant in &def.variants {
Expand Down
6 changes: 0 additions & 6 deletions src/librustc/middle/stability.rs
Expand Up @@ -456,12 +456,6 @@ impl<'a, 'tcx> Index<'tcx> {
}
}

pub fn check_unstable_api_usage<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>) {
for &module in tcx.hir().krate().modules.keys() {
tcx.ensure().check_mod_unstable_api_usage(tcx.hir().local_def_id(module));
}
}

/// Cross-references the feature names of unstable APIs with enabled
/// features and possibly prints errors.
fn check_mod_unstable_api_usage<'tcx>(tcx: TyCtxt<'_, 'tcx, 'tcx>, module_def_id: DefId) {
Expand Down
36 changes: 17 additions & 19 deletions src/librustc_interface/passes.rs
Expand Up @@ -191,27 +191,25 @@ fn analysis<'tcx>(

let sess = tcx.sess;

parallel!({
time(sess, "looking for entry point", || {
middle::entry::find_entry_point(tcx)
});
time(sess, "misc checking 1", || {
parallel!({
time(sess, "looking for entry point", || {
middle::entry::find_entry_point(tcx)
});

time(sess, "looking for plugin registrar", || {
plugin::build::find_plugin_registrar(tcx)
});
time(sess, "looking for plugin registrar", || {
plugin::build::find_plugin_registrar(tcx)
});

time(sess, "looking for derive registrar", || {
proc_macro_decls::find(tcx)
});
}, {
time(sess, "loop checking", || loops::check_crate(tcx));
}, {
time(sess, "attribute checking", || {
hir::check_attr::check_crate(tcx)
});
}, {
time(sess, "stability checking", || {
stability::check_unstable_api_usage(tcx)
time(sess, "looking for derive registrar", || {
proc_macro_decls::find(tcx)
});
}, {
par_iter(&tcx.hir().krate().modules).for_each(|(&module, _)| {
tcx.ensure().check_mod_loops(tcx.hir().local_def_id(module));
tcx.ensure().check_mod_attrs(tcx.hir().local_def_id(module));
tcx.ensure().check_mod_unstable_api_usage(tcx.hir().local_def_id(module));
});
});
});

Expand Down
6 changes: 0 additions & 6 deletions src/librustc_passes/loops.rs
Expand Up @@ -46,12 +46,6 @@ struct CheckLoopVisitor<'a, 'hir: 'a> {
cx: Context,
}

pub fn check_crate<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>) {
for &module in tcx.hir().krate().modules.keys() {
tcx.ensure().check_mod_loops(tcx.hir().local_def_id(module));
}
}

fn check_mod_loops<'tcx>(tcx: TyCtxt<'_, 'tcx, 'tcx>, module_def_id: DefId) {
tcx.hir().visit_item_likes_in_module(module_def_id, &mut CheckLoopVisitor {
sess: &tcx.sess,
Expand Down

0 comments on commit 140a837

Please sign in to comment.