about summary refs log tree commit diff
path: root/src/libstd
diff options
context:
space:
mode:
authorPaul Dicker <pitdicker@gmail.com>2019-10-24 17:08:23 +0200
committerPaul Dicker <pitdicker@gmail.com>2019-10-24 17:57:07 +0200
commitc2bbfeadcce08a4b8ce02b66906ecc542cc9df39 (patch)
tree61e7aedb8a138a477f10312a6f853ac62e0e40ec /src/libstd
parentc11a44ab6ce693629a03554b8b35d2218bca83cf (diff)
downloadrust-c2bbfeadcce08a4b8ce02b66906ecc542cc9df39.tar.gz
rust-c2bbfeadcce08a4b8ce02b66906ecc542cc9df39.zip
Always align Waiter to 4 bytes
Diffstat (limited to 'src/libstd')
-rw-r--r--src/libstd/sync/once.rs1
1 files changed, 1 insertions, 0 deletions
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<Option<Thread>>,
     signaled: AtomicBool,