@@ -5,6 +5,7 @@ use rustc_middle::ty::layout::LayoutOf as _;
5
5
use rustc_span:: Symbol ;
6
6
use rustc_target:: callconv:: { Conv , FnAbi } ;
7
7
8
+ use crate :: helpers:: get_arg;
8
9
use crate :: * ;
9
10
10
11
/// A bitmask constant for scrutinizing the immediate byte provided
@@ -204,11 +205,11 @@ fn deconstruct_args<'tcx>(
204
205
abi : & FnAbi < ' tcx , Ty < ' tcx > > ,
205
206
args : & [ OpTy < ' tcx > ] ,
206
207
) -> InterpResult < ' tcx , ( OpTy < ' tcx > , OpTy < ' tcx > , Option < ( u64 , u64 ) > , u8 ) > {
207
- let array_layout_fn = |ecx : & mut MiriInterpCx < ' tcx > , imm : u8 | {
208
+ let array_ty_fn = |ecx : & mut MiriInterpCx < ' tcx > , imm : u8 | {
208
209
if imm & USE_WORDS != 0 {
209
- ecx . layout_of ( Ty :: new_array ( ecx. tcx . tcx , ecx. tcx . types . u16 , 8 ) )
210
+ Ty :: new_array ( ecx. tcx . tcx , ecx. tcx . types . u16 , 8 )
210
211
} else {
211
- ecx . layout_of ( Ty :: new_array ( ecx. tcx . tcx , ecx. tcx . types . u8 , 16 ) )
212
+ Ty :: new_array ( ecx. tcx . tcx , ecx. tcx . types . u8 , 16 )
212
213
}
213
214
} ;
214
215
@@ -230,18 +231,18 @@ fn deconstruct_args<'tcx>(
230
231
let len1 = u64:: from ( ecx. read_scalar ( len1) ?. to_u32 ( ) ?. min ( default_len) ) ;
231
232
let len2 = u64:: from ( ecx. read_scalar ( len2) ?. to_u32 ( ) ?. min ( default_len) ) ;
232
233
233
- let array_layout = array_layout_fn ( ecx, imm) ? ;
234
- let str1 = str1 . transmute ( array_layout , ecx ) ?;
235
- let str2 = str2 . transmute ( array_layout , ecx ) ?;
234
+ let array_ty = array_ty_fn ( ecx, imm) ;
235
+ let str1 = get_arg ( ecx , str1 , array_ty ) ?;
236
+ let str2 = get_arg ( ecx , str2 , array_ty ) ?;
236
237
237
238
interp_ok ( ( str1, str2, Some ( ( len1, len2) ) , imm) )
238
239
} else {
239
240
let [ str1, str2, imm] = ecx. check_shim ( abi, Conv :: C , link_name, args) ?;
240
241
let imm = ecx. read_scalar ( imm) ?. to_u8 ( ) ?;
241
242
242
- let array_layout = array_layout_fn ( ecx, imm) ? ;
243
- let str1 = str1 . transmute ( array_layout , ecx ) ?;
244
- let str2 = str2 . transmute ( array_layout , ecx ) ?;
243
+ let array_ty = array_ty_fn ( ecx, imm) ;
244
+ let str1 = get_arg ( ecx , str1 , array_ty ) ?;
245
+ let str2 = get_arg ( ecx , str2 , array_ty ) ?;
245
246
246
247
interp_ok ( ( str1, str2, None , imm) )
247
248
}
0 commit comments