@@ -104,6 +104,7 @@ use rustc::ty::print::characteristic_def_id_of_type;
104
104
use rustc:: ty:: query:: Providers ;
105
105
use rustc:: ty:: { self , DefIdTree , InstanceDef , TyCtxt } ;
106
106
use rustc_data_structures:: fx:: { FxHashMap , FxHashSet } ;
107
+ use rustc_data_structures:: sync;
107
108
use rustc_hir:: def:: DefKind ;
108
109
use rustc_hir:: def_id:: { CrateNum , DefId , DefIdSet , CRATE_DEF_INDEX , LOCAL_CRATE } ;
109
110
use rustc_span:: symbol:: Symbol ;
@@ -796,6 +797,8 @@ where
796
797
I : Iterator < Item = & ' a MonoItem < ' tcx > > ,
797
798
' tcx : ' a ,
798
799
{
800
+ let _prof_timer = tcx. prof . generic_activity ( "assert_symbols_are_distinct" ) ;
801
+
799
802
let mut symbols: Vec < _ > =
800
803
mono_items. map ( |mono_item| ( mono_item, mono_item. symbol_name ( tcx) ) ) . collect ( ) ;
801
804
@@ -869,18 +872,23 @@ fn collect_and_partition_mono_items(
869
872
870
873
tcx. sess . abort_if_errors ( ) ;
871
874
872
- assert_symbols_are_distinct ( tcx, items. iter ( ) ) ;
873
-
874
- let strategy = if tcx. sess . opts . incremental . is_some ( ) {
875
- PartitioningStrategy :: PerModule
876
- } else {
877
- PartitioningStrategy :: FixedUnitCount ( tcx. sess . codegen_units ( ) )
878
- } ;
879
-
880
- let codegen_units = partition ( tcx, items. iter ( ) . cloned ( ) , strategy, & inlining_map)
881
- . into_iter ( )
882
- . map ( Arc :: new)
883
- . collect :: < Vec < _ > > ( ) ;
875
+ let ( codegen_units, _) = tcx. sess . time ( "partition_and_assert_distinct_symbols" , || {
876
+ sync:: join (
877
+ || {
878
+ let strategy = if tcx. sess . opts . incremental . is_some ( ) {
879
+ PartitioningStrategy :: PerModule
880
+ } else {
881
+ PartitioningStrategy :: FixedUnitCount ( tcx. sess . codegen_units ( ) )
882
+ } ;
883
+
884
+ partition ( tcx, items. iter ( ) . cloned ( ) , strategy, & inlining_map)
885
+ . into_iter ( )
886
+ . map ( Arc :: new)
887
+ . collect :: < Vec < _ > > ( )
888
+ } ,
889
+ || assert_symbols_are_distinct ( tcx, items. iter ( ) ) ,
890
+ )
891
+ } ) ;
884
892
885
893
let mono_items: DefIdSet = items
886
894
. iter ( )
0 commit comments