Parallel code

This commit is contained in:
John Kåre Alsaker 2018-03-15 10:08:52 +01:00
parent 6ee8e0fc11
commit b5650f9282
5 changed files with 11 additions and 9 deletions

View file

@ -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) {

View file

@ -17,6 +17,8 @@
#![feature(from_ref)]
#![feature(quote)]
#![recursion_limit="256"]
#[macro_use] extern crate log;
extern crate syntax;
extern crate syntax_pos;

View file

@ -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);

View file

@ -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);
}
});
})?)
}

View file

@ -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;