From c2bbfeadcce08a4b8ce02b66906ecc542cc9df39 Mon Sep 17 00:00:00 2001 From: Paul Dicker Date: Thu, 24 Oct 2019 17:08:23 +0200 Subject: Always align Waiter to 4 bytes --- src/libstd/sync/once.rs | 1 + 1 file changed, 1 insertion(+) (limited to 'src/libstd/sync') diff --git a/src/libstd/sync/once.rs b/src/libstd/sync/once.rs index 4c14fe75643..c135471e2f2 100644 --- a/src/libstd/sync/once.rs +++ b/src/libstd/sync/once.rs @@ -171,6 +171,7 @@ const STATE_MASK: usize = 0x3; // `wait` would both hand out a mutable reference to its `Waiter` node, and keep // a shared reference to check `signaled`. Instead we hold shared references and // use interior mutability. +#[repr(align(4))] // Ensure the two lower bits are free to use as state bits. struct Waiter { thread: Cell>, signaled: AtomicBool, -- cgit 1.4.1-3-g733a5