diff options
| author | Nicholas Nethercote <nnethercote@mozilla.com> | 2018-11-09 10:10:46 +1100 |
|---|---|---|
| committer | Nicholas Nethercote <nnethercote@mozilla.com> | 2018-11-13 06:37:16 +1100 |
| commit | fb3dd9f64ee9b34d6d0e25363ceda3a6ba9dcec3 (patch) | |
| tree | b8b1dd591c2ebd30b981c8ef401b57281e360458 /src/libsyntax | |
| parent | 49f482f5372c247dc50c1a2159a1ba5ee3cf5f15 (diff) | |
| download | rust-fb3dd9f64ee9b34d6d0e25363ceda3a6ba9dcec3.tar.gz rust-fb3dd9f64ee9b34d6d0e25363ceda3a6ba9dcec3.zip | |
Add a static assertion about the size of `ast::Expr`.
Diffstat (limited to 'src/libsyntax')
| -rw-r--r-- | src/libsyntax/ast.rs | 5 |
1 files changed, 5 insertions, 0 deletions
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<Attribute>, } +// `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::<Expr>() == 88); + impl Expr { /// Whether this expression would be valid somewhere that expects a value, for example, an `if` /// condition. |
