@@ -38,7 +38,7 @@ fn apply_arg_attrs_to_abi_param(mut param: AbiParam, arg_attrs: ArgAttributes) -
38
38
param
39
39
}
40
40
41
- fn cast_target_to_abi_params ( cast : CastTarget ) -> SmallVec < [ AbiParam ; 2 ] > {
41
+ fn cast_target_to_abi_params ( cast : & CastTarget ) -> SmallVec < [ AbiParam ; 2 ] > {
42
42
let ( rest_count, rem_bytes) = if cast. rest . unit . size . bytes ( ) == 0 {
43
43
( 0 , 0 )
44
44
} else {
@@ -100,7 +100,7 @@ impl<'tcx> ArgAbiExt<'tcx> for ArgAbi<'tcx, Ty<'tcx>> {
100
100
}
101
101
_ => unreachable ! ( "{:?}" , self . layout. abi) ,
102
102
} ,
103
- PassMode :: Cast ( cast) => cast_target_to_abi_params ( cast) ,
103
+ PassMode :: Cast ( ref cast) => cast_target_to_abi_params ( cast) ,
104
104
PassMode :: Indirect { attrs, extra_attrs : None , on_stack } => {
105
105
if on_stack {
106
106
// Abi requires aligning struct size to pointer size
@@ -145,7 +145,9 @@ impl<'tcx> ArgAbiExt<'tcx> for ArgAbi<'tcx, Ty<'tcx>> {
145
145
}
146
146
_ => unreachable ! ( "{:?}" , self . layout. abi) ,
147
147
} ,
148
- PassMode :: Cast ( cast) => ( None , cast_target_to_abi_params ( cast) . into_iter ( ) . collect ( ) ) ,
148
+ PassMode :: Cast ( ref cast) => {
149
+ ( None , cast_target_to_abi_params ( cast) . into_iter ( ) . collect ( ) )
150
+ }
149
151
PassMode :: Indirect { attrs : _, extra_attrs : None , on_stack } => {
150
152
assert ! ( !on_stack) ;
151
153
( Some ( AbiParam :: special ( pointer_ty ( tcx) , ArgumentPurpose :: StructReturn ) ) , vec ! [ ] )
@@ -160,7 +162,7 @@ impl<'tcx> ArgAbiExt<'tcx> for ArgAbi<'tcx, Ty<'tcx>> {
160
162
pub ( super ) fn to_casted_value < ' tcx > (
161
163
fx : & mut FunctionCx < ' _ , ' _ , ' tcx > ,
162
164
arg : CValue < ' tcx > ,
163
- cast : CastTarget ,
165
+ cast : & CastTarget ,
164
166
) -> SmallVec < [ Value ; 2 ] > {
165
167
let ( ptr, meta) = arg. force_stack ( fx) ;
166
168
assert ! ( meta. is_none( ) ) ;
@@ -179,7 +181,7 @@ pub(super) fn from_casted_value<'tcx>(
179
181
fx : & mut FunctionCx < ' _ , ' _ , ' tcx > ,
180
182
block_params : & [ Value ] ,
181
183
layout : TyAndLayout < ' tcx > ,
182
- cast : CastTarget ,
184
+ cast : & CastTarget ,
183
185
) -> CValue < ' tcx > {
184
186
let abi_params = cast_target_to_abi_params ( cast) ;
185
187
let abi_param_size: u32 = abi_params. iter ( ) . map ( |param| param. value_type . bytes ( ) ) . sum ( ) ;
@@ -224,7 +226,7 @@ pub(super) fn adjust_arg_for_abi<'tcx>(
224
226
let ( a, b) = arg. load_scalar_pair ( fx) ;
225
227
smallvec ! [ a, b]
226
228
}
227
- PassMode :: Cast ( cast) => to_casted_value ( fx, arg, cast) ,
229
+ PassMode :: Cast ( ref cast) => to_casted_value ( fx, arg, cast) ,
228
230
PassMode :: Indirect { .. } => {
229
231
if is_owned {
230
232
match arg. force_stack ( fx) {
@@ -268,7 +270,7 @@ pub(super) fn cvalue_for_param<'tcx>(
268
270
local,
269
271
local_field,
270
272
& block_params,
271
- arg_abi. mode ,
273
+ & arg_abi. mode ,
272
274
arg_abi. layout ,
273
275
) ;
274
276
@@ -282,7 +284,9 @@ pub(super) fn cvalue_for_param<'tcx>(
282
284
assert_eq ! ( block_params. len( ) , 2 , "{:?}" , block_params) ;
283
285
Some ( CValue :: by_val_pair ( block_params[ 0 ] , block_params[ 1 ] , arg_abi. layout ) )
284
286
}
285
- PassMode :: Cast ( cast) => Some ( from_casted_value ( fx, & block_params, arg_abi. layout , cast) ) ,
287
+ PassMode :: Cast ( ref cast) => {
288
+ Some ( from_casted_value ( fx, & block_params, arg_abi. layout , cast) )
289
+ }
286
290
PassMode :: Indirect { attrs : _, extra_attrs : None , on_stack : _ } => {
287
291
assert_eq ! ( block_params. len( ) , 1 , "{:?}" , block_params) ;
288
292
Some ( CValue :: by_ref ( Pointer :: new ( block_params[ 0 ] ) , arg_abi. layout ) )
0 commit comments