don't inhibit random field reordering on repr(packed(1))
This commit is contained in:
parent
e875391458
commit
37aeb75eb6
6 changed files with 14 additions and 19 deletions
|
|
@ -278,7 +278,7 @@ fn reduce_ty<'tcx>(cx: &LateContext<'tcx>, mut ty: Ty<'tcx>) -> ReducedTy<'tcx>
|
|||
ty = sized_ty;
|
||||
continue;
|
||||
}
|
||||
if def.repr().inhibit_struct_field_reordering_opt() {
|
||||
if def.repr().inhibit_struct_field_reordering() {
|
||||
ReducedTy::OrderedFields(Some(sized_ty))
|
||||
} else {
|
||||
ReducedTy::UnorderedFields(ty)
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
#![allow(dead_code)]
|
||||
|
||||
// We use packed structs to get around alignment restrictions
|
||||
#[repr(packed)]
|
||||
#[repr(C, packed)]
|
||||
struct Data {
|
||||
pad: u8,
|
||||
ptr: &'static i32,
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@ pub struct Aligned {
|
|||
_pad: [u8; 11],
|
||||
packed: Packed,
|
||||
}
|
||||
#[repr(packed)]
|
||||
#[repr(C, packed)]
|
||||
#[derive(Default, Copy, Clone)]
|
||||
pub struct Packed {
|
||||
_pad: [u8; 5],
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue