about summary refs log tree commit diff
diff options
context:
space:
mode:
authorCamille GILLOT <gillot.camille@gmail.com>2021-01-29 19:27:56 +0100
committerCamille GILLOT <gillot.camille@gmail.com>2021-02-15 19:24:57 +0100
commitac8961fc047dd33701289f6040e3808fcfb5fb41 (patch)
treeef1a74add765a774f429a273052b6e6c5b70c162
parent21b0cdc9c0912b953a34d1d2f5fc4b2ff1add8d1 (diff)
downloadrust-ac8961fc047dd33701289f6040e3808fcfb5fb41.tar.gz
rust-ac8961fc047dd33701289f6040e3808fcfb5fb41.zip
Add assertions on HIR enum sizes.
-rw-r--r--compiler/rustc_hir/src/hir.rs19
1 files changed, 15 insertions, 4 deletions
diff --git a/compiler/rustc_hir/src/hir.rs b/compiler/rustc_hir/src/hir.rs
index 9609510d0af..298e3a123cf 100644
--- a/compiler/rustc_hir/src/hir.rs
+++ b/compiler/rustc_hir/src/hir.rs
@@ -1413,10 +1413,6 @@ pub struct Expr<'hir> {
     pub span: Span,
 }
 
-// `Expr` is used a lot. Make sure it doesn't unintentionally get bigger.
-#[cfg(target_arch = "x86_64")]
-rustc_data_structures::static_assert_size!(Expr<'static>, 72);
-
 impl Expr<'_> {
     pub fn precedence(&self) -> ExprPrecedence {
         match self.kind {
@@ -2897,3 +2893,18 @@ impl<'hir> Node<'hir> {
         }
     }
 }
+
+// Some nodes are used a lot. Make sure they don't unintentionally get bigger.
+#[cfg(target_arch = "x86_64")]
+mod size_asserts {
+    rustc_data_structures::static_assert_size!(super::Block<'static>, 48);
+    rustc_data_structures::static_assert_size!(super::Expr<'static>, 72);
+    rustc_data_structures::static_assert_size!(super::Pat<'static>, 88);
+    rustc_data_structures::static_assert_size!(super::QPath<'static>, 24);
+    rustc_data_structures::static_assert_size!(super::Ty<'static>, 72);
+
+    rustc_data_structures::static_assert_size!(super::Item<'static>, 208);
+    rustc_data_structures::static_assert_size!(super::TraitItem<'static>, 152);
+    rustc_data_structures::static_assert_size!(super::ImplItem<'static>, 168);
+    rustc_data_structures::static_assert_size!(super::ForeignItem<'static>, 160);
+}