@@ -221,20 +221,18 @@ impl<'tcx> CodegenUnit<'tcx> {
221
221
// Anything we can't find a proper codegen unit for goes into this.
222
222
const FALLBACK_CODEGEN_UNIT : & ' static str = "__rustc_fallback_codegen_unit" ;
223
223
224
- pub fn partition < ' a , ' tcx , I > ( scx : & SharedCrateContext < ' a , ' tcx > ,
224
+ pub fn partition < ' a , ' tcx , I > ( tcx : TyCtxt < ' a , ' tcx , ' tcx > ,
225
225
trans_items : I ,
226
226
strategy : PartitioningStrategy ,
227
227
inlining_map : & InliningMap < ' tcx > ,
228
228
exported_symbols : & ExportedSymbols )
229
229
-> Vec < CodegenUnit < ' tcx > >
230
230
where I : Iterator < Item = TransItem < ' tcx > >
231
231
{
232
- let tcx = scx. tcx ( ) ;
233
-
234
232
// In the first step, we place all regular translation items into their
235
233
// respective 'home' codegen unit. Regular translation items are all
236
234
// functions and statics defined in the local crate.
237
- let mut initial_partitioning = place_root_translation_items ( scx ,
235
+ let mut initial_partitioning = place_root_translation_items ( tcx ,
238
236
exported_symbols,
239
237
trans_items) ;
240
238
@@ -272,10 +270,10 @@ pub fn partition<'a, 'tcx, I>(scx: &SharedCrateContext<'a, 'tcx>,
272
270
( & cgu1. name [ ..] ) . cmp ( & cgu2. name [ ..] )
273
271
} ) ;
274
272
275
- if scx . sess ( ) . opts . enable_dep_node_debug_strs ( ) {
273
+ if tcx . sess . opts . enable_dep_node_debug_strs ( ) {
276
274
for cgu in & result {
277
275
let dep_node = cgu. work_product_dep_node ( ) ;
278
- scx . tcx ( ) . dep_graph . register_dep_node_debug_str ( dep_node,
276
+ tcx. dep_graph . register_dep_node_debug_str ( dep_node,
279
277
|| cgu. name ( ) . to_string ( ) ) ;
280
278
}
281
279
}
@@ -304,13 +302,12 @@ struct PostInliningPartitioning<'tcx> {
304
302
internalization_candidates : FxHashSet < TransItem < ' tcx > > ,
305
303
}
306
304
307
- fn place_root_translation_items < ' a , ' tcx , I > ( scx : & SharedCrateContext < ' a , ' tcx > ,
305
+ fn place_root_translation_items < ' a , ' tcx , I > ( tcx : TyCtxt < ' a , ' tcx , ' tcx > ,
308
306
exported_symbols : & ExportedSymbols ,
309
307
trans_items : I )
310
308
-> PreInliningPartitioning < ' tcx >
311
309
where I : Iterator < Item = TransItem < ' tcx > >
312
310
{
313
- let tcx = scx. tcx ( ) ;
314
311
let exported_symbols = exported_symbols. local_exports ( ) ;
315
312
316
313
let mut roots = FxHashSet ( ) ;
@@ -322,7 +319,7 @@ fn place_root_translation_items<'a, 'tcx, I>(scx: &SharedCrateContext<'a, 'tcx>,
322
319
let is_root = trans_item. instantiation_mode ( tcx) == InstantiationMode :: GloballyShared ;
323
320
324
321
if is_root {
325
- let characteristic_def_id = characteristic_def_id_of_trans_item ( scx , trans_item) ;
322
+ let characteristic_def_id = characteristic_def_id_of_trans_item ( tcx , trans_item) ;
326
323
let is_volatile = is_incremental_build &&
327
324
trans_item. is_generic_fn ( ) ;
328
325
@@ -592,10 +589,9 @@ fn internalize_symbols<'a, 'tcx>(_tcx: TyCtxt<'a, 'tcx, 'tcx>,
592
589
}
593
590
}
594
591
595
- fn characteristic_def_id_of_trans_item < ' a , ' tcx > ( scx : & SharedCrateContext < ' a , ' tcx > ,
592
+ fn characteristic_def_id_of_trans_item < ' a , ' tcx > ( tcx : TyCtxt < ' a , ' tcx , ' tcx > ,
596
593
trans_item : TransItem < ' tcx > )
597
594
-> Option < DefId > {
598
- let tcx = scx. tcx ( ) ;
599
595
match trans_item {
600
596
TransItem :: Fn ( instance) => {
601
597
let def_id = match instance. def {
@@ -621,7 +617,7 @@ fn characteristic_def_id_of_trans_item<'a, 'tcx>(scx: &SharedCrateContext<'a, 't
621
617
if let Some ( impl_def_id) = tcx. impl_of_method ( def_id) {
622
618
// This is a method within an inherent impl, find out what the
623
619
// self-type is:
624
- let impl_self_ty = common:: def_ty ( scx . tcx ( ) , impl_def_id, instance. substs ) ;
620
+ let impl_self_ty = common:: def_ty ( tcx, impl_def_id, instance. substs ) ;
625
621
if let Some ( def_id) = characteristic_def_id_of_type ( impl_self_ty) {
626
622
return Some ( def_id) ;
627
623
}
0 commit comments