From fb3dd9f64ee9b34d6d0e25363ceda3a6ba9dcec3 Mon Sep 17 00:00:00 2001 From: Nicholas Nethercote Date: Fri, 9 Nov 2018 10:10:46 +1100 Subject: Add a static assertion about the size of `ast::Expr`. --- src/libsyntax/ast.rs | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'src/libsyntax') diff --git a/src/libsyntax/ast.rs b/src/libsyntax/ast.rs index 2f17bc0548c..fa6fe347833 100644 --- a/src/libsyntax/ast.rs +++ b/src/libsyntax/ast.rs @@ -20,6 +20,7 @@ use print::pprust; use ptr::P; use rustc_data_structures::indexed_vec; use rustc_data_structures::indexed_vec::Idx; +use rustc_data_structures::static_assert; use rustc_target::spec::abi::Abi; use source_map::{dummy_spanned, respan, Spanned}; use symbol::{keywords, Symbol}; @@ -924,6 +925,10 @@ pub struct Expr { pub attrs: ThinVec, } +// `Expr` is used a lot. Make sure it doesn't unintentionally get bigger. +#[cfg(target_arch = "x86_64")] +static_assert!(MEM_SIZE_OF_EXPR: std::mem::size_of::() == 88); + impl Expr { /// Whether this expression would be valid somewhere that expects a value, for example, an `if` /// condition. -- cgit 1.4.1-3-g733a5