From b5650f9282804f88dafa2d800ac9fae27765ddcd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?John=20K=C3=A5re=20Alsaker?= Date: Thu, 15 Mar 2018 10:08:52 +0100 Subject: [PATCH] Parallel code --- src/librustc_borrowck/borrowck/mod.rs | 4 ++-- src/librustc_borrowck/lib.rs | 2 ++ src/librustc_driver/driver.rs | 8 +++----- src/librustc_typeck/check/mod.rs | 4 ++-- src/librustc_typeck/lib.rs | 2 ++ 5 files changed, 11 insertions(+), 9 deletions(-) diff --git a/src/librustc_borrowck/borrowck/mod.rs b/src/librustc_borrowck/borrowck/mod.rs index 11d35def0077..684fd10c8c65 100644 --- a/src/librustc_borrowck/borrowck/mod.rs +++ b/src/librustc_borrowck/borrowck/mod.rs @@ -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) { diff --git a/src/librustc_borrowck/lib.rs b/src/librustc_borrowck/lib.rs index 52a357e1a1d3..a5a20af0e4e4 100644 --- a/src/librustc_borrowck/lib.rs +++ b/src/librustc_borrowck/lib.rs @@ -17,6 +17,8 @@ #![feature(from_ref)] #![feature(quote)] +#![recursion_limit="256"] + #[macro_use] extern crate log; extern crate syntax; extern crate syntax_pos; diff --git a/src/librustc_driver/driver.rs b/src/librustc_driver/driver.rs index 5d5baf765497..c18a08926865 100644 --- a/src/librustc_driver/driver.rs +++ b/src/librustc_driver/driver.rs @@ -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); diff --git a/src/librustc_typeck/check/mod.rs b/src/librustc_typeck/check/mod.rs index d68fc67073e9..b70b61d19159 100644 --- a/src/librustc_typeck/check/mod.rs +++ b/src/librustc_typeck/check/mod.rs @@ -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); - } + }); })?) } diff --git a/src/librustc_typeck/lib.rs b/src/librustc_typeck/lib.rs index ce7249bd7b5b..80f57adf580b 100644 --- a/src/librustc_typeck/lib.rs +++ b/src/librustc_typeck/lib.rs @@ -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;