94
94
95
95
use std:: cmp;
96
96
use std:: collections:: hash_map:: Entry ;
97
- use std:: sync:: Arc ;
98
97
99
98
use rustc_data_structures:: fx:: { FxHashMap , FxHashSet } ;
100
99
use rustc_data_structures:: sync;
@@ -883,7 +882,7 @@ where
883
882
fn collect_and_partition_mono_items (
884
883
tcx : TyCtxt < ' _ > ,
885
884
cnum : CrateNum ,
886
- ) -> ( Arc < DefIdSet > , Arc < Vec < Arc < CodegenUnit < ' _ > > > > ) {
885
+ ) -> ( & ' tcx DefIdSet , & ' tcx [ CodegenUnit < ' _ > ] ) {
887
886
assert_eq ! ( cnum, LOCAL_CRATE ) ;
888
887
889
888
let collection_mode = match tcx. sess . opts . debugging_opts . print_mono_items {
@@ -921,10 +920,12 @@ fn collect_and_partition_mono_items(
921
920
let ( codegen_units, _) = tcx. sess . time ( "partition_and_assert_distinct_symbols" , || {
922
921
sync:: join (
923
922
|| {
924
- partition ( tcx, items. iter ( ) . cloned ( ) , tcx. sess . codegen_units ( ) , & inlining_map)
925
- . into_iter ( )
926
- . map ( Arc :: new)
927
- . collect :: < Vec < _ > > ( )
923
+ & * tcx. arena . alloc_from_iter ( partition (
924
+ tcx,
925
+ items. iter ( ) . cloned ( ) ,
926
+ tcx. sess . codegen_units ( ) ,
927
+ & inlining_map,
928
+ ) )
928
929
} ,
929
930
|| assert_symbols_are_distinct ( tcx, items. iter ( ) ) ,
930
931
)
@@ -942,7 +943,7 @@ fn collect_and_partition_mono_items(
942
943
if tcx. sess . opts . debugging_opts . print_mono_items . is_some ( ) {
943
944
let mut item_to_cgus: FxHashMap < _ , Vec < _ > > = Default :: default ( ) ;
944
945
945
- for cgu in & codegen_units {
946
+ for cgu in codegen_units {
946
947
for ( & mono_item, & linkage) in cgu. items ( ) {
947
948
item_to_cgus. entry ( mono_item) . or_default ( ) . push ( ( cgu. name ( ) , linkage) ) ;
948
949
}
@@ -990,7 +991,7 @@ fn collect_and_partition_mono_items(
990
991
}
991
992
}
992
993
993
- ( Arc :: new ( mono_items) , Arc :: new ( codegen_units) )
994
+ ( tcx . arena . alloc ( mono_items) , codegen_units)
994
995
}
995
996
996
997
pub fn provide ( providers : & mut Providers < ' _ > ) {
@@ -1005,7 +1006,6 @@ pub fn provide(providers: &mut Providers<'_>) {
1005
1006
let ( _, all) = tcx. collect_and_partition_mono_items ( LOCAL_CRATE ) ;
1006
1007
all. iter ( )
1007
1008
. find ( |cgu| cgu. name ( ) == name)
1008
- . cloned ( )
1009
1009
. unwrap_or_else ( || panic ! ( "failed to find cgu with name {:?}" , name) )
1010
1010
} ;
1011
1011
}
0 commit comments