@@ -368,7 +368,7 @@ fn collect_items_rec<'a, 'tcx: 'a>(tcx: TyCtxt<'a, 'tcx, 'tcx>,
368
368
let instance = Instance :: mono ( tcx, def_id) ;
369
369
370
370
// Sanity check whether this ended up being collected accidentally
371
- debug_assert ! ( should_trans_locally ( tcx, & instance) ) ;
371
+ debug_assert ! ( should_monomorphize_locally ( tcx, & instance) ) ;
372
372
373
373
let ty = instance. ty ( tcx) ;
374
374
visit_drop_use ( tcx, ty, true , & mut neighbors) ;
@@ -379,7 +379,7 @@ fn collect_items_rec<'a, 'tcx: 'a>(tcx: TyCtxt<'a, 'tcx, 'tcx>,
379
379
}
380
380
MonoItem :: Fn ( instance) => {
381
381
// Sanity check whether this ended up being collected accidentally
382
- debug_assert ! ( should_trans_locally ( tcx, & instance) ) ;
382
+ debug_assert ! ( should_monomorphize_locally ( tcx, & instance) ) ;
383
383
384
384
// Keep track of the monomorphization recursion depth
385
385
recursion_depth_reset = Some ( check_recursion_limit ( tcx,
@@ -411,13 +411,13 @@ fn record_accesses<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>,
411
411
caller : MonoItem < ' tcx > ,
412
412
callees : & [ MonoItem < ' tcx > ] ,
413
413
inlining_map : & mut InliningMap < ' tcx > ) {
414
- let is_inlining_candidate = |trans_item : & MonoItem < ' tcx > | {
415
- trans_item . instantiation_mode ( tcx) == InstantiationMode :: LocalCopy
414
+ let is_inlining_candidate = |mono_item : & MonoItem < ' tcx > | {
415
+ mono_item . instantiation_mode ( tcx) == InstantiationMode :: LocalCopy
416
416
} ;
417
417
418
418
let accesses = callees. into_iter ( )
419
- . map ( |trans_item | {
420
- ( * trans_item , is_inlining_candidate ( trans_item ) )
419
+ . map ( |mono_item | {
420
+ ( * mono_item , is_inlining_candidate ( mono_item ) )
421
421
} ) ;
422
422
423
423
inlining_map. record_accesses ( caller, accesses) ;
@@ -541,7 +541,7 @@ impl<'a, 'tcx> MirVisitor<'tcx> for MirNeighborCollector<'a, 'tcx> {
541
541
ty:: TyClosure ( def_id, substs) => {
542
542
let instance = monomorphize:: resolve_closure (
543
543
self . tcx , def_id, substs, ty:: ClosureKind :: FnOnce ) ;
544
- self . output . push ( create_fn_trans_item ( instance) ) ;
544
+ self . output . push ( create_fn_mono_item ( instance) ) ;
545
545
}
546
546
_ => bug ! ( ) ,
547
547
}
@@ -553,8 +553,8 @@ impl<'a, 'tcx> MirVisitor<'tcx> for MirNeighborCollector<'a, 'tcx> {
553
553
. require ( ExchangeMallocFnLangItem )
554
554
. unwrap_or_else ( |e| tcx. sess . fatal ( & e) ) ;
555
555
let instance = Instance :: mono ( tcx, exchange_malloc_fn_def_id) ;
556
- if should_trans_locally ( tcx, & instance) {
557
- self . output . push ( create_fn_trans_item ( instance) ) ;
556
+ if should_monomorphize_locally ( tcx, & instance) {
557
+ self . output . push ( create_fn_mono_item ( instance) ) ;
558
558
}
559
559
}
560
560
_ => { /* not interesting */ }
@@ -644,7 +644,7 @@ impl<'a, 'tcx> MirVisitor<'tcx> for MirNeighborCollector<'a, 'tcx> {
644
644
645
645
let tcx = self . tcx ;
646
646
let instance = Instance :: mono ( tcx, static_. def_id ) ;
647
- if should_trans_locally ( tcx, & instance) {
647
+ if should_monomorphize_locally ( tcx, & instance) {
648
648
let node_id = tcx. hir . as_local_node_id ( static_. def_id ) . unwrap ( ) ;
649
649
self . output . push ( MonoItem :: Static ( node_id) ) ;
650
650
}
@@ -682,7 +682,7 @@ fn visit_instance_use<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>,
682
682
output : & mut Vec < MonoItem < ' tcx > > )
683
683
{
684
684
debug ! ( "visit_item_use({:?}, is_direct_call={:?})" , instance, is_direct_call) ;
685
- if !should_trans_locally ( tcx, & instance) {
685
+ if !should_monomorphize_locally ( tcx, & instance) {
686
686
return
687
687
}
688
688
@@ -696,26 +696,26 @@ fn visit_instance_use<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>,
696
696
ty:: InstanceDef :: DropGlue ( _, None ) => {
697
697
// don't need to emit shim if we are calling directly.
698
698
if !is_direct_call {
699
- output. push ( create_fn_trans_item ( instance) ) ;
699
+ output. push ( create_fn_mono_item ( instance) ) ;
700
700
}
701
701
}
702
702
ty:: InstanceDef :: DropGlue ( _, Some ( _) ) => {
703
- output. push ( create_fn_trans_item ( instance) ) ;
703
+ output. push ( create_fn_mono_item ( instance) ) ;
704
704
}
705
705
ty:: InstanceDef :: ClosureOnceShim { .. } |
706
706
ty:: InstanceDef :: Item ( ..) |
707
707
ty:: InstanceDef :: FnPtrShim ( ..) |
708
708
ty:: InstanceDef :: CloneShim ( ..) => {
709
- output. push ( create_fn_trans_item ( instance) ) ;
709
+ output. push ( create_fn_mono_item ( instance) ) ;
710
710
}
711
711
}
712
712
}
713
713
714
714
// Returns true if we should translate an instance in the local crate.
715
715
// Returns false if we can just link to the upstream crate and therefore don't
716
- // need a translation item.
717
- fn should_trans_locally < ' a , ' tcx > ( tcx : TyCtxt < ' a , ' tcx , ' tcx > , instance : & Instance < ' tcx > )
718
- -> bool {
716
+ // need a mono item.
717
+ fn should_monomorphize_locally < ' a , ' tcx > ( tcx : TyCtxt < ' a , ' tcx , ' tcx > , instance : & Instance < ' tcx > )
718
+ -> bool {
719
719
let def_id = match instance. def {
720
720
ty:: InstanceDef :: Item ( def_id) => def_id,
721
721
ty:: InstanceDef :: ClosureOnceShim { .. } |
@@ -739,7 +739,7 @@ fn should_trans_locally<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, instance: &Instan
739
739
false
740
740
} else {
741
741
if !tcx. is_mir_available ( def_id) {
742
- bug ! ( "Cannot create local trans -item for {:?}" , def_id)
742
+ bug ! ( "Cannot create local mono -item for {:?}" , def_id)
743
743
}
744
744
true
745
745
}
@@ -834,8 +834,8 @@ fn find_vtable_types_for_unsizing<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>,
834
834
}
835
835
}
836
836
837
- fn create_fn_trans_item < ' a , ' tcx > ( instance : Instance < ' tcx > ) -> MonoItem < ' tcx > {
838
- debug ! ( "create_fn_trans_item (instance={})" , instance) ;
837
+ fn create_fn_mono_item < ' a , ' tcx > ( instance : Instance < ' tcx > ) -> MonoItem < ' tcx > {
838
+ debug ! ( "create_fn_mono_item (instance={})" , instance) ;
839
839
MonoItem :: Fn ( instance)
840
840
}
841
841
@@ -861,8 +861,8 @@ fn create_mono_items_for_vtable_methods<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>,
861
861
ty:: ParamEnv :: empty ( traits:: Reveal :: All ) ,
862
862
def_id,
863
863
substs) . unwrap ( ) )
864
- . filter ( |& instance| should_trans_locally ( tcx, & instance) )
865
- . map ( |instance| create_fn_trans_item ( instance) ) ;
864
+ . filter ( |& instance| should_monomorphize_locally ( tcx, & instance) )
865
+ . map ( |instance| create_fn_mono_item ( instance) ) ;
866
866
output. extend ( methods) ;
867
867
}
868
868
// Also add the destructor
@@ -1009,7 +1009,7 @@ fn create_mono_items_for_default_impls<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>,
1009
1009
1010
1010
let impl_def_id = tcx. hir . local_def_id ( item. id ) ;
1011
1011
1012
- debug ! ( "create_trans_items_for_default_impls (item={})" ,
1012
+ debug ! ( "create_mono_items_for_default_impls (item={})" ,
1013
1013
def_id_to_string( tcx, impl_def_id) ) ;
1014
1014
1015
1015
if let Some ( trait_ref) = tcx. impl_trait_ref ( impl_def_id) {
@@ -1032,9 +1032,10 @@ fn create_mono_items_for_default_impls<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>,
1032
1032
method. def_id ,
1033
1033
callee_substs) . unwrap ( ) ;
1034
1034
1035
- let trans_item = create_fn_trans_item ( instance) ;
1036
- if trans_item. is_instantiable ( tcx) && should_trans_locally ( tcx, & instance) {
1037
- output. push ( trans_item) ;
1035
+ let mono_item = create_fn_mono_item ( instance) ;
1036
+ if mono_item. is_instantiable ( tcx)
1037
+ && should_monomorphize_locally ( tcx, & instance) {
1038
+ output. push ( mono_item) ;
1038
1039
}
1039
1040
}
1040
1041
}
0 commit comments