@@ -176,7 +176,7 @@ impl<'tcx, Tag: Copy, Extra: AllocationExtra<Tag>> Allocation<Tag, Extra> {
176
176
) -> EvalResult < ' tcx , ScalarMaybeUndef < Tag > > {
177
177
// get_bytes_unchecked tests alignment and relocation edges
178
178
let bytes = self . get_bytes_with_undef_and_ptr (
179
- cx, ptr, size, ptr_align. min ( self . int_align ( cx, size) )
179
+ cx, ptr, size, ptr_align. min ( int_align ( cx, size) )
180
180
) ?;
181
181
// Undef check happens *after* we established that the alignment is correct.
182
182
// We must not return Ok() for unaligned pointers!
@@ -272,24 +272,23 @@ impl<'tcx, Tag: Copy, Extra: AllocationExtra<Tag>> Allocation<Tag, Extra> {
272
272
let ptr_size = cx. data_layout ( ) . pointer_size ;
273
273
self . write_scalar ( cx, ptr. into ( ) , ptr_align, val, ptr_size)
274
274
}
275
+ }
275
276
276
- fn int_align (
277
- & self ,
278
- cx : & impl HasDataLayout ,
279
- size : Size ,
280
- ) -> Align {
281
- // We assume pointer-sized integers have the same alignment as pointers.
282
- // We also assume signed and unsigned integers of the same size have the same alignment.
283
- let ity = match size. bytes ( ) {
284
- 1 => layout:: I8 ,
285
- 2 => layout:: I16 ,
286
- 4 => layout:: I32 ,
287
- 8 => layout:: I64 ,
288
- 16 => layout:: I128 ,
289
- _ => bug ! ( "bad integer size: {}" , size. bytes( ) ) ,
290
- } ;
291
- ity. align ( cx) . abi
292
- }
277
+ fn int_align (
278
+ cx : & impl HasDataLayout ,
279
+ size : Size ,
280
+ ) -> Align {
281
+ // We assume pointer-sized integers have the same alignment as pointers.
282
+ // We also assume signed and unsigned integers of the same size have the same alignment.
283
+ let ity = match size. bytes ( ) {
284
+ 1 => layout:: I8 ,
285
+ 2 => layout:: I16 ,
286
+ 4 => layout:: I32 ,
287
+ 8 => layout:: I64 ,
288
+ 16 => layout:: I128 ,
289
+ _ => bug ! ( "bad integer size: {}" , size. bytes( ) ) ,
290
+ } ;
291
+ ity. align ( cx) . abi
293
292
}
294
293
295
294
/// Byte accessors
0 commit comments