Skip to content

Commit 49f482f

Browse files
committed
Move a static_assert! to a better spot.
And make it x86_64-only so it can use `==` instead of `<=`.
1 parent ab8a947 commit 49f482f

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

src/librustc/mir/mod.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1719,14 +1719,14 @@ pub struct Statement<'tcx> {
17191719
pub kind: StatementKind<'tcx>,
17201720
}
17211721

1722+
// `Statement` is used a lot. Make sure it doesn't unintentionally get bigger.
1723+
#[cfg(target_arch = "x86_64")]
1724+
static_assert!(MEM_SIZE_OF_STATEMENT: mem::size_of::<Statement<'_>>() == 56);
1725+
17221726
impl<'tcx> Statement<'tcx> {
17231727
/// Changes a statement to a nop. This is both faster than deleting instructions and avoids
17241728
/// invalidating statement indices in `Location`s.
17251729
pub fn make_nop(&mut self) {
1726-
// `Statement` contributes significantly to peak memory usage. Make
1727-
// sure it doesn't get bigger.
1728-
static_assert!(STATEMENT_IS_AT_MOST_56_BYTES: mem::size_of::<Statement<'_>>() <= 56);
1729-
17301730
self.kind = StatementKind::Nop
17311731
}
17321732

0 commit comments

Comments
 (0)