mirror of
https://github.com/rust-lang/rust.git
synced 2025-04-28 02:57:37 +00:00
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:
parent
ab8a947fa0
commit
49f482f537
@ -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
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user