Skip to content

Commit 1745957

Browse files
committed
Make misc checking 2 more parallel
1 parent d2923e5 commit 1745957

File tree

7 files changed

+17
-44
lines changed

7 files changed

+17
-44
lines changed

src/librustc/middle/intrinsicck.rs

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,6 @@ use syntax_pos::Span;
1010
use crate::hir::intravisit::{self, Visitor, NestedVisitorMap};
1111
use crate::hir;
1212

13-
pub fn check_crate<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>) {
14-
for &module in tcx.hir().krate().modules.keys() {
15-
tcx.ensure().check_mod_intrinsics(tcx.hir().local_def_id(module));
16-
}
17-
}
18-
1913
fn check_mod_intrinsics<'tcx>(tcx: TyCtxt<'_, 'tcx, 'tcx>, module_def_id: DefId) {
2014
tcx.hir().visit_item_likes_in_module(
2115
module_def_id,

src/librustc/middle/liveness.rs

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -185,12 +185,6 @@ fn check_mod_liveness<'tcx>(tcx: TyCtxt<'_, 'tcx, 'tcx>, module_def_id: DefId) {
185185
tcx.hir().visit_item_likes_in_module(module_def_id, &mut IrMaps::new(tcx).as_deep_visitor());
186186
}
187187

188-
pub fn check_crate<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>) {
189-
for &module in tcx.hir().krate().modules.keys() {
190-
tcx.ensure().check_mod_liveness(tcx.hir().local_def_id(module));
191-
}
192-
}
193-
194188
pub fn provide(providers: &mut Providers<'_>) {
195189
*providers = Providers {
196190
check_mod_liveness,

src/librustc_interface/passes.rs

Lines changed: 17 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -218,24 +218,25 @@ fn analysis<'tcx>(
218218
// passes are timed inside typeck
219219
typeck::check_crate(tcx)?;
220220

221-
time(sess, "misc checking", || {
221+
time(sess, "misc checking 2", || {
222222
parallel!({
223-
time(sess, "rvalue promotion", || {
224-
rvalue_promotion::check_crate(tcx)
225-
});
226-
}, {
227-
time(sess, "intrinsic checking", || {
228-
middle::intrinsicck::check_crate(tcx)
223+
time(sess, "rvalue promotion + match checking", || {
224+
tcx.par_body_owners(|def_id| {
225+
tcx.ensure().const_is_rvalue_promotable_to_static(def_id);
226+
tcx.ensure().check_match(def_id);
227+
});
229228
});
230229
}, {
231-
time(sess, "match checking", || mir::matchck_crate(tcx));
232-
}, {
233-
// this must run before MIR dump, because
234-
// "not all control paths return a value" is reported here.
235-
//
236-
// maybe move the check to a MIR pass?
237-
time(sess, "liveness checking", || {
238-
middle::liveness::check_crate(tcx)
230+
time(sess, "liveness checking + intrinsic checking", || {
231+
par_iter(&tcx.hir().krate().modules).for_each(|(&module, _)| {
232+
// this must run before MIR dump, because
233+
// "not all control paths return a value" is reported here.
234+
//
235+
// maybe move the check to a MIR pass?
236+
tcx.ensure().check_mod_liveness(tcx.hir().local_def_id(module));
237+
238+
tcx.ensure().check_mod_intrinsics(tcx.hir().local_def_id(module));
239+
});
239240
});
240241
});
241242
});
@@ -276,7 +277,7 @@ fn analysis<'tcx>(
276277
return Err(ErrorReported);
277278
}
278279

279-
time(sess, "misc checking", || {
280+
time(sess, "misc checking 3", || {
280281
parallel!({
281282
time(sess, "privacy access levels", || {
282283
tcx.ensure().privacy_access_levels(LOCAL_CRATE);

src/librustc_mir/hair/pattern/check_match.rs

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -27,13 +27,6 @@ use std::slice;
2727
use syntax::ptr::P;
2828
use syntax_pos::{Span, DUMMY_SP, MultiSpan};
2929

30-
pub fn check_crate<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>) {
31-
for def_id in tcx.body_owners() {
32-
tcx.ensure().check_match(def_id);
33-
}
34-
tcx.sess.abort_if_errors();
35-
}
36-
3730
pub(crate) fn check_match<'a, 'tcx>(
3831
tcx: TyCtxt<'a, 'tcx, 'tcx>,
3932
def_id: DefId,

src/librustc_mir/hair/pattern/mod.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
mod _match;
44
mod check_match;
55

6-
pub use self::check_match::check_crate;
76
pub(crate) use self::check_match::check_match;
87

98
use crate::const_eval::{const_field, const_variant_index};

src/librustc_mir/lib.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,6 @@ pub mod interpret;
5454
pub mod monomorphize;
5555
pub mod const_eval;
5656

57-
pub use hair::pattern::check_crate as matchck_crate;
5857
use rustc::ty::query::Providers;
5958

6059
pub fn provide(providers: &mut Providers<'_>) {

src/librustc_passes/rvalue_promotion.rs

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -39,13 +39,6 @@ pub fn provide(providers: &mut Providers<'_>) {
3939
};
4040
}
4141

42-
pub fn check_crate<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>) {
43-
for &body_id in &tcx.hir().krate().body_ids {
44-
let def_id = tcx.hir().body_owner_def_id(body_id);
45-
tcx.const_is_rvalue_promotable_to_static(def_id);
46-
}
47-
}
48-
4942
fn const_is_rvalue_promotable_to_static<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>,
5043
def_id: DefId)
5144
-> bool

0 commit comments

Comments
 (0)