Fix size assertion between OpaqueValue and Value

Make it an equals check, to match the comments further down
when using transmute.
This commit is contained in:
Simon Hausmann 2021-03-17 16:58:15 +01:00
parent 79612d7354
commit f09ea8bf6f

View file

@ -748,8 +748,8 @@ pub(crate) mod ffi {
#[repr(C)]
pub struct ValueOpaque([usize; 7]);
/// Asserts that ValueOpaque is at least as large as Value, otherwise this would overflow
const _: usize = std::mem::size_of::<ValueOpaque>() - std::mem::size_of::<Value>();
/// Asserts that ValueOpaque is as large as Value and has the same alignment, to make transmute safe.
const _: [(); std::mem::size_of::<ValueOpaque>()] = [(); std::mem::size_of::<Value>()];
const _: [(); std::mem::align_of::<ValueOpaque>()] = [(); std::mem::align_of::<Value>()];
impl ValueOpaque {