@@ -101,7 +101,7 @@ pub struct StatRecorder<'a, 'tcx: 'a> {
101101
102102impl < ' a , ' tcx > StatRecorder < ' a , ' tcx > {
103103 pub fn new ( ccx : & ' a CrateContext < ' a , ' tcx > , name : String ) -> StatRecorder < ' a , ' tcx > {
104- let istart = ccx. stats ( ) . borrow ( ) . n_llvm_insns ;
104+ let istart = ccx. stats . borrow ( ) . n_llvm_insns ;
105105 StatRecorder {
106106 ccx,
107107 name : Some ( name) ,
@@ -113,7 +113,7 @@ impl<'a, 'tcx> StatRecorder<'a, 'tcx> {
113113impl < ' a , ' tcx > Drop for StatRecorder < ' a , ' tcx > {
114114 fn drop ( & mut self ) {
115115 if self . ccx . sess ( ) . trans_stats ( ) {
116- let mut stats = self . ccx . stats ( ) . borrow_mut ( ) ;
116+ let mut stats = self . ccx . stats . borrow_mut ( ) ;
117117 let iend = stats. n_llvm_insns ;
118118 stats. fn_stats . push ( ( self . name . take ( ) . unwrap ( ) , iend - self . istart ) ) ;
119119 stats. n_fns += 1 ;
@@ -194,7 +194,7 @@ pub fn unsized_info<'ccx, 'tcx>(ccx: &CrateContext<'ccx, 'tcx>,
194194 target : Ty < ' tcx > ,
195195 old_info : Option < ValueRef > )
196196 -> ValueRef {
197- let ( source, target) = ccx. tcx ( ) . struct_lockstep_tails ( source, target) ;
197+ let ( source, target) = ccx. tcx . struct_lockstep_tails ( source, target) ;
198198 match ( & source. sty , & target. sty ) {
199199 ( & ty:: TyArray ( _, len) , & ty:: TySlice ( _) ) => {
200200 C_usize ( ccx, len. val . to_const_int ( ) . unwrap ( ) . to_u64 ( ) . unwrap ( ) )
@@ -206,7 +206,7 @@ pub fn unsized_info<'ccx, 'tcx>(ccx: &CrateContext<'ccx, 'tcx>,
206206 old_info. expect ( "unsized_info: missing old info for trait upcast" )
207207 }
208208 ( _, & ty:: TyDynamic ( ref data, ..) ) => {
209- let vtable_ptr = ccx. layout_of ( ccx. tcx ( ) . mk_mut_ptr ( target) )
209+ let vtable_ptr = ccx. layout_of ( ccx. tcx . mk_mut_ptr ( target) )
210210 . field ( ccx, abi:: FAT_PTR_EXTRA ) ;
211211 consts:: ptrcast ( meth:: get_vtable ( ccx, source, data. principal ( ) ) ,
212212 vtable_ptr. llvm_type ( ccx) )
@@ -421,7 +421,7 @@ pub fn call_memcpy(b: &Builder,
421421 let memcpy = ccx. get_intrinsic ( & key) ;
422422 let src_ptr = b. pointercast ( src, Type :: i8p ( ccx) ) ;
423423 let dst_ptr = b. pointercast ( dst, Type :: i8p ( ccx) ) ;
424- let size = b. intcast ( n_bytes, ccx. isize_ty ( ) , false ) ;
424+ let size = b. intcast ( n_bytes, ccx. isize_ty , false ) ;
425425 let align = C_i32 ( ccx, align. abi ( ) as i32 ) ;
426426 let volatile = C_bool ( ccx, false ) ;
427427 b. call ( memcpy, & [ dst_ptr, src_ptr, size, align, volatile] , None ) ;
@@ -458,7 +458,7 @@ pub fn call_memset<'a, 'tcx>(b: &Builder<'a, 'tcx>,
458458pub fn trans_instance < ' a , ' tcx > ( ccx : & CrateContext < ' a , ' tcx > , instance : Instance < ' tcx > ) {
459459 let _s = if ccx. sess ( ) . trans_stats ( ) {
460460 let mut instance_name = String :: new ( ) ;
461- DefPathBasedNames :: new ( ccx. tcx ( ) , true , true )
461+ DefPathBasedNames :: new ( ccx. tcx , true , true )
462462 . push_def_path ( instance. def_id ( ) , & mut instance_name) ;
463463 Some ( StatRecorder :: new ( ccx, instance_name) )
464464 } else {
@@ -470,16 +470,16 @@ pub fn trans_instance<'a, 'tcx>(ccx: &CrateContext<'a, 'tcx>, instance: Instance
470470 // release builds.
471471 info ! ( "trans_instance({})" , instance) ;
472472
473- let fn_ty = instance. ty ( ccx. tcx ( ) ) ;
473+ let fn_ty = instance. ty ( ccx. tcx ) ;
474474 let sig = common:: ty_fn_sig ( ccx, fn_ty) ;
475- let sig = ccx. tcx ( ) . erase_late_bound_regions_and_normalize ( & sig) ;
475+ let sig = ccx. tcx . erase_late_bound_regions_and_normalize ( & sig) ;
476476
477- let lldecl = match ccx. instances ( ) . borrow ( ) . get ( & instance) {
477+ let lldecl = match ccx. instances . borrow ( ) . get ( & instance) {
478478 Some ( & val) => val,
479479 None => bug ! ( "Instance `{:?}` not already declared" , instance)
480480 } ;
481481
482- ccx. stats ( ) . borrow_mut ( ) . n_closures += 1 ;
482+ ccx. stats . borrow_mut ( ) . n_closures += 1 ;
483483
484484 // The `uwtable` attribute according to LLVM is:
485485 //
@@ -502,7 +502,7 @@ pub fn trans_instance<'a, 'tcx>(ccx: &CrateContext<'a, 'tcx>, instance: Instance
502502 attributes:: emit_uwtable ( lldecl, true ) ;
503503 }
504504
505- let mir = ccx. tcx ( ) . instance_mir ( instance. def ) ;
505+ let mir = ccx. tcx . instance_mir ( instance. def ) ;
506506 mir:: trans_mir ( ccx, lldecl, & mir, instance, sig) ;
507507}
508508
@@ -525,14 +525,14 @@ pub fn set_link_section(ccx: &CrateContext,
525525fn maybe_create_entry_wrapper ( ccx : & CrateContext ) {
526526 let ( main_def_id, span) = match * ccx. sess ( ) . entry_fn . borrow ( ) {
527527 Some ( ( id, span) ) => {
528- ( ccx. tcx ( ) . hir . local_def_id ( id) , span)
528+ ( ccx. tcx . hir . local_def_id ( id) , span)
529529 }
530530 None => return ,
531531 } ;
532532
533- let instance = Instance :: mono ( ccx. tcx ( ) , main_def_id) ;
533+ let instance = Instance :: mono ( ccx. tcx , main_def_id) ;
534534
535- if !ccx. codegen_unit ( ) . contains_item ( & MonoItem :: Fn ( instance) ) {
535+ if !ccx. codegen_unit . contains_item ( & MonoItem :: Fn ( instance) ) {
536536 // We want to create the wrapper in the same codegen unit as Rust's main
537537 // function.
538538 return ;
@@ -554,7 +554,7 @@ fn maybe_create_entry_wrapper(ccx: &CrateContext) {
554554 use_start_lang_item : bool ) {
555555 let llfty = Type :: func ( & [ Type :: c_int ( ccx) , Type :: i8p ( ccx) . ptr_to ( ) ] , & Type :: c_int ( ccx) ) ;
556556
557- let main_ret_ty = ccx. tcx ( ) . fn_sig ( rust_main_def_id) . output ( ) ;
557+ let main_ret_ty = ccx. tcx . fn_sig ( rust_main_def_id) . output ( ) ;
558558 // Given that `main()` has no arguments,
559559 // then its return type cannot have
560560 // late-bound regions, since late-bound
@@ -582,12 +582,12 @@ fn maybe_create_entry_wrapper(ccx: &CrateContext) {
582582 // Params from native main() used as args for rust start function
583583 let param_argc = get_param ( llfn, 0 ) ;
584584 let param_argv = get_param ( llfn, 1 ) ;
585- let arg_argc = bld. intcast ( param_argc, ccx. isize_ty ( ) , true ) ;
585+ let arg_argc = bld. intcast ( param_argc, ccx. isize_ty , true ) ;
586586 let arg_argv = param_argv;
587587
588588 let ( start_fn, args) = if use_start_lang_item {
589- let start_def_id = ccx. tcx ( ) . require_lang_item ( StartFnLangItem ) ;
590- let start_fn = callee:: resolve_and_get_fn ( ccx, start_def_id, ccx. tcx ( ) . mk_substs (
589+ let start_def_id = ccx. tcx . require_lang_item ( StartFnLangItem ) ;
590+ let start_fn = callee:: resolve_and_get_fn ( ccx, start_def_id, ccx. tcx . mk_substs (
591591 iter:: once ( Kind :: from ( main_ret_ty) ) ) ) ;
592592 ( start_fn, vec ! [ bld. pointercast( rust_main, Type :: i8p( ccx) . ptr_to( ) ) ,
593593 arg_argc, arg_argv] )
@@ -1205,8 +1205,8 @@ fn compile_codegen_unit<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>,
12051205 // Instantiate translation items without filling out definitions yet...
12061206 let ccx = CrateContext :: new ( tcx, cgu, & llmod_id) ;
12071207 let module = {
1208- let trans_items = ccx. codegen_unit ( )
1209- . items_in_deterministic_order ( ccx. tcx ( ) ) ;
1208+ let trans_items = ccx. codegen_unit
1209+ . items_in_deterministic_order ( ccx. tcx ) ;
12101210 for & ( trans_item, ( linkage, visibility) ) in & trans_items {
12111211 trans_item. predefine ( & ccx, linkage, visibility) ;
12121212 }
@@ -1221,7 +1221,7 @@ fn compile_codegen_unit<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>,
12211221 maybe_create_entry_wrapper ( & ccx) ;
12221222
12231223 // Run replace-all-uses-with for statics that need it
1224- for & ( old_g, new_g) in ccx. statics_to_rauw ( ) . borrow ( ) . iter ( ) {
1224+ for & ( old_g, new_g) in ccx. statics_to_rauw . borrow ( ) . iter ( ) {
12251225 unsafe {
12261226 let bitcast = llvm:: LLVMConstPointerCast ( new_g, llvm:: LLVMTypeOf ( old_g) ) ;
12271227 llvm:: LLVMReplaceAllUsesWith ( old_g, bitcast) ;
@@ -1231,13 +1231,13 @@ fn compile_codegen_unit<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>,
12311231
12321232 // Create the llvm.used variable
12331233 // This variable has type [N x i8*] and is stored in the llvm.metadata section
1234- if !ccx. used_statics ( ) . borrow ( ) . is_empty ( ) {
1234+ if !ccx. used_statics . borrow ( ) . is_empty ( ) {
12351235 let name = CString :: new ( "llvm.used" ) . unwrap ( ) ;
12361236 let section = CString :: new ( "llvm.metadata" ) . unwrap ( ) ;
1237- let array = C_array ( Type :: i8 ( & ccx) . ptr_to ( ) , & * ccx. used_statics ( ) . borrow ( ) ) ;
1237+ let array = C_array ( Type :: i8 ( & ccx) . ptr_to ( ) , & * ccx. used_statics . borrow ( ) ) ;
12381238
12391239 unsafe {
1240- let g = llvm:: LLVMAddGlobal ( ccx. llmod ( ) ,
1240+ let g = llvm:: LLVMAddGlobal ( ccx. llmod ,
12411241 val_ty ( array) . to_ref ( ) ,
12421242 name. as_ptr ( ) ) ;
12431243 llvm:: LLVMSetInitializer ( g, array) ;
@@ -1252,8 +1252,8 @@ fn compile_codegen_unit<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>,
12521252 }
12531253
12541254 let llvm_module = ModuleLlvm {
1255- llcx : ccx. llcx ( ) ,
1256- llmod : ccx. llmod ( ) ,
1255+ llcx : ccx. llcx ,
1256+ llmod : ccx. llmod ,
12571257 tm : create_target_machine ( ccx. sess ( ) ) ,
12581258 } ;
12591259
0 commit comments