@@ -47,7 +47,7 @@ use middle::trans::builder::{Builder, noname};
47
47
use middle:: trans:: callee;
48
48
use middle:: trans:: cleanup:: { CleanupMethods , ScopeId } ;
49
49
use middle:: trans:: cleanup;
50
- use middle:: trans:: common:: { Block , C_bool , C_bytes_in_context , C_i32 , C_integral , C_nil } ;
50
+ use middle:: trans:: common:: { Block , C_bool , C_bytes_in_context , C_i32 , C_integral } ;
51
51
use middle:: trans:: common:: { C_null , C_struct_in_context , C_u64 , C_u8 , C_uint , C_undef } ;
52
52
use middle:: trans:: common:: { CrateContext , ExternMap , FunctionContext } ;
53
53
use middle:: trans:: common:: { NodeInfo , Result , SubstP } ;
@@ -517,7 +517,7 @@ pub fn get_res_dtor(ccx: &CrateContext,
517
517
let class_ty = ty:: lookup_item_type ( tcx, parent_id) . ty . subst ( tcx, substs) ;
518
518
let llty = type_of_dtor ( ccx, class_ty) ;
519
519
let dtor_ty = ty:: mk_ctor_fn ( ccx. tcx ( ) , ast:: DUMMY_NODE_ID ,
520
- [ glue:: get_drop_glue_type ( ccx, t) ] , ty:: mk_nil ( ) ) ;
520
+ [ glue:: get_drop_glue_type ( ccx, t) ] , ty:: mk_nil ( ccx . tcx ( ) ) ) ;
521
521
get_extern_fn ( ccx,
522
522
& mut * ccx. externs ( ) . borrow_mut ( ) ,
523
523
name. as_slice ( ) ,
@@ -551,7 +551,7 @@ pub fn compare_scalar_types<'blk, 'tcx>(cx: Block<'blk, 'tcx>,
551
551
let f = |a| Result :: new ( cx, compare_scalar_values ( cx, lhs, rhs, a, op) ) ;
552
552
553
553
match ty:: get ( t) . sty {
554
- ty:: ty_nil => f ( nil_type) ,
554
+ ty:: ty_tup ( ref tys ) if tys . is_empty ( ) => f ( nil_type) ,
555
555
ty:: ty_bool | ty:: ty_uint( _) | ty:: ty_char => f ( unsigned_int) ,
556
556
ty:: ty_ptr( mt) if ty:: type_is_sized ( cx. tcx ( ) , mt. ty ) => f ( unsigned_int) ,
557
557
ty:: ty_int( _) => f ( signed_int) ,
@@ -1578,12 +1578,6 @@ fn create_datums_for_fn_args_under_call_abi(
1578
1578
"argtuple" ) ) ;
1579
1579
result. push ( tuple) ;
1580
1580
}
1581
- ty:: ty_nil => {
1582
- let mode = datum:: Rvalue :: new ( datum:: ByValue ) ;
1583
- result. push ( datum:: Datum :: new ( C_nil ( bcx. ccx ( ) ) ,
1584
- ty:: mk_nil ( ) ,
1585
- mode) )
1586
- }
1587
1581
_ => {
1588
1582
bcx. tcx ( ) . sess . bug ( "last argument of a function with \
1589
1583
`rust-call` ABI isn't a tuple?!")
@@ -1647,10 +1641,8 @@ fn copy_unboxed_closure_args_to_allocas<'blk, 'tcx>(
1647
1641
arg_datum. to_lvalue_datum_in_scope( bcx,
1648
1642
"argtuple" ,
1649
1643
arg_scope_id) ) ;
1650
- let empty = Vec :: new ( ) ;
1651
1644
let untupled_arg_types = match ty:: get ( monomorphized_arg_types[ 0 ] ) . sty {
1652
1645
ty:: ty_tup( ref types) => types. as_slice ( ) ,
1653
- ty:: ty_nil => empty. as_slice ( ) ,
1654
1646
_ => {
1655
1647
bcx. tcx ( ) . sess . span_bug ( args[ 0 ] . pat . span ,
1656
1648
"first arg to `rust-call` ABI function \
@@ -1824,7 +1816,7 @@ pub fn trans_closure(ccx: &CrateContext,
1824
1816
NotUnboxedClosure => monomorphized_arg_types,
1825
1817
1826
1818
// Tuple up closure argument types for the "rust-call" ABI.
1827
- IsUnboxedClosure => vec![ ty:: mk_tup_or_nil ( ccx. tcx( ) , monomorphized_arg_types) ]
1819
+ IsUnboxedClosure => vec![ ty:: mk_tup ( ccx. tcx( ) , monomorphized_arg_types) ]
1828
1820
} ;
1829
1821
for monomorphized_arg_type in monomorphized_arg_types. iter( ) {
1830
1822
debug ! ( "trans_closure: monomorphized_arg_type: {}" ,
@@ -2380,7 +2372,6 @@ pub fn get_fn_llvm_attributes(ccx: &CrateContext, fn_ty: ty::t)
2380
2372
assert ! ( abi == RustCall ) ;
2381
2373
2382
2374
match ty:: get ( fn_sig. inputs [ 0 ] ) . sty {
2383
- ty:: ty_nil => Vec :: new ( ) ,
2384
2375
ty:: ty_tup( ref inputs) => inputs. clone ( ) ,
2385
2376
_ => ccx. sess ( ) . bug ( "expected tuple'd inputs" )
2386
2377
}
@@ -2389,7 +2380,6 @@ pub fn get_fn_llvm_attributes(ccx: &CrateContext, fn_ty: ty::t)
2389
2380
let mut inputs = vec ! [ fn_sig. inputs[ 0 ] ] ;
2390
2381
2391
2382
match ty:: get ( fn_sig. inputs [ 1 ] ) . sty {
2392
- ty:: ty_nil => inputs,
2393
2383
ty:: ty_tup( ref t_in) => {
2394
2384
inputs. push_all ( t_in. as_slice ( ) ) ;
2395
2385
inputs
@@ -2532,7 +2522,7 @@ pub fn register_fn_llvmty(ccx: &CrateContext,
2532
2522
llfty : Type ) -> ValueRef {
2533
2523
debug ! ( "register_fn_llvmty id={} sym={}" , node_id, sym) ;
2534
2524
2535
- let llfn = decl_fn ( ccx, sym. as_slice ( ) , cc, llfty, ty:: FnConverging ( ty:: mk_nil ( ) ) ) ;
2525
+ let llfn = decl_fn ( ccx, sym. as_slice ( ) , cc, llfty, ty:: FnConverging ( ty:: mk_nil ( ccx . tcx ( ) ) ) ) ;
2536
2526
finish_register_fn ( ccx, sp, sym, node_id, llfn) ;
2537
2527
llfn
2538
2528
}
@@ -2564,7 +2554,7 @@ pub fn create_entry_wrapper(ccx: &CrateContext,
2564
2554
let llfty = Type :: func ( [ ccx. int_type ( ) , Type :: i8p ( ccx) . ptr_to ( ) ] ,
2565
2555
& ccx. int_type ( ) ) ;
2566
2556
2567
- let llfn = decl_cdecl_fn ( ccx, "main" , llfty, ty:: mk_nil ( ) ) ;
2557
+ let llfn = decl_cdecl_fn ( ccx, "main" , llfty, ty:: mk_nil ( ccx . tcx ( ) ) ) ;
2568
2558
2569
2559
// FIXME: #16581: Marking a symbol in the executable with `dllexport`
2570
2560
// linkage forces MinGW's linker to output a `.reloc` section for ASLR
0 commit comments