@@ -358,7 +358,7 @@ fn collect_items_rec<'tcx>(
358
358
let instance = Instance :: mono ( tcx, def_id) ;
359
359
360
360
// Sanity check whether this ended up being collected accidentally
361
- debug_assert ! ( should_monomorphize_locally ( tcx, & instance) ) ;
361
+ debug_assert ! ( should_codegen_locally ( tcx, & instance) ) ;
362
362
363
363
let ty = instance. monomorphic_ty ( tcx) ;
364
364
visit_drop_use ( tcx, ty, true , starting_point. span , & mut neighbors) ;
@@ -371,7 +371,7 @@ fn collect_items_rec<'tcx>(
371
371
}
372
372
MonoItem :: Fn ( instance) => {
373
373
// Sanity check whether this ended up being collected accidentally
374
- debug_assert ! ( should_monomorphize_locally ( tcx, & instance) ) ;
374
+ debug_assert ! ( should_codegen_locally ( tcx, & instance) ) ;
375
375
376
376
// Keep track of the monomorphization recursion depth
377
377
recursion_depth_reset =
@@ -584,7 +584,7 @@ impl<'a, 'tcx> MirVisitor<'tcx> for MirNeighborCollector<'a, 'tcx> {
584
584
substs,
585
585
ty:: ClosureKind :: FnOnce ,
586
586
) ;
587
- if should_monomorphize_locally ( self . tcx , & instance) {
587
+ if should_codegen_locally ( self . tcx , & instance) {
588
588
self . output . push ( create_fn_mono_item ( instance, span) ) ;
589
589
}
590
590
}
@@ -596,14 +596,14 @@ impl<'a, 'tcx> MirVisitor<'tcx> for MirNeighborCollector<'a, 'tcx> {
596
596
let exchange_malloc_fn_def_id =
597
597
tcx. require_lang_item ( ExchangeMallocFnLangItem , None ) ;
598
598
let instance = Instance :: mono ( tcx, exchange_malloc_fn_def_id) ;
599
- if should_monomorphize_locally ( tcx, & instance) {
599
+ if should_codegen_locally ( tcx, & instance) {
600
600
self . output . push ( create_fn_mono_item ( instance, span) ) ;
601
601
}
602
602
}
603
603
mir:: Rvalue :: ThreadLocalRef ( def_id) => {
604
604
assert ! ( self . tcx. is_thread_local_static( def_id) ) ;
605
605
let instance = Instance :: mono ( self . tcx , def_id) ;
606
- if should_monomorphize_locally ( self . tcx , & instance) {
606
+ if should_codegen_locally ( self . tcx , & instance) {
607
607
trace ! ( "collecting thread-local static {:?}" , def_id) ;
608
608
self . output . push ( respan ( span, MonoItem :: Static ( def_id) ) ) ;
609
609
}
@@ -664,7 +664,7 @@ impl<'a, 'tcx> MirVisitor<'tcx> for MirNeighborCollector<'a, 'tcx> {
664
664
}
665
665
mir:: InlineAsmOperand :: SymStatic { def_id } => {
666
666
let instance = Instance :: mono ( self . tcx , def_id) ;
667
- if should_monomorphize_locally ( self . tcx , & instance) {
667
+ if should_codegen_locally ( self . tcx , & instance) {
668
668
trace ! ( "collecting asm sym static {:?}" , def_id) ;
669
669
self . output . push ( respan ( source, MonoItem :: Static ( def_id) ) ) ;
670
670
}
@@ -735,7 +735,7 @@ fn visit_instance_use<'tcx>(
735
735
output : & mut Vec < Spanned < MonoItem < ' tcx > > > ,
736
736
) {
737
737
debug ! ( "visit_item_use({:?}, is_direct_call={:?})" , instance, is_direct_call) ;
738
- if !should_monomorphize_locally ( tcx, & instance) {
738
+ if !should_codegen_locally ( tcx, & instance) {
739
739
return ;
740
740
}
741
741
@@ -766,7 +766,7 @@ fn visit_instance_use<'tcx>(
766
766
// Returns `true` if we should codegen an instance in the local crate.
767
767
// Returns `false` if we can just link to the upstream crate and therefore don't
768
768
// need a mono item.
769
- fn should_monomorphize_locally < ' tcx > ( tcx : TyCtxt < ' tcx > , instance : & Instance < ' tcx > ) -> bool {
769
+ fn should_codegen_locally < ' tcx > ( tcx : TyCtxt < ' tcx > , instance : & Instance < ' tcx > ) -> bool {
770
770
let def_id = match instance. def {
771
771
ty:: InstanceDef :: Item ( def) => def. did ,
772
772
ty:: InstanceDef :: DropGlue ( def_id, Some ( _) ) => def_id,
@@ -944,7 +944,7 @@ fn create_mono_items_for_vtable_methods<'tcx>(
944
944
)
945
945
. unwrap ( )
946
946
} )
947
- . filter ( |& instance| should_monomorphize_locally ( tcx, & instance) )
947
+ . filter ( |& instance| should_codegen_locally ( tcx, & instance) )
948
948
. map ( |item| create_fn_mono_item ( item, source) ) ;
949
949
output. extend ( methods) ;
950
950
}
@@ -1164,8 +1164,7 @@ fn create_mono_items_for_default_impls<'tcx>(
1164
1164
. unwrap ( ) ;
1165
1165
1166
1166
let mono_item = create_fn_mono_item ( instance, DUMMY_SP ) ;
1167
- if mono_item. node . is_instantiable ( tcx)
1168
- && should_monomorphize_locally ( tcx, & instance)
1167
+ if mono_item. node . is_instantiable ( tcx) && should_codegen_locally ( tcx, & instance)
1169
1168
{
1170
1169
output. push ( mono_item) ;
1171
1170
}
@@ -1186,7 +1185,7 @@ fn collect_miri<'tcx>(
1186
1185
GlobalAlloc :: Static ( def_id) => {
1187
1186
assert ! ( !tcx. is_thread_local_static( def_id) ) ;
1188
1187
let instance = Instance :: mono ( tcx, def_id) ;
1189
- if should_monomorphize_locally ( tcx, & instance) {
1188
+ if should_codegen_locally ( tcx, & instance) {
1190
1189
trace ! ( "collecting static {:?}" , def_id) ;
1191
1190
output. push ( dummy_spanned ( MonoItem :: Static ( def_id) ) ) ;
1192
1191
}
@@ -1200,7 +1199,7 @@ fn collect_miri<'tcx>(
1200
1199
}
1201
1200
}
1202
1201
GlobalAlloc :: Function ( fn_instance) => {
1203
- if should_monomorphize_locally ( tcx, & fn_instance) {
1202
+ if should_codegen_locally ( tcx, & fn_instance) {
1204
1203
trace ! ( "collecting {:?} with {:#?}" , alloc_id, fn_instance) ;
1205
1204
output. push ( create_fn_mono_item ( fn_instance, DUMMY_SP ) ) ;
1206
1205
}
0 commit comments