@@ -110,7 +110,7 @@ use rustc_middle::middle::codegen_fn_attrs::CodegenFnAttrFlags;
110
110
use rustc_middle:: middle:: exported_symbols:: { SymbolExportInfo , SymbolExportLevel } ;
111
111
use rustc_middle:: mir:: mono:: {
112
112
CodegenUnit , CodegenUnitNameBuilder , InstantiationMode , Linkage , MonoItem , MonoItemData ,
113
- Visibility ,
113
+ MonoItemPartitions , Visibility ,
114
114
} ;
115
115
use rustc_middle:: ty:: print:: { characteristic_def_id_of_type, with_no_trimmed_paths} ;
116
116
use rustc_middle:: ty:: { self , InstanceKind , TyCtxt } ;
@@ -1114,7 +1114,7 @@ where
1114
1114
}
1115
1115
}
1116
1116
1117
- fn collect_and_partition_mono_items ( tcx : TyCtxt < ' _ > , ( ) : ( ) ) -> ( & DefIdSet , & [ CodegenUnit < ' _ > ] ) {
1117
+ fn collect_and_partition_mono_items ( tcx : TyCtxt < ' _ > , ( ) : ( ) ) -> MonoItemPartitions < ' _ > {
1118
1118
let collection_strategy = match tcx. sess . opts . unstable_opts . print_mono_items {
1119
1119
Some ( ref s) => {
1120
1120
let mode = s. to_lowercase ( ) ;
@@ -1236,7 +1236,7 @@ fn collect_and_partition_mono_items(tcx: TyCtxt<'_>, (): ()) -> (&DefIdSet, &[Co
1236
1236
}
1237
1237
}
1238
1238
1239
- ( tcx. arena . alloc ( mono_items) , codegen_units)
1239
+ MonoItemPartitions { all_mono_items : tcx. arena . alloc ( mono_items) , codegen_units }
1240
1240
}
1241
1241
1242
1242
/// Outputs stats about instantiation counts and estimated size, per `MonoItem`'s
@@ -1319,14 +1319,13 @@ fn dump_mono_items_stats<'tcx>(
1319
1319
pub ( crate ) fn provide ( providers : & mut Providers ) {
1320
1320
providers. collect_and_partition_mono_items = collect_and_partition_mono_items;
1321
1321
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) ;
1326
1324
1327
1325
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 ( )
1330
1329
. find ( |cgu| cgu. name ( ) == name)
1331
1330
. unwrap_or_else ( || panic ! ( "failed to find cgu with name {name:?}" ) )
1332
1331
} ;
0 commit comments