about summary refs log tree commit diff
diff options
context:
space:
mode:
authorOli Scherer <github35764891676564198441@oli-obk.de>2021-03-03 16:25:37 +0000
committerOli Scherer <github35764891676564198441@oli-obk.de>2021-03-03 17:01:38 +0000
commitf31481368bb64725bd2741636bf2c5fc4378ec30 (patch)
tree811cc58be46beb12a26f9dfcd615ffa38345def5
parent939b14334dfec68d85b01b62c1be0172cee03339 (diff)
downloadrust-f31481368bb64725bd2741636bf2c5fc4378ec30.tar.gz
rust-f31481368bb64725bd2741636bf2c5fc4378ec30.zip
Check the sizes of Operand, Rvalue, AggregateKind and Place
-rw-r--r--compiler/rustc_middle/src/mir/mod.rs12
1 files changed, 12 insertions, 0 deletions
diff --git a/compiler/rustc_middle/src/mir/mod.rs b/compiler/rustc_middle/src/mir/mod.rs
index f0b52c69881..980f4d5f8ea 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<PlaceElem<'tcx>>,
 }
 
+#[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<V, T> {
@@ -1955,6 +1958,9 @@ pub enum Operand<'tcx> {
     Constant(Box<Constant<'tcx>>),
 }
 
+#[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<AggregateKind<'tcx>>, Vec<Operand<'tcx>>),
 }
 
+#[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)