@@ -195,7 +195,7 @@ use rustc::hir::map as hir_map;
195
195
use rustc:: hir:: def_id:: DefId ;
196
196
use rustc:: middle:: const_val:: ConstVal ;
197
197
use rustc:: middle:: lang_items:: { ExchangeMallocFnLangItem } ;
198
- use rustc:: middle:: trans:: TransItem ;
198
+ use rustc:: middle:: trans:: MonoItem ;
199
199
use rustc:: traits;
200
200
use rustc:: ty:: subst:: Substs ;
201
201
use rustc:: ty:: { self , TypeFoldable , Ty , TyCtxt } ;
@@ -226,8 +226,8 @@ pub struct InliningMap<'tcx> {
226
226
// accessed by it.
227
227
// The two numbers in the tuple are the start (inclusive) and
228
228
// end index (exclusive) within the `targets` vecs.
229
- index : FxHashMap < TransItem < ' tcx > , ( usize , usize ) > ,
230
- targets : Vec < TransItem < ' tcx > > ,
229
+ index : FxHashMap < MonoItem < ' tcx > , ( usize , usize ) > ,
230
+ targets : Vec < MonoItem < ' tcx > > ,
231
231
232
232
// Contains one bit per translation item in the `targets` field. That bit
233
233
// is true if that translation item needs to be inlined into every CGU.
@@ -245,9 +245,9 @@ impl<'tcx> InliningMap<'tcx> {
245
245
}
246
246
247
247
fn record_accesses < I > ( & mut self ,
248
- source : TransItem < ' tcx > ,
248
+ source : MonoItem < ' tcx > ,
249
249
new_targets : I )
250
- where I : Iterator < Item =( TransItem < ' tcx > , bool ) > + ExactSizeIterator
250
+ where I : Iterator < Item =( MonoItem < ' tcx > , bool ) > + ExactSizeIterator
251
251
{
252
252
assert ! ( !self . index. contains_key( & source) ) ;
253
253
@@ -271,8 +271,8 @@ impl<'tcx> InliningMap<'tcx> {
271
271
272
272
// Internally iterate over all items referenced by `source` which will be
273
273
// made available for inlining.
274
- pub fn with_inlining_candidates < F > ( & self , source : TransItem < ' tcx > , mut f : F )
275
- where F : FnMut ( TransItem < ' tcx > )
274
+ pub fn with_inlining_candidates < F > ( & self , source : MonoItem < ' tcx > , mut f : F )
275
+ where F : FnMut ( MonoItem < ' tcx > )
276
276
{
277
277
if let Some ( & ( start_index, end_index) ) = self . index . get ( & source) {
278
278
for ( i, candidate) in self . targets [ start_index .. end_index]
@@ -287,7 +287,7 @@ impl<'tcx> InliningMap<'tcx> {
287
287
288
288
// Internally iterate over all items and the things each accesses.
289
289
pub fn iter_accesses < F > ( & self , mut f : F )
290
- where F : FnMut ( TransItem < ' tcx > , & [ TransItem < ' tcx > ] )
290
+ where F : FnMut ( MonoItem < ' tcx > , & [ MonoItem < ' tcx > ] )
291
291
{
292
292
for ( & accessor, & ( start_index, end_index) ) in & self . index {
293
293
f ( accessor, & self . targets [ start_index .. end_index] )
@@ -297,7 +297,7 @@ impl<'tcx> InliningMap<'tcx> {
297
297
298
298
pub fn collect_crate_translation_items < ' a , ' tcx > ( tcx : TyCtxt < ' a , ' tcx , ' tcx > ,
299
299
mode : TransItemCollectionMode )
300
- -> ( FxHashSet < TransItem < ' tcx > > ,
300
+ -> ( FxHashSet < MonoItem < ' tcx > > ,
301
301
InliningMap < ' tcx > ) {
302
302
let roots = collect_roots ( tcx, mode) ;
303
303
@@ -321,7 +321,7 @@ pub fn collect_crate_translation_items<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>,
321
321
// start monomorphizing from.
322
322
fn collect_roots < ' a , ' tcx > ( tcx : TyCtxt < ' a , ' tcx , ' tcx > ,
323
323
mode : TransItemCollectionMode )
324
- -> Vec < TransItem < ' tcx > > {
324
+ -> Vec < MonoItem < ' tcx > > {
325
325
debug ! ( "Collecting roots" ) ;
326
326
let mut roots = Vec :: new ( ) ;
327
327
@@ -350,8 +350,8 @@ fn collect_roots<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>,
350
350
351
351
// Collect all monomorphized translation items reachable from `starting_point`
352
352
fn collect_items_rec < ' a , ' tcx : ' a > ( tcx : TyCtxt < ' a , ' tcx , ' tcx > ,
353
- starting_point : TransItem < ' tcx > ,
354
- visited : & mut FxHashSet < TransItem < ' tcx > > ,
353
+ starting_point : MonoItem < ' tcx > ,
354
+ visited : & mut FxHashSet < MonoItem < ' tcx > > ,
355
355
recursion_depths : & mut DefIdMap < usize > ,
356
356
inlining_map : & mut InliningMap < ' tcx > ) {
357
357
if !visited. insert ( starting_point. clone ( ) ) {
@@ -364,7 +364,7 @@ fn collect_items_rec<'a, 'tcx: 'a>(tcx: TyCtxt<'a, 'tcx, 'tcx>,
364
364
let recursion_depth_reset;
365
365
366
366
match starting_point {
367
- TransItem :: Static ( node_id) => {
367
+ MonoItem :: Static ( node_id) => {
368
368
let def_id = tcx. hir . local_def_id ( node_id) ;
369
369
let instance = Instance :: mono ( tcx, def_id) ;
370
370
@@ -378,7 +378,7 @@ fn collect_items_rec<'a, 'tcx: 'a>(tcx: TyCtxt<'a, 'tcx, 'tcx>,
378
378
379
379
collect_neighbours ( tcx, instance, true , & mut neighbors) ;
380
380
}
381
- TransItem :: Fn ( instance) => {
381
+ MonoItem :: Fn ( instance) => {
382
382
// Sanity check whether this ended up being collected accidentally
383
383
debug_assert ! ( should_trans_locally( tcx, & instance) ) ;
384
384
@@ -390,7 +390,7 @@ fn collect_items_rec<'a, 'tcx: 'a>(tcx: TyCtxt<'a, 'tcx, 'tcx>,
390
390
391
391
collect_neighbours ( tcx, instance, false , & mut neighbors) ;
392
392
}
393
- TransItem :: GlobalAsm ( ..) => {
393
+ MonoItem :: GlobalAsm ( ..) => {
394
394
recursion_depth_reset = None ;
395
395
}
396
396
}
@@ -409,10 +409,10 @@ fn collect_items_rec<'a, 'tcx: 'a>(tcx: TyCtxt<'a, 'tcx, 'tcx>,
409
409
}
410
410
411
411
fn record_accesses < ' a , ' tcx > ( tcx : TyCtxt < ' a , ' tcx , ' tcx > ,
412
- caller : TransItem < ' tcx > ,
413
- callees : & [ TransItem < ' tcx > ] ,
412
+ caller : MonoItem < ' tcx > ,
413
+ callees : & [ MonoItem < ' tcx > ] ,
414
414
inlining_map : & mut InliningMap < ' tcx > ) {
415
- let is_inlining_candidate = |trans_item : & TransItem < ' tcx > | {
415
+ let is_inlining_candidate = |trans_item : & MonoItem < ' tcx > | {
416
416
trans_item. instantiation_mode ( tcx) == InstantiationMode :: LocalCopy
417
417
} ;
418
418
@@ -495,7 +495,7 @@ fn check_type_length_limit<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>,
495
495
struct MirNeighborCollector < ' a , ' tcx : ' a > {
496
496
tcx : TyCtxt < ' a , ' tcx , ' tcx > ,
497
497
mir : & ' a mir:: Mir < ' tcx > ,
498
- output : & ' a mut Vec < TransItem < ' tcx > > ,
498
+ output : & ' a mut Vec < MonoItem < ' tcx > > ,
499
499
param_substs : & ' tcx Substs < ' tcx > ,
500
500
const_context : bool ,
501
501
}
@@ -647,7 +647,7 @@ impl<'a, 'tcx> MirVisitor<'tcx> for MirNeighborCollector<'a, 'tcx> {
647
647
let instance = Instance :: mono ( tcx, static_. def_id ) ;
648
648
if should_trans_locally ( tcx, & instance) {
649
649
let node_id = tcx. hir . as_local_node_id ( static_. def_id ) . unwrap ( ) ;
650
- self . output . push ( TransItem :: Static ( node_id) ) ;
650
+ self . output . push ( MonoItem :: Static ( node_id) ) ;
651
651
}
652
652
653
653
self . super_static ( static_, context, location) ;
@@ -657,7 +657,7 @@ impl<'a, 'tcx> MirVisitor<'tcx> for MirNeighborCollector<'a, 'tcx> {
657
657
fn visit_drop_use < ' a , ' tcx > ( tcx : TyCtxt < ' a , ' tcx , ' tcx > ,
658
658
ty : Ty < ' tcx > ,
659
659
is_direct_call : bool ,
660
- output : & mut Vec < TransItem < ' tcx > > )
660
+ output : & mut Vec < MonoItem < ' tcx > > )
661
661
{
662
662
let instance = monomorphize:: resolve_drop_in_place ( tcx, ty) ;
663
663
visit_instance_use ( tcx, instance, is_direct_call, output) ;
@@ -666,7 +666,7 @@ fn visit_drop_use<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>,
666
666
fn visit_fn_use < ' a , ' tcx > ( tcx : TyCtxt < ' a , ' tcx , ' tcx > ,
667
667
ty : Ty < ' tcx > ,
668
668
is_direct_call : bool ,
669
- output : & mut Vec < TransItem < ' tcx > > )
669
+ output : & mut Vec < MonoItem < ' tcx > > )
670
670
{
671
671
if let ty:: TyFnDef ( def_id, substs) = ty. sty {
672
672
let instance = ty:: Instance :: resolve ( tcx,
@@ -680,7 +680,7 @@ fn visit_fn_use<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>,
680
680
fn visit_instance_use < ' a , ' tcx > ( tcx : TyCtxt < ' a , ' tcx , ' tcx > ,
681
681
instance : ty:: Instance < ' tcx > ,
682
682
is_direct_call : bool ,
683
- output : & mut Vec < TransItem < ' tcx > > )
683
+ output : & mut Vec < MonoItem < ' tcx > > )
684
684
{
685
685
debug ! ( "visit_item_use({:?}, is_direct_call={:?})" , instance, is_direct_call) ;
686
686
if !should_trans_locally ( tcx, & instance) {
@@ -838,17 +838,17 @@ fn find_vtable_types_for_unsizing<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>,
838
838
}
839
839
}
840
840
841
- fn create_fn_trans_item < ' a , ' tcx > ( instance : Instance < ' tcx > ) -> TransItem < ' tcx > {
841
+ fn create_fn_trans_item < ' a , ' tcx > ( instance : Instance < ' tcx > ) -> MonoItem < ' tcx > {
842
842
debug ! ( "create_fn_trans_item(instance={})" , instance) ;
843
- TransItem :: Fn ( instance)
843
+ MonoItem :: Fn ( instance)
844
844
}
845
845
846
846
/// Creates a `TransItem` for each method that is referenced by the vtable for
847
847
/// the given trait/impl pair.
848
848
fn create_trans_items_for_vtable_methods < ' a , ' tcx > ( tcx : TyCtxt < ' a , ' tcx , ' tcx > ,
849
849
trait_ty : Ty < ' tcx > ,
850
850
impl_ty : Ty < ' tcx > ,
851
- output : & mut Vec < TransItem < ' tcx > > ) {
851
+ output : & mut Vec < MonoItem < ' tcx > > ) {
852
852
assert ! ( !trait_ty. needs_subst( ) && !trait_ty. has_escaping_regions( ) &&
853
853
!impl_ty. needs_subst( ) && !impl_ty. has_escaping_regions( ) ) ;
854
854
@@ -881,7 +881,7 @@ fn create_trans_items_for_vtable_methods<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>,
881
881
struct RootCollector < ' b , ' a : ' b , ' tcx : ' a + ' b > {
882
882
tcx : TyCtxt < ' a , ' tcx , ' tcx > ,
883
883
mode : TransItemCollectionMode ,
884
- output : & ' b mut Vec < TransItem < ' tcx > > ,
884
+ output : & ' b mut Vec < MonoItem < ' tcx > > ,
885
885
entry_fn : Option < DefId > ,
886
886
}
887
887
@@ -925,13 +925,13 @@ impl<'b, 'a, 'v> ItemLikeVisitor<'v> for RootCollector<'b, 'a, 'v> {
925
925
debug ! ( "RootCollector: ItemGlobalAsm({})" ,
926
926
def_id_to_string( self . tcx,
927
927
self . tcx. hir. local_def_id( item. id) ) ) ;
928
- self . output . push ( TransItem :: GlobalAsm ( item. id ) ) ;
928
+ self . output . push ( MonoItem :: GlobalAsm ( item. id ) ) ;
929
929
}
930
930
hir:: ItemStatic ( ..) => {
931
931
debug ! ( "RootCollector: ItemStatic({})" ,
932
932
def_id_to_string( self . tcx,
933
933
self . tcx. hir. local_def_id( item. id) ) ) ;
934
- self . output . push ( TransItem :: Static ( item. id ) ) ;
934
+ self . output . push ( MonoItem :: Static ( item. id ) ) ;
935
935
}
936
936
hir:: ItemConst ( ..) => {
937
937
// const items only generate translation items if they are
@@ -946,7 +946,7 @@ impl<'b, 'a, 'v> ItemLikeVisitor<'v> for RootCollector<'b, 'a, 'v> {
946
946
def_id_to_string( tcx, def_id) ) ;
947
947
948
948
let instance = Instance :: mono ( tcx, def_id) ;
949
- self . output . push ( TransItem :: Fn ( instance) ) ;
949
+ self . output . push ( MonoItem :: Fn ( instance) ) ;
950
950
}
951
951
}
952
952
}
@@ -968,7 +968,7 @@ impl<'b, 'a, 'v> ItemLikeVisitor<'v> for RootCollector<'b, 'a, 'v> {
968
968
def_id_to_string( tcx, def_id) ) ;
969
969
970
970
let instance = Instance :: mono ( tcx, def_id) ;
971
- self . output . push ( TransItem :: Fn ( instance) ) ;
971
+ self . output . push ( MonoItem :: Fn ( instance) ) ;
972
972
}
973
973
}
974
974
_ => { /* Nothing to do here */ }
@@ -999,7 +999,7 @@ fn item_has_type_parameters<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, def_id: DefId
999
999
1000
1000
fn create_trans_items_for_default_impls < ' a , ' tcx > ( tcx : TyCtxt < ' a , ' tcx , ' tcx > ,
1001
1001
item : & ' tcx hir:: Item ,
1002
- output : & mut Vec < TransItem < ' tcx > > ) {
1002
+ output : & mut Vec < MonoItem < ' tcx > > ) {
1003
1003
match item. node {
1004
1004
hir:: ItemImpl ( _,
1005
1005
_,
@@ -1053,7 +1053,7 @@ fn create_trans_items_for_default_impls<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>,
1053
1053
fn collect_neighbours < ' a , ' tcx > ( tcx : TyCtxt < ' a , ' tcx , ' tcx > ,
1054
1054
instance : Instance < ' tcx > ,
1055
1055
const_context : bool ,
1056
- output : & mut Vec < TransItem < ' tcx > > )
1056
+ output : & mut Vec < MonoItem < ' tcx > > )
1057
1057
{
1058
1058
let mir = tcx. instance_mir ( instance. def ) ;
1059
1059
0 commit comments