@@ -110,7 +110,7 @@ use rustc_middle::middle::codegen_fn_attrs::CodegenFnAttrFlags;
110110use rustc_middle:: middle:: exported_symbols:: { SymbolExportInfo , SymbolExportLevel } ;
111111use rustc_middle:: mir:: mono:: {
112112 CodegenUnit , CodegenUnitNameBuilder , InstantiationMode , Linkage , MonoItem , MonoItemData ,
113- Visibility ,
113+ MonoItemPartitions , Visibility ,
114114} ;
115115use rustc_middle:: ty:: print:: { characteristic_def_id_of_type, with_no_trimmed_paths} ;
116116use rustc_middle:: ty:: { self , InstanceKind , TyCtxt } ;
@@ -1114,7 +1114,7 @@ where
11141114 }
11151115}
11161116
1117- fn collect_and_partition_mono_items ( tcx : TyCtxt < ' _ > , ( ) : ( ) ) -> ( & DefIdSet , & [ CodegenUnit < ' _ > ] ) {
1117+ fn collect_and_partition_mono_items ( tcx : TyCtxt < ' _ > , ( ) : ( ) ) -> MonoItemPartitions < ' _ > {
11181118 let collection_strategy = match tcx. sess . opts . unstable_opts . print_mono_items {
11191119 Some ( ref s) => {
11201120 let mode = s. to_lowercase ( ) ;
@@ -1236,7 +1236,7 @@ fn collect_and_partition_mono_items(tcx: TyCtxt<'_>, (): ()) -> (&DefIdSet, &[Co
12361236 }
12371237 }
12381238
1239- ( tcx. arena . alloc ( mono_items) , codegen_units)
1239+ MonoItemPartitions { all_mono_items : tcx. arena . alloc ( mono_items) , codegen_units }
12401240}
12411241
12421242/// Outputs stats about instantiation counts and estimated size, per `MonoItem`'s
@@ -1319,14 +1319,13 @@ fn dump_mono_items_stats<'tcx>(
13191319pub ( crate ) fn provide ( providers : & mut Providers ) {
13201320 providers. collect_and_partition_mono_items = collect_and_partition_mono_items;
13211321
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- } ;
1322+ providers. is_codegened_item =
1323+ |tcx, def_id| tcx. collect_and_partition_mono_items ( ( ) ) . all_mono_items . contains ( & def_id) ;
13261324
13271325 providers. codegen_unit = |tcx, name| {
1328- let ( _, all) = tcx. collect_and_partition_mono_items ( ( ) ) ;
1329- all. iter ( )
1326+ tcx. collect_and_partition_mono_items ( ( ) )
1327+ . codegen_units
1328+ . iter ( )
13301329 . find ( |cgu| cgu. name ( ) == name)
13311330 . unwrap_or_else ( || panic ! ( "failed to find cgu with name {name:?}" ) )
13321331 } ;
0 commit comments