Skip to content

Commit ceb3fc0

Browse files
authored
Merge pull request #606 from Mortano/union-repr
Fix memory layout of UnionNode<T> in pool module
2 parents ae6e2ab + ca2368d commit ceb3fc0

File tree

2 files changed

+2
-0
lines changed

2 files changed

+2
-0
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
3333

3434
- CI now uses flags specified in `Cargo.toml` for `rustdoc` tests.
3535
- Fixed clippy lints.
36+
- Fixed the memory layout of the internal `UnionNode<T>` type, fixing possible Undefined Behaviour.
3637

3738
### Removed
3839

src/pool/treiber.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ pub trait Node: Sized {
4444
fn next_mut(&mut self) -> &mut AtomicPtr<Self>;
4545
}
4646

47+
#[repr(C)]
4748
pub union UnionNode<T> {
4849
next: ManuallyDrop<AtomicPtr<UnionNode<T>>>,
4950
pub data: ManuallyDrop<T>,

0 commit comments

Comments
 (0)