mirror of
https://github.com/openharmony/third_party_rust_bytes.git
synced 2026-07-18 16:24:29 -04:00
Assert that the alignment of Shared is appropriate (#362)
This commit is contained in:
committed by
Sean McArthur
parent
ab3934634c
commit
1efd9958a3
@@ -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::<Shared>() % 2] = []; // Assert that the alignment of `Shared` is divisible by 2.
|
||||
|
||||
static SHARED_VTABLE: Vtable = Vtable {
|
||||
clone: shared_clone,
|
||||
drop: shared_drop,
|
||||
|
||||
Reference in New Issue
Block a user