Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion src/bytes.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1348,7 +1348,12 @@ impl Drop for Shared {
// This is a necessary invariant since we depend on allocating `Shared` a
// shared object to implicitly carry the `KIND_ARC` flag in its pointer.
// This flag is set when the LSB is 0.
const _: [(); 0 - mem::align_of::<Shared>() % 2] = []; // Assert that the alignment of `Shared` is divisible by 2.
const _: () = {
assert!(
mem::align_of::<Shared>() % 2 == 0,
"Shared alignment must be divisible by 2 for pointer tagging"
);
};

static SHARED_VTABLE: Vtable = Vtable {
clone: shared_clone,
Expand Down
7 changes: 6 additions & 1 deletion src/bytes_mut.rs
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,12 @@ impl Shared {
// This is a necessary invariant since we depend on allocating `Shared` a
// shared object to implicitly carry the `KIND_ARC` flag in its pointer.
// This flag is set when the LSB is 0.
const _: [(); 0 - mem::align_of::<Shared>() % 2] = []; // Assert that the alignment of `Shared` is divisible by 2.
const _: () = {
assert!(
mem::align_of::<Shared>() % 2 == 0,
"Shared alignment must be divisible by 2 for pointer tagging"
);
};

// Buffer storage strategy flags.
const KIND_ARC: usize = 0b0;
Expand Down
Loading