@@ -57,7 +57,7 @@ use trans::assert_dep_graph;
57
57
use trans:: attributes;
58
58
use trans:: build:: * ;
59
59
use trans:: builder:: { Builder , noname} ;
60
- use trans:: callee;
60
+ use trans:: callee:: { Callee , CallArgs , ArgExprs , ArgVals } ;
61
61
use trans:: cleanup:: { self , CleanupMethods , DropHint } ;
62
62
use trans:: closure;
63
63
use trans:: common:: { Block , C_bool , C_bytes_in_context , C_i32 , C_int , C_uint , C_integral } ;
@@ -280,11 +280,9 @@ pub fn malloc_raw_dyn<'blk, 'tcx>(bcx: Block<'blk, 'tcx>,
280
280
let _icx = push_ctxt ( "malloc_raw_exchange" ) ;
281
281
282
282
// Allocate space:
283
- let r = callee:: trans_lang_call ( bcx,
284
- require_alloc_fn ( bcx, info_ty, ExchangeMallocFnLangItem ) ,
285
- & [ size, align] ,
286
- None ,
287
- debug_loc) ;
283
+ let def_id = require_alloc_fn ( bcx, info_ty, ExchangeMallocFnLangItem ) ;
284
+ let r = Callee :: def ( bcx. ccx ( ) , def_id, bcx. tcx ( ) . mk_substs ( Substs :: empty ( ) ) )
285
+ . call ( bcx, debug_loc, ArgVals ( & [ size, align] ) , None ) ;
288
286
289
287
Result :: new ( r. bcx , PointerCast ( r. bcx , r. val , llty_ptr) )
290
288
}
@@ -1219,9 +1217,8 @@ pub fn trans_unwind_resume(bcx: Block, lpval: ValueRef) {
1219
1217
Resume ( bcx, lpval) ;
1220
1218
} else {
1221
1219
let exc_ptr = ExtractValue ( bcx, lpval, 0 ) ;
1222
- let llunwresume = bcx. fcx . eh_unwind_resume ( ) ;
1223
- Call ( bcx, llunwresume, & [ exc_ptr] , None , DebugLoc :: None ) ;
1224
- Unreachable ( bcx) ;
1220
+ bcx. fcx . eh_unwind_resume ( )
1221
+ . call ( bcx, DebugLoc :: None , ArgVals ( & [ exc_ptr] ) , None ) ;
1225
1222
}
1226
1223
}
1227
1224
@@ -2147,20 +2144,10 @@ pub fn trans_fn<'a, 'tcx>(ccx: &CrateContext<'a, 'tcx>,
2147
2144
closure:: ClosureEnv :: NotClosure ) ;
2148
2145
}
2149
2146
2150
- pub fn trans_enum_variant < ' a , ' tcx > ( ccx : & CrateContext < ' a , ' tcx > ,
2151
- ctor_id : ast:: NodeId ,
2152
- disr : Disr ,
2153
- param_substs : & ' tcx Substs < ' tcx > ,
2154
- llfndecl : ValueRef ) {
2155
- let _icx = push_ctxt ( "trans_enum_variant" ) ;
2156
-
2157
- trans_enum_variant_or_tuple_like_struct ( ccx, ctor_id, disr, param_substs, llfndecl) ;
2158
- }
2159
-
2160
2147
pub fn trans_named_tuple_constructor < ' blk , ' tcx > ( mut bcx : Block < ' blk , ' tcx > ,
2161
2148
ctor_ty : Ty < ' tcx > ,
2162
2149
disr : Disr ,
2163
- args : callee :: CallArgs ,
2150
+ args : CallArgs ,
2164
2151
dest : expr:: Dest ,
2165
2152
debug_loc : DebugLoc )
2166
2153
-> Result < ' blk , ' tcx > {
@@ -2188,7 +2175,7 @@ pub fn trans_named_tuple_constructor<'blk, 'tcx>(mut bcx: Block<'blk, 'tcx>,
2188
2175
2189
2176
if !type_is_zero_size ( ccx, result_ty) {
2190
2177
match args {
2191
- callee :: ArgExprs ( exprs) => {
2178
+ ArgExprs ( exprs) => {
2192
2179
let fields = exprs. iter ( ) . map ( |x| & * * x) . enumerate ( ) . collect :: < Vec < _ > > ( ) ;
2193
2180
bcx = expr:: trans_adt ( bcx,
2194
2181
result_ty,
@@ -2204,7 +2191,7 @@ pub fn trans_named_tuple_constructor<'blk, 'tcx>(mut bcx: Block<'blk, 'tcx>,
2204
2191
// Just eval all the expressions (if any). Since expressions in Rust can have arbitrary
2205
2192
// contents, there could be side-effects we need from them.
2206
2193
match args {
2207
- callee :: ArgExprs ( exprs) => {
2194
+ ArgExprs ( exprs) => {
2208
2195
for expr in exprs {
2209
2196
bcx = expr:: trans_into ( bcx, expr, expr:: Ignore ) ;
2210
2197
}
@@ -2500,8 +2487,9 @@ pub fn trans_item(ccx: &CrateContext, item: &hir::Item) {
2500
2487
// compilation unit that references the item, so it will still get
2501
2488
// translated everywhere it's needed.
2502
2489
for ( ref ccx, is_origin) in ccx. maybe_iter ( !from_external && trans_everywhere) {
2503
- let llfn = get_item_val ( ccx, item. id ) ;
2504
- let empty_substs = ccx. tcx ( ) . mk_substs ( Substs :: trans_empty ( ) ) ;
2490
+ let empty_substs = tcx. mk_substs ( Substs :: trans_empty ( ) ) ;
2491
+ let def_id = tcx. map . local_def_id ( item. id ) ;
2492
+ let llfn = Callee :: def ( ccx, def_id, empty_substs) . reify ( ccx) . val ;
2505
2493
if abi != Abi :: Rust {
2506
2494
foreign:: trans_rust_fn_with_foreign_abi ( ccx,
2507
2495
& decl,
@@ -2536,9 +2524,8 @@ pub fn trans_item(ccx: &CrateContext, item: &hir::Item) {
2536
2524
// error in trans. This is used to write compile-fail tests
2537
2525
// that actually test that compilation succeeds without
2538
2526
// reporting an error.
2539
- let item_def_id = ccx. tcx ( ) . map . local_def_id ( item. id ) ;
2540
- if ccx. tcx ( ) . has_attr ( item_def_id, "rustc_error" ) {
2541
- ccx. tcx ( ) . sess . span_fatal ( item. span , "compilation successful" ) ;
2527
+ if tcx. has_attr ( def_id, "rustc_error" ) {
2528
+ tcx. sess . span_fatal ( item. span , "compilation successful" ) ;
2542
2529
}
2543
2530
}
2544
2531
}
@@ -2671,17 +2658,10 @@ pub fn create_entry_wrapper(ccx: &CrateContext, sp: Span, main_llfn: ValueRef) {
2671
2658
let ( start_fn, args) = if use_start_lang_item {
2672
2659
let start_def_id = match ccx. tcx ( ) . lang_items . require ( StartFnLangItem ) {
2673
2660
Ok ( id) => id,
2674
- Err ( s) => {
2675
- ccx. sess ( ) . fatal ( & s[ ..] ) ;
2676
- }
2677
- } ;
2678
- let start_fn = if let Some ( start_node_id) = ccx. tcx ( )
2679
- . map
2680
- . as_local_node_id ( start_def_id) {
2681
- get_item_val ( ccx, start_node_id)
2682
- } else {
2683
- get_extern_fn ( ccx, start_def_id) . val
2661
+ Err ( s) => ccx. sess ( ) . fatal ( & s)
2684
2662
} ;
2663
+ let empty_substs = ccx. tcx ( ) . mk_substs ( Substs :: trans_empty ( ) ) ;
2664
+ let start_fn = Callee :: def ( ccx, start_def_id, empty_substs) . reify ( ccx) . val ;
2685
2665
let args = {
2686
2666
let opaque_rust_main =
2687
2667
llvm:: LLVMBuildPointerCast ( bld,
0 commit comments