@@ -54,17 +54,11 @@ pub fn type_of_explicit_arg<'a, 'tcx>(ccx: &CrateContext<'a, 'tcx>,
54
54
}
55
55
}
56
56
57
- /// Yields the types of the "real" arguments for this function. For most
58
- /// functions, these are simply the types of the arguments. For functions with
59
- /// the `RustCall` ABI, however, this untuples the arguments of the function.
60
- pub fn untuple_arguments_if_necessary < ' a , ' tcx > ( ccx : & CrateContext < ' a , ' tcx > ,
61
- inputs : & [ Ty < ' tcx > ] ,
62
- abi : abi:: Abi )
63
- -> Vec < Ty < ' tcx > > {
64
- if abi != abi:: RustCall {
65
- return inputs. iter ( ) . cloned ( ) . collect ( )
66
- }
67
-
57
+ /// Yields the types of the "real" arguments for a function using the `RustCall`
58
+ /// ABI by untupling the arguments of the function.
59
+ pub fn untuple_arguments < ' a , ' tcx > ( ccx : & CrateContext < ' a , ' tcx > ,
60
+ inputs : & [ Ty < ' tcx > ] )
61
+ -> Vec < Ty < ' tcx > > {
68
62
if inputs. is_empty ( ) {
69
63
return Vec :: new ( )
70
64
}
@@ -78,7 +72,7 @@ pub fn untuple_arguments_if_necessary<'a, 'tcx>(ccx: &CrateContext<'a, 'tcx>,
78
72
79
73
match inputs[ inputs. len ( ) - 1 ] . sty {
80
74
ty:: TyTuple ( ref tupled_arguments) => {
81
- debug ! ( "untuple_arguments_if_necessary (): untupling arguments" ) ;
75
+ debug ! ( "untuple_arguments (): untupling arguments" ) ;
82
76
for & tupled_argument in tupled_arguments {
83
77
result. push ( tupled_argument) ;
84
78
}
@@ -108,7 +102,11 @@ pub fn type_of_rust_fn<'a, 'tcx>(cx: &CrateContext<'a, 'tcx>,
108
102
let mut atys: Vec < Type > = Vec :: new ( ) ;
109
103
110
104
// First, munge the inputs, if this has the `rust-call` ABI.
111
- let inputs = untuple_arguments_if_necessary ( cx, & sig. inputs , abi) ;
105
+ let inputs = & if abi == abi:: RustCall {
106
+ untuple_arguments ( cx, & sig. inputs )
107
+ } else {
108
+ sig. inputs
109
+ } ;
112
110
113
111
// Arg 0: Output pointer.
114
112
// (if the output type is non-immediate)
@@ -136,7 +134,7 @@ pub fn type_of_rust_fn<'a, 'tcx>(cx: &CrateContext<'a, 'tcx>,
136
134
}
137
135
138
136
// ... then explicit args.
139
- for input in & inputs {
137
+ for input in inputs {
140
138
let arg_ty = type_of_explicit_arg ( cx, input) ;
141
139
142
140
if type_is_fat_ptr ( cx. tcx ( ) , input) {
0 commit comments