From f31481368bb64725bd2741636bf2c5fc4378ec30 Mon Sep 17 00:00:00 2001 From: Oli Scherer Date: Wed, 3 Mar 2021 16:25:37 +0000 Subject: [PATCH] Check the sizes of Operand, Rvalue, AggregateKind and Place --- compiler/rustc_middle/src/mir/mod.rs | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/compiler/rustc_middle/src/mir/mod.rs b/compiler/rustc_middle/src/mir/mod.rs index f0b52c698819..980f4d5f8ea5 100644 --- a/compiler/rustc_middle/src/mir/mod.rs +++ b/compiler/rustc_middle/src/mir/mod.rs @@ -1657,6 +1657,9 @@ pub struct Place<'tcx> { pub projection: &'tcx List>, } +#[cfg(target_arch = "x86_64")] +static_assert_size!(Place<'_>, 16); + #[derive(Copy, Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Hash)] #[derive(TyEncodable, TyDecodable, HashStable)] pub enum ProjectionElem { @@ -1955,6 +1958,9 @@ pub enum Operand<'tcx> { Constant(Box>), } +#[cfg(target_arch = "x86_64")] +static_assert_size!(Operand<'_>, 24); + impl<'tcx> Debug for Operand<'tcx> { fn fmt(&self, fmt: &mut Formatter<'_>) -> fmt::Result { use self::Operand::*; @@ -2090,6 +2096,9 @@ pub enum Rvalue<'tcx> { Aggregate(Box>, Vec>), } +#[cfg(target_arch = "x86_64")] +static_assert_size!(Rvalue<'_>, 56); + #[derive(Clone, Copy, Debug, PartialEq, Eq, TyEncodable, TyDecodable, Hash, HashStable)] pub enum CastKind { Misc, @@ -2113,6 +2122,9 @@ pub enum AggregateKind<'tcx> { Generator(DefId, SubstsRef<'tcx>, hir::Movability), } +#[cfg(target_arch = "x86_64")] +static_assert_size!(AggregateKind<'_>, 48); + #[derive(Copy, Clone, Debug, PartialEq, PartialOrd, Eq, TyEncodable, TyDecodable, Hash, HashStable)] pub enum BinOp { /// The `+` operator (addition)