From 5a3ec3780ea1345dc2745ce9935c92fdd43402db Mon Sep 17 00:00:00 2001 From: Ralf Jung Date: Sun, 17 Apr 2022 21:46:42 -0400 Subject: [PATCH] add size assertions for some core types --- src/machine.rs | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/machine.rs b/src/machine.rs index 9e0cb69f28..532aeeece0 100644 --- a/src/machine.rs +++ b/src/machine.rs @@ -12,6 +12,8 @@ use rand::SeedableRng; use rustc_ast::ast::Mutability; use rustc_data_structures::fx::FxHashMap; +#[allow(unused)] +use rustc_data_structures::static_assert_size; use rustc_middle::{ mir, ty::{ @@ -128,6 +130,13 @@ pub struct Tag { pub sb: SbTag, } +#[cfg(all(target_arch = "x86_64", target_pointer_width = "64"))] +static_assert_size!(Pointer, 24); +#[cfg(all(target_arch = "x86_64", target_pointer_width = "64"))] +static_assert_size!(Pointer>, 24); +#[cfg(all(target_arch = "x86_64", target_pointer_width = "64"))] +static_assert_size!(ScalarMaybeUninit, 32); + impl Provenance for Tag { /// We use absolute addresses in the `offset` of a `Pointer`. const OFFSET_IS_ADDR: bool = true;