Skip to content

Commit

Permalink
don't inhibit random field reordering on repr(packed(1))
Browse files Browse the repository at this point in the history
  • Loading branch information
RalfJung committed May 21, 2024
1 parent 0b2bf65 commit 1d4e378
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion tests/fail/reading_half_a_pointer.rs
Original file line number Diff line number Diff line change
@@ -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,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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],
Expand Down

0 comments on commit 1d4e378

Please sign in to comment.