@@ -30,7 +30,7 @@ use middle::subst::{self, Substs};
3030use rustc:: ast_map;
3131use trans:: common:: { NodeIdAndSpan , CrateContext , FunctionContext , Block } ;
3232use trans;
33- use trans:: monomorphize;
33+ use trans:: { monomorphize, type_of } ;
3434use middle:: ty:: { self , Ty } ;
3535use session:: config:: { self , FullDebugInfo , LimitedDebugInfo , NoDebugInfo } ;
3636use util:: nodemap:: { NodeMap , FnvHashMap , FnvHashSet } ;
@@ -41,7 +41,7 @@ use std::ffi::CString;
4141use std:: ptr;
4242use std:: rc:: Rc ;
4343use syntax:: codemap:: { Span , Pos } ;
44- use syntax:: { ast, codemap, ast_util} ;
44+ use syntax:: { abi , ast, codemap, ast_util} ;
4545use syntax:: attr:: IntType ;
4646use syntax:: parse:: token:: { self , special_idents} ;
4747
@@ -412,12 +412,13 @@ pub fn create_function_debug_context<'a, 'tcx>(cx: &CrateContext<'a, 'tcx>,
412412 assert_type_for_node_id ( cx, fn_ast_id, error_reporting_span) ;
413413 let fn_type = cx. tcx ( ) . node_id_to_type ( fn_ast_id) ;
414414
415- let sig = match fn_type. sty {
415+ let ( sig, abi ) = match fn_type. sty {
416416 ty:: TyBareFn ( _, ref barefnty) => {
417- cx. tcx ( ) . erase_late_bound_regions ( & barefnty. sig )
417+ ( cx. tcx ( ) . erase_late_bound_regions ( & barefnty. sig ) , barefnty . abi )
418418 }
419419 ty:: TyClosure ( def_id, substs) => {
420- cx. tcx ( ) . erase_late_bound_regions ( & cx. tcx ( ) . closure_type ( def_id, substs) . sig )
420+ let closure_type = cx. tcx ( ) . closure_type ( def_id, substs) ;
421+ ( cx. tcx ( ) . erase_late_bound_regions ( & closure_type. sig ) , closure_type. abi )
421422 }
422423
423424 _ => cx. sess ( ) . bug ( "get_function_metdata: Expected a function type!" )
@@ -435,8 +436,14 @@ pub fn create_function_debug_context<'a, 'tcx>(cx: &CrateContext<'a, 'tcx>,
435436 ty:: FnDiverging => diverging_type_metadata ( cx)
436437 } ) ;
437438
439+ let inputs = & if abi == abi:: RustCall {
440+ type_of:: untuple_arguments ( cx, & sig. inputs )
441+ } else {
442+ sig. inputs
443+ } ;
444+
438445 // Arguments types
439- for & argument_type in & sig . inputs {
446+ for & argument_type in inputs {
440447 signature. push ( type_metadata ( cx, argument_type, codemap:: DUMMY_SP ) ) ;
441448 }
442449
0 commit comments