@@ -30,7 +30,7 @@ use middle::subst::{self, Substs};
30
30
use rustc:: ast_map;
31
31
use trans:: common:: { NodeIdAndSpan , CrateContext , FunctionContext , Block } ;
32
32
use trans;
33
- use trans:: monomorphize;
33
+ use trans:: { monomorphize, type_of } ;
34
34
use middle:: ty:: { self , Ty } ;
35
35
use session:: config:: { self , FullDebugInfo , LimitedDebugInfo , NoDebugInfo } ;
36
36
use util:: nodemap:: { NodeMap , FnvHashMap , FnvHashSet } ;
@@ -41,7 +41,7 @@ use std::ffi::CString;
41
41
use std:: ptr;
42
42
use std:: rc:: Rc ;
43
43
use syntax:: codemap:: { Span , Pos } ;
44
- use syntax:: { ast, codemap, ast_util} ;
44
+ use syntax:: { abi , ast, codemap, ast_util} ;
45
45
use syntax:: attr:: IntType ;
46
46
use syntax:: parse:: token:: { self , special_idents} ;
47
47
@@ -412,12 +412,13 @@ pub fn create_function_debug_context<'a, 'tcx>(cx: &CrateContext<'a, 'tcx>,
412
412
assert_type_for_node_id ( cx, fn_ast_id, error_reporting_span) ;
413
413
let fn_type = cx. tcx ( ) . node_id_to_type ( fn_ast_id) ;
414
414
415
- let sig = match fn_type. sty {
415
+ let ( sig, abi ) = match fn_type. sty {
416
416
ty:: TyBareFn ( _, ref barefnty) => {
417
- cx. tcx ( ) . erase_late_bound_regions ( & barefnty. sig )
417
+ ( cx. tcx ( ) . erase_late_bound_regions ( & barefnty. sig ) , barefnty . abi )
418
418
}
419
419
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 )
421
422
}
422
423
423
424
_ => 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>,
435
436
ty:: FnDiverging => diverging_type_metadata ( cx)
436
437
} ) ;
437
438
439
+ let inputs = & if abi == abi:: RustCall {
440
+ type_of:: untuple_arguments ( cx, & sig. inputs )
441
+ } else {
442
+ sig. inputs
443
+ } ;
444
+
438
445
// Arguments types
439
- for & argument_type in & sig . inputs {
446
+ for & argument_type in inputs {
440
447
signature. push ( type_metadata ( cx, argument_type, codemap:: DUMMY_SP ) ) ;
441
448
}
442
449
0 commit comments