@@ -109,13 +109,12 @@ use rustc_middle::bug;
109109use rustc_middle:: middle:: codegen_fn_attrs:: CodegenFnAttrFlags ;
110110use rustc_middle:: middle:: exported_symbols:: { SymbolExportInfo , SymbolExportLevel } ;
111111use rustc_middle:: mir:: mono:: {
112- CodegenUnit , CodegenUnitNameBuilder , InstantiationMode , Linkage , MonoItem , MonoItemData ,
113- Visibility ,
112+ CodegenUnit , CodegenUnitNameBuilder , MonoItemPartitions , InstantiationMode , Linkage , MonoItem ,
113+ MonoItemData , Visibility ,
114114} ;
115115use rustc_middle:: ty:: print:: { characteristic_def_id_of_type, with_no_trimmed_paths} ;
116116use rustc_middle:: ty:: { self , InstanceKind , TyCtxt } ;
117117use rustc_middle:: util:: Providers ;
118- use rustc_session:: CodegenUnits ;
119118use rustc_session:: config:: { DumpMonoStatsFormat , SwitchWithOptPath } ;
120119use rustc_span:: Symbol ;
121120use rustc_target:: spec:: SymbolVisibility ;
@@ -402,7 +401,7 @@ fn merge_codegen_units<'tcx>(
402401 // critical they aren't merged. Also, some tests use explicit small values
403402 // and likewise won't work if small CGUs are merged.
404403 while cx. tcx . sess . opts . incremental . is_none ( )
405- && matches ! ( cx. tcx. sess. codegen_units( ) , CodegenUnits :: Default ( _) )
404+ && matches ! ( cx. tcx. sess. codegen_units( ) , rustc_session :: CodegenUnits :: Default ( _) )
406405 && codegen_units. len ( ) > 1
407406 && codegen_units. iter ( ) . any ( |cgu| cgu. size_estimate ( ) < NON_INCR_MIN_CGU_SIZE )
408407 {
@@ -1114,7 +1113,7 @@ where
11141113 }
11151114}
11161115
1117- fn collect_and_partition_mono_items ( tcx : TyCtxt < ' _ > , ( ) : ( ) ) -> ( & DefIdSet , & [ CodegenUnit < ' _ > ] ) {
1116+ fn collect_and_partition_mono_items ( tcx : TyCtxt < ' _ > , ( ) : ( ) ) -> MonoItemPartitions < ' _ > {
11181117 let collection_strategy = match tcx. sess . opts . unstable_opts . print_mono_items {
11191118 Some ( ref s) => {
11201119 let mode = s. to_lowercase ( ) ;
@@ -1236,7 +1235,7 @@ fn collect_and_partition_mono_items(tcx: TyCtxt<'_>, (): ()) -> (&DefIdSet, &[Co
12361235 }
12371236 }
12381237
1239- ( tcx. arena . alloc ( mono_items) , codegen_units)
1238+ MonoItemPartitions { all_mono_items : tcx. arena . alloc ( mono_items) , codegen_units }
12401239}
12411240
12421241/// Outputs stats about instantiation counts and estimated size, per `MonoItem`'s
@@ -1319,14 +1318,13 @@ fn dump_mono_items_stats<'tcx>(
13191318pub ( crate ) fn provide ( providers : & mut Providers ) {
13201319 providers. collect_and_partition_mono_items = collect_and_partition_mono_items;
13211320
1322- providers. is_codegened_item = |tcx, def_id| {
1323- let ( all_mono_items, _) = tcx. collect_and_partition_mono_items ( ( ) ) ;
1324- all_mono_items. contains ( & def_id)
1325- } ;
1321+ providers. is_codegened_item =
1322+ |tcx, def_id| tcx. collect_and_partition_mono_items ( ( ) ) . all_mono_items . contains ( & def_id) ;
13261323
13271324 providers. codegen_unit = |tcx, name| {
1328- let ( _, all) = tcx. collect_and_partition_mono_items ( ( ) ) ;
1329- all. iter ( )
1325+ tcx. collect_and_partition_mono_items ( ( ) )
1326+ . codegen_units
1327+ . iter ( )
13301328 . find ( |cgu| cgu. name ( ) == name)
13311329 . unwrap_or_else ( || panic ! ( "failed to find cgu with name {name:?}" ) )
13321330 } ;
0 commit comments