@@ -109,13 +109,12 @@ use rustc_middle::bug;
109
109
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
- CodegenUnit , CodegenUnitNameBuilder , InstantiationMode , Linkage , MonoItem , MonoItemData ,
113
- Visibility ,
112
+ CodegenUnit , CodegenUnitNameBuilder , MonoItemPartitions , InstantiationMode , Linkage , MonoItem ,
113
+ MonoItemData , 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 } ;
117
117
use rustc_middle:: util:: Providers ;
118
- use rustc_session:: CodegenUnits ;
119
118
use rustc_session:: config:: { DumpMonoStatsFormat , SwitchWithOptPath } ;
120
119
use rustc_span:: Symbol ;
121
120
use rustc_target:: spec:: SymbolVisibility ;
@@ -402,7 +401,7 @@ fn merge_codegen_units<'tcx>(
402
401
// critical they aren't merged. Also, some tests use explicit small values
403
402
// and likewise won't work if small CGUs are merged.
404
403
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 ( _) )
406
405
&& codegen_units. len ( ) > 1
407
406
&& codegen_units. iter ( ) . any ( |cgu| cgu. size_estimate ( ) < NON_INCR_MIN_CGU_SIZE )
408
407
{
@@ -1114,7 +1113,7 @@ where
1114
1113
}
1115
1114
}
1116
1115
1117
- fn collect_and_partition_mono_items ( tcx : TyCtxt < ' _ > , ( ) : ( ) ) -> ( & DefIdSet , & [ CodegenUnit < ' _ > ] ) {
1116
+ fn collect_and_partition_mono_items ( tcx : TyCtxt < ' _ > , ( ) : ( ) ) -> MonoItemPartitions < ' _ > {
1118
1117
let collection_strategy = match tcx. sess . opts . unstable_opts . print_mono_items {
1119
1118
Some ( ref s) => {
1120
1119
let mode = s. to_lowercase ( ) ;
@@ -1236,7 +1235,7 @@ fn collect_and_partition_mono_items(tcx: TyCtxt<'_>, (): ()) -> (&DefIdSet, &[Co
1236
1235
}
1237
1236
}
1238
1237
1239
- ( tcx. arena . alloc ( mono_items) , codegen_units)
1238
+ MonoItemPartitions { all_mono_items : tcx. arena . alloc ( mono_items) , codegen_units }
1240
1239
}
1241
1240
1242
1241
/// Outputs stats about instantiation counts and estimated size, per `MonoItem`'s
@@ -1319,14 +1318,13 @@ fn dump_mono_items_stats<'tcx>(
1319
1318
pub ( crate ) fn provide ( providers : & mut Providers ) {
1320
1319
providers. collect_and_partition_mono_items = collect_and_partition_mono_items;
1321
1320
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) ;
1326
1323
1327
1324
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 ( )
1330
1328
. find ( |cgu| cgu. name ( ) == name)
1331
1329
. unwrap_or_else ( || panic ! ( "failed to find cgu with name {name:?}" ) )
1332
1330
} ;
0 commit comments