@@ -34,10 +34,8 @@ use back::linker::LinkerInfo;
34
34
use back:: symbol_export:: { self , ExportedSymbols } ;
35
35
use llvm:: { Linkage , ValueRef , Vector , get_param} ;
36
36
use llvm;
37
- use rustc:: hir:: def_id:: { DefId , LOCAL_CRATE } ;
37
+ use rustc:: hir:: def_id:: LOCAL_CRATE ;
38
38
use middle:: lang_items:: StartFnLangItem ;
39
- use rustc:: ty:: subst:: Substs ;
40
- use rustc:: mir:: tcx:: LvalueTy ;
41
39
use rustc:: traits;
42
40
use rustc:: ty:: { self , Ty , TyCtxt } ;
43
41
use rustc:: ty:: adjustment:: CustomCoerceUnsized ;
@@ -47,9 +45,8 @@ use rustc::util::common::time;
47
45
use session:: config:: { self , NoDebugInfo } ;
48
46
use rustc_incremental:: IncrementalHashesMap ;
49
47
use session:: { self , DataTypeKind , Session } ;
50
- use abi:: { self , FnType } ;
48
+ use abi;
51
49
use mir:: lvalue:: LvalueRef ;
52
- use adt;
53
50
use attributes;
54
51
use builder:: Builder ;
55
52
use callee:: { Callee } ;
@@ -65,7 +62,7 @@ use context::{SharedCrateContext, CrateContextList};
65
62
use debuginfo;
66
63
use declare;
67
64
use machine;
68
- use machine:: { llalign_of_min , llsize_of} ;
65
+ use machine:: llsize_of;
69
66
use meth;
70
67
use mir;
71
68
use monomorphize:: { self , Instance } ;
@@ -76,7 +73,6 @@ use trans_item::{TransItem, DefPathBasedNames};
76
73
use type_:: Type ;
77
74
use type_of;
78
75
use value:: Value ;
79
- use Disr ;
80
76
use util:: nodemap:: { NodeSet , FxHashMap , FxHashSet } ;
81
77
82
78
use libc:: c_uint;
@@ -615,72 +611,6 @@ pub fn trans_instance<'a, 'tcx>(ccx: &CrateContext<'a, 'tcx>, instance: Instance
615
611
mir:: trans_mir ( ccx, lldecl, & mir, instance, sig) ;
616
612
}
617
613
618
- pub fn trans_ctor_shim < ' a , ' tcx > ( ccx : & CrateContext < ' a , ' tcx > ,
619
- def_id : DefId ,
620
- substs : & ' tcx Substs < ' tcx > ,
621
- disr : Disr ,
622
- llfn : ValueRef ) {
623
- attributes:: inline ( llfn, attributes:: InlineAttr :: Hint ) ;
624
- attributes:: set_frame_pointer_elimination ( ccx, llfn) ;
625
-
626
- let ctor_ty = common:: def_ty ( ccx. shared ( ) , def_id, substs) ;
627
- let sig = ccx. tcx ( ) . erase_late_bound_regions_and_normalize ( & ctor_ty. fn_sig ( ) ) ;
628
- let fn_ty = FnType :: new ( ccx, sig, & [ ] ) ;
629
-
630
- let bcx = Builder :: new_block ( ccx, llfn, "entry-block" ) ;
631
- if !fn_ty. ret . is_ignore ( ) {
632
- // But if there are no nested returns, we skip the indirection
633
- // and have a single retslot
634
- let dest = if fn_ty. ret . is_indirect ( ) {
635
- get_param ( llfn, 0 )
636
- } else {
637
- // We create an alloca to hold a pointer of type `ret.original_ty`
638
- // which will hold the pointer to the right alloca which has the
639
- // final ret value
640
- bcx. alloca ( fn_ty. ret . memory_ty ( ccx) , "sret_slot" )
641
- } ;
642
- // Can return unsized value
643
- let mut dest_val = LvalueRef :: new_sized_ty ( dest, sig. output ( ) , Alignment :: AbiAligned ) ;
644
- dest_val. ty = LvalueTy :: Downcast {
645
- adt_def : sig. output ( ) . ty_adt_def ( ) . unwrap ( ) ,
646
- substs : substs,
647
- variant_index : disr. 0 as usize ,
648
- } ;
649
- let mut llarg_idx = fn_ty. ret . is_indirect ( ) as usize ;
650
- let mut arg_idx = 0 ;
651
- for ( i, arg_ty) in sig. inputs ( ) . iter ( ) . enumerate ( ) {
652
- let ( lldestptr, _) = dest_val. trans_field_ptr ( & bcx, i) ;
653
- let arg = & fn_ty. args [ arg_idx] ;
654
- arg_idx += 1 ;
655
- if common:: type_is_fat_ptr ( bcx. ccx , arg_ty) {
656
- let meta = & fn_ty. args [ arg_idx] ;
657
- arg_idx += 1 ;
658
- arg. store_fn_arg ( & bcx, & mut llarg_idx, get_dataptr ( & bcx, lldestptr) ) ;
659
- meta. store_fn_arg ( & bcx, & mut llarg_idx, get_meta ( & bcx, lldestptr) ) ;
660
- } else {
661
- arg. store_fn_arg ( & bcx, & mut llarg_idx, lldestptr) ;
662
- }
663
- }
664
- adt:: trans_set_discr ( & bcx, sig. output ( ) , dest, disr) ;
665
-
666
- if fn_ty. ret . is_indirect ( ) {
667
- bcx. ret_void ( ) ;
668
- return ;
669
- }
670
-
671
- if let Some ( cast_ty) = fn_ty. ret . cast {
672
- bcx. ret ( bcx. load (
673
- bcx. pointercast ( dest, cast_ty. ptr_to ( ) ) ,
674
- Some ( llalign_of_min ( ccx, fn_ty. ret . ty ) )
675
- ) ) ;
676
- } else {
677
- bcx. ret ( bcx. load ( dest, None ) )
678
- }
679
- } else {
680
- bcx. ret_void ( ) ;
681
- }
682
- }
683
-
684
614
pub fn llvm_linkage_by_name ( name : & str ) -> Option < Linkage > {
685
615
// Use the names from src/llvm/docs/LangRef.rst here. Most types are only
686
616
// applicable to variable declarations and may not really make sense for
@@ -721,7 +651,7 @@ pub fn set_link_section(ccx: &CrateContext,
721
651
}
722
652
723
653
/// Create the `main` function which will initialise the rust runtime and call
724
- /// users’ main function.
654
+ /// users main function.
725
655
pub fn maybe_create_entry_wrapper ( ccx : & CrateContext ) {
726
656
let ( main_def_id, span) = match * ccx. sess ( ) . entry_fn . borrow ( ) {
727
657
Some ( ( id, span) ) => {
0 commit comments