diff --git a/src/librustc/ty/context.rs b/src/librustc/ty/context.rs index 82095a2f5b01d..f78fad9f7aa9a 100644 --- a/src/librustc/ty/context.rs +++ b/src/librustc/ty/context.rs @@ -823,12 +823,6 @@ impl<'a, 'gcx> HashStable> for TypeckTables<'gcx> { impl<'tcx> CommonTypes<'tcx> { fn new(interners: &CtxtInterners<'tcx>) -> CommonTypes<'tcx> { - // Ensure our type representation does not grow - #[cfg(target_pointer_width = "64")] - static_assert!(ASSERT_TY_KIND: ::std::mem::size_of::>() <= 24); - #[cfg(target_pointer_width = "64")] - static_assert!(ASSERT_TYS: ::std::mem::size_of::>() <= 32); - let mk = |sty| CtxtInterners::intern_ty(interners, interners, sty); let mk_region = |r| { if let Some(r) = interners.region.borrow().get(&r) { diff --git a/src/librustc/ty/mod.rs b/src/librustc/ty/mod.rs index ef9b3e3efab27..3250342613510 100644 --- a/src/librustc/ty/mod.rs +++ b/src/librustc/ty/mod.rs @@ -514,6 +514,10 @@ pub struct TyS<'tcx> { outer_exclusive_binder: ty::DebruijnIndex, } +// `TyS` is used a lot. Make sure it doesn't unintentionally get bigger. +#[cfg(target_arch = "x86_64")] +static_assert!(MEM_SIZE_OF_TY_S: ::std::mem::size_of::>() == 32); + impl<'tcx> Ord for TyS<'tcx> { fn cmp(&self, other: &TyS<'tcx>) -> Ordering { self.sty.cmp(&other.sty) diff --git a/src/librustc/ty/sty.rs b/src/librustc/ty/sty.rs index a4130bf15cb82..bd3a34cae90f4 100644 --- a/src/librustc/ty/sty.rs +++ b/src/librustc/ty/sty.rs @@ -211,6 +211,10 @@ pub enum TyKind<'tcx> { Error, } +// `TyKind` is used a lot. Make sure it doesn't unintentionally get bigger. +#[cfg(target_arch = "x86_64")] +static_assert!(MEM_SIZE_OF_TY_KIND: ::std::mem::size_of::>() == 24); + /// A closure can be modeled as a struct that looks like: /// /// struct Closure<'l0...'li, T0...Tj, CK, CS, U0...Uk> { diff --git a/src/libsyntax/ast.rs b/src/libsyntax/ast.rs index fa6fe34783389..808e19d6f120f 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; +#[cfg(target_arch = "x86_64")] use rustc_data_structures::static_assert; use rustc_target::spec::abi::Abi; use source_map::{dummy_spanned, respan, Spanned};