@@ -107,7 +107,8 @@ use rustc_middle::middle::codegen_fn_attrs::CodegenFnAttrFlags;
107107use rustc_middle:: middle:: exported_symbols:: { SymbolExportInfo , SymbolExportLevel } ;
108108use rustc_middle:: mir;
109109use rustc_middle:: mir:: mono:: {
110- CodegenUnit , CodegenUnitNameBuilder , InstantiationMode , Linkage , MonoItem , Visibility ,
110+ CodegenUnit , CodegenUnitNameBuilder , InstantiationMode , Linkage , MonoItem , MonoItemData ,
111+ Visibility ,
111112} ;
112113use rustc_middle:: query:: Providers ;
113114use rustc_middle:: ty:: print:: { characteristic_def_id_of_type, with_no_trimmed_paths} ;
@@ -257,7 +258,7 @@ where
257258 internalization_candidates. insert ( mono_item) ;
258259 }
259260
260- cgu. items_mut ( ) . insert ( mono_item, ( linkage, visibility) ) ;
261+ cgu. items_mut ( ) . insert ( mono_item, MonoItemData { linkage, visibility } ) ;
261262
262263 // Get all inlined items that are reachable from `mono_item` without
263264 // going via another root item. This includes drop-glue, functions from
@@ -271,7 +272,9 @@ where
271272 // the `insert` will be a no-op.
272273 for inlined_item in reachable_inlined_items {
273274 // This is a CGU-private copy.
274- cgu. items_mut ( ) . insert ( inlined_item, ( Linkage :: Internal , Visibility :: Default ) ) ;
275+ let linkage = Linkage :: Internal ;
276+ let visibility = Visibility :: Default ;
277+ cgu. items_mut ( ) . insert ( inlined_item, MonoItemData { linkage, visibility } ) ;
275278 }
276279 }
277280
@@ -492,7 +495,7 @@ fn internalize_symbols<'tcx>(
492495 for cgu in codegen_units {
493496 let home_cgu = MonoItemPlacement :: SingleCgu ( cgu. name ( ) ) ;
494497
495- for ( item, linkage_and_visibility ) in cgu. items_mut ( ) {
498+ for ( item, data ) in cgu. items_mut ( ) {
496499 if !internalization_candidates. contains ( item) {
497500 // This item is no candidate for internalizing, so skip it.
498501 continue ;
@@ -520,7 +523,8 @@ fn internalize_symbols<'tcx>(
520523
521524 // If we got here, we did not find any uses from other CGUs, so
522525 // it's fine to make this monomorphization internal.
523- * linkage_and_visibility = ( Linkage :: Internal , Visibility :: Default ) ;
526+ data. linkage = Linkage :: Internal ;
527+ data. visibility = Visibility :: Default ;
524528 }
525529 }
526530}
@@ -537,7 +541,7 @@ fn mark_code_coverage_dead_code_cgu<'tcx>(codegen_units: &mut [CodegenUnit<'tcx>
537541 // function symbols to be included via `-u` or `/include` linker args.
538542 let dead_code_cgu = codegen_units
539543 . iter_mut ( )
540- . filter ( |cgu| cgu. items ( ) . iter ( ) . any ( |( _, ( linkage , _ ) ) | * linkage == Linkage :: External ) )
544+ . filter ( |cgu| cgu. items ( ) . iter ( ) . any ( |( _, data ) | data . linkage == Linkage :: External ) )
541545 . min_by_key ( |cgu| cgu. size_estimate ( ) ) ;
542546
543547 // If there are no CGUs that have externally linked items, then we just
@@ -937,7 +941,8 @@ fn debug_dump<'a, 'tcx: 'a>(
937941 let _ =
938942 writeln ! ( s, " - items: {num_items}, mean size: {mean_size:.1}, sizes: {sizes}" , ) ;
939943
940- for ( item, linkage) in cgu. items_in_deterministic_order ( tcx) {
944+ for ( item, data) in cgu. items_in_deterministic_order ( tcx) {
945+ let linkage = data. linkage ;
941946 let symbol_name = item. symbol_name ( tcx) . name ;
942947 let symbol_hash_start = symbol_name. rfind ( 'h' ) ;
943948 let symbol_hash = symbol_hash_start. map_or ( "<no hash>" , |i| & symbol_name[ i..] ) ;
@@ -1100,8 +1105,8 @@ fn collect_and_partition_mono_items(tcx: TyCtxt<'_>, (): ()) -> (&DefIdSet, &[Co
11001105 let mut item_to_cgus: FxHashMap < _ , Vec < _ > > = Default :: default ( ) ;
11011106
11021107 for cgu in codegen_units {
1103- for ( & mono_item, & linkage ) in cgu. items ( ) {
1104- item_to_cgus. entry ( mono_item) . or_default ( ) . push ( ( cgu. name ( ) , linkage) ) ;
1108+ for ( & mono_item, & data ) in cgu. items ( ) {
1109+ item_to_cgus. entry ( mono_item) . or_default ( ) . push ( ( cgu. name ( ) , data . linkage ) ) ;
11051110 }
11061111 }
11071112
@@ -1114,7 +1119,7 @@ fn collect_and_partition_mono_items(tcx: TyCtxt<'_>, (): ()) -> (&DefIdSet, &[Co
11141119 let cgus = item_to_cgus. get_mut ( i) . unwrap_or ( & mut empty) ;
11151120 cgus. sort_by_key ( |( name, _) | * name) ;
11161121 cgus. dedup ( ) ;
1117- for & ( ref cgu_name, ( linkage, _ ) ) in cgus. iter ( ) {
1122+ for & ( ref cgu_name, linkage) in cgus. iter ( ) {
11181123 output. push ( ' ' ) ;
11191124 output. push_str ( cgu_name. as_str ( ) ) ;
11201125
0 commit comments