Skip to content

Commit

Permalink
Parallel code
Browse files Browse the repository at this point in the history
  • Loading branch information
Zoxc committed Jun 19, 2018
1 parent 6ee8e0f commit b5650f9
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 9 deletions.
4 changes: 2 additions & 2 deletions src/librustc_borrowck/borrowck/mod.rs
Expand Up @@ -67,9 +67,9 @@ pub struct LoanDataFlowOperator;
pub type LoanDataFlow<'a, 'tcx> = DataFlowContext<'a, 'tcx, LoanDataFlowOperator>;

pub fn check_crate<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>) {
for body_owner_def_id in tcx.body_owners() {
tcx.par_body_owners(|body_owner_def_id| {
tcx.borrowck(body_owner_def_id);
}
});
}

pub fn provide(providers: &mut Providers) {
Expand Down
2 changes: 2 additions & 0 deletions src/librustc_borrowck/lib.rs
Expand Up @@ -17,6 +17,8 @@
#![feature(from_ref)]
#![feature(quote)]

#![recursion_limit="256"]

#[macro_use] extern crate log;
extern crate syntax;
extern crate syntax_pos;
Expand Down
8 changes: 3 additions & 5 deletions src/librustc_driver/driver.rs
Expand Up @@ -1272,11 +1272,9 @@ where

time(sess, "borrow checking", || borrowck::check_crate(tcx));

time(sess, "MIR borrow checking", || {
for def_id in tcx.body_owners() {
tcx.mir_borrowck(def_id);
}
});
time(sess,
"MIR borrow checking",
|| tcx.par_body_owners(|def_id| { tcx.mir_borrowck(def_id); }));

time(sess, "dumping chalk-like clauses", || {
rustc_traits::lowering::dump_program_clauses(tcx);
Expand Down
4 changes: 2 additions & 2 deletions src/librustc_typeck/check/mod.rs
Expand Up @@ -702,9 +702,9 @@ fn typeck_item_bodies<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, crate_num: CrateNum
{
debug_assert!(crate_num == LOCAL_CRATE);
Ok(tcx.sess.track_errors(|| {
for body_owner_def_id in tcx.body_owners() {
tcx.par_body_owners(|body_owner_def_id| {
ty::query::queries::typeck_tables_of::ensure(tcx, body_owner_def_id);
}
});
})?)
}

Expand Down
2 changes: 2 additions & 0 deletions src/librustc_typeck/lib.rs
Expand Up @@ -83,6 +83,8 @@ This API is completely unstable and subject to change.
#![feature(slice_sort_by_cached_key)]
#![feature(never_type)]

#![recursion_limit="256"]

#[macro_use] extern crate log;
#[macro_use] extern crate syntax;
extern crate syntax_pos;
Expand Down

0 comments on commit b5650f9

Please sign in to comment.