Move a static_assert! to a better spot.

And make it x86_64-only so it can use `==` instead of `<=`.
This commit is contained in:
Nicholas Nethercote 2018-11-09 10:19:51 +11:00
parent ab8a947fa0
commit 49f482f537

View File

@ -1719,14 +1719,14 @@ pub struct Statement<'tcx> {
pub kind: StatementKind<'tcx>,
}
// `Statement` is used a lot. Make sure it doesn't unintentionally get bigger.
#[cfg(target_arch = "x86_64")]
static_assert!(MEM_SIZE_OF_STATEMENT: mem::size_of::<Statement<'_>>() == 56);
impl<'tcx> Statement<'tcx> {
/// Changes a statement to a nop. This is both faster than deleting instructions and avoids
/// invalidating statement indices in `Location`s.
pub fn make_nop(&mut self) {
// `Statement` contributes significantly to peak memory usage. Make
// sure it doesn't get bigger.
static_assert!(STATEMENT_IS_AT_MOST_56_BYTES: mem::size_of::<Statement<'_>>() <= 56);
self.kind = StatementKind::Nop
}