about summary refs log tree commit diff
diff options
context:
space:
mode:
authorJohn Kåre Alsaker <john.kare.alsaker@gmail.com>2019-02-23 18:12:38 +0100
committerJohn Kåre Alsaker <john.kare.alsaker@gmail.com>2019-03-06 04:47:04 +0100
commit1745957d637d86f111f4aa96e47f68a7433f0e08 (patch)
tree67e8aeffb3d02497cb6c6a68ba92deb664cdac52
parentd2923e5a77b318300c9d35d63d594125b8b9a43f (diff)
downloadrust-1745957d637d86f111f4aa96e47f68a7433f0e08.tar.gz
rust-1745957d637d86f111f4aa96e47f68a7433f0e08.zip
Make misc checking 2 more parallel
-rw-r--r--src/librustc/middle/intrinsicck.rs6
-rw-r--r--src/librustc/middle/liveness.rs6
-rw-r--r--src/librustc_interface/passes.rs33
-rw-r--r--src/librustc_mir/hair/pattern/check_match.rs7
-rw-r--r--src/librustc_mir/hair/pattern/mod.rs1
-rw-r--r--src/librustc_mir/lib.rs1
-rw-r--r--src/librustc_passes/rvalue_promotion.rs7
7 files changed, 17 insertions, 44 deletions
diff --git a/src/librustc/middle/intrinsicck.rs b/src/librustc/middle/intrinsicck.rs
index ce20ca39533..c4071e9f354 100644
--- a/src/librustc/middle/intrinsicck.rs
+++ b/src/librustc/middle/intrinsicck.rs
@@ -10,12 +10,6 @@ use syntax_pos::Span;
 use crate::hir::intravisit::{self, Visitor, NestedVisitorMap};
 use crate::hir;
 
-pub fn check_crate<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>) {
-    for &module in tcx.hir().krate().modules.keys() {
-        tcx.ensure().check_mod_intrinsics(tcx.hir().local_def_id(module));
-    }
-}
-
 fn check_mod_intrinsics<'tcx>(tcx: TyCtxt<'_, 'tcx, 'tcx>, module_def_id: DefId) {
     tcx.hir().visit_item_likes_in_module(
         module_def_id,
diff --git a/src/librustc/middle/liveness.rs b/src/librustc/middle/liveness.rs
index 76933a6e348..031d6dec090 100644
--- a/src/librustc/middle/liveness.rs
+++ b/src/librustc/middle/liveness.rs
@@ -185,12 +185,6 @@ fn check_mod_liveness<'tcx>(tcx: TyCtxt<'_, 'tcx, 'tcx>, module_def_id: DefId) {
     tcx.hir().visit_item_likes_in_module(module_def_id, &mut IrMaps::new(tcx).as_deep_visitor());
 }
 
-pub fn check_crate<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>) {
-    for &module in tcx.hir().krate().modules.keys() {
-        tcx.ensure().check_mod_liveness(tcx.hir().local_def_id(module));
-    }
-}
-
 pub fn provide(providers: &mut Providers<'_>) {
     *providers = Providers {
         check_mod_liveness,
diff --git a/src/librustc_interface/passes.rs b/src/librustc_interface/passes.rs
index 591583a1526..cf4a3ecf555 100644
--- a/src/librustc_interface/passes.rs
+++ b/src/librustc_interface/passes.rs
@@ -218,24 +218,25 @@ fn analysis<'tcx>(
     // passes are timed inside typeck
     typeck::check_crate(tcx)?;
 
-    time(sess, "misc checking", || {
+    time(sess, "misc checking 2", || {
         parallel!({
-            time(sess, "rvalue promotion", || {
-                rvalue_promotion::check_crate(tcx)
-            });
-        }, {
-            time(sess, "intrinsic checking", || {
-                middle::intrinsicck::check_crate(tcx)
+            time(sess, "rvalue promotion + match checking", || {
+                tcx.par_body_owners(|def_id| {
+                    tcx.ensure().const_is_rvalue_promotable_to_static(def_id);
+                    tcx.ensure().check_match(def_id);
+                });
             });
         }, {
-            time(sess, "match checking", || mir::matchck_crate(tcx));
-        }, {
-            // this must run before MIR dump, because
-            // "not all control paths return a value" is reported here.
-            //
-            // maybe move the check to a MIR pass?
-            time(sess, "liveness checking", || {
-                middle::liveness::check_crate(tcx)
+            time(sess, "liveness checking + intrinsic checking", || {
+                par_iter(&tcx.hir().krate().modules).for_each(|(&module, _)| {
+                    // this must run before MIR dump, because
+                    // "not all control paths return a value" is reported here.
+                    //
+                    // maybe move the check to a MIR pass?
+                    tcx.ensure().check_mod_liveness(tcx.hir().local_def_id(module));
+
+                    tcx.ensure().check_mod_intrinsics(tcx.hir().local_def_id(module));
+                });
             });
         });
     });
@@ -276,7 +277,7 @@ fn analysis<'tcx>(
         return Err(ErrorReported);
     }
 
-    time(sess, "misc checking", || {
+    time(sess, "misc checking 3", || {
         parallel!({
             time(sess, "privacy access levels", || {
                 tcx.ensure().privacy_access_levels(LOCAL_CRATE);
diff --git a/src/librustc_mir/hair/pattern/check_match.rs b/src/librustc_mir/hair/pattern/check_match.rs
index 9af513a9090..787dba15f4d 100644
--- a/src/librustc_mir/hair/pattern/check_match.rs
+++ b/src/librustc_mir/hair/pattern/check_match.rs
@@ -27,13 +27,6 @@ use std::slice;
 use syntax::ptr::P;
 use syntax_pos::{Span, DUMMY_SP, MultiSpan};
 
-pub fn check_crate<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>) {
-    for def_id in tcx.body_owners() {
-        tcx.ensure().check_match(def_id);
-    }
-    tcx.sess.abort_if_errors();
-}
-
 pub(crate) fn check_match<'a, 'tcx>(
     tcx: TyCtxt<'a, 'tcx, 'tcx>,
     def_id: DefId,
diff --git a/src/librustc_mir/hair/pattern/mod.rs b/src/librustc_mir/hair/pattern/mod.rs
index d5f2e7a7275..4788454b86a 100644
--- a/src/librustc_mir/hair/pattern/mod.rs
+++ b/src/librustc_mir/hair/pattern/mod.rs
@@ -3,7 +3,6 @@
 mod _match;
 mod check_match;
 
-pub use self::check_match::check_crate;
 pub(crate) use self::check_match::check_match;
 
 use crate::const_eval::{const_field, const_variant_index};
diff --git a/src/librustc_mir/lib.rs b/src/librustc_mir/lib.rs
index 06e79dc4e70..0b735b4b39c 100644
--- a/src/librustc_mir/lib.rs
+++ b/src/librustc_mir/lib.rs
@@ -54,7 +54,6 @@ pub mod interpret;
 pub mod monomorphize;
 pub mod const_eval;
 
-pub use hair::pattern::check_crate as matchck_crate;
 use rustc::ty::query::Providers;
 
 pub fn provide(providers: &mut Providers<'_>) {
diff --git a/src/librustc_passes/rvalue_promotion.rs b/src/librustc_passes/rvalue_promotion.rs
index edd65825446..a059ab40697 100644
--- a/src/librustc_passes/rvalue_promotion.rs
+++ b/src/librustc_passes/rvalue_promotion.rs
@@ -39,13 +39,6 @@ pub fn provide(providers: &mut Providers<'_>) {
     };
 }
 
-pub fn check_crate<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>) {
-    for &body_id in &tcx.hir().krate().body_ids {
-        let def_id = tcx.hir().body_owner_def_id(body_id);
-        tcx.const_is_rvalue_promotable_to_static(def_id);
-    }
-}
-
 fn const_is_rvalue_promotable_to_static<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>,
                                                   def_id: DefId)
                                                   -> bool