diff --git a/src/bytes.rs b/src/bytes.rs index d8af5b52d..35a3c752a 100644 --- a/src/bytes.rs +++ b/src/bytes.rs @@ -905,6 +905,12 @@ struct Shared { ref_cnt: AtomicUsize, } +// Assert that the alignment of `Shared` is divisible by 2. +// 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::() % 2] = []; // Assert that the alignment of `Shared` is divisible by 2. + static SHARED_VTABLE: Vtable = Vtable { clone: shared_clone, drop: shared_drop,