mirror of
https://github.com/rust-lang/rust.git
synced 2025-05-14 02:49:40 +00:00
Rollup merge of #101473 - nnethercote:mir-size-assertions, r=lqd
Add more size assertions for MIR types. And move them into a module, as has been done previously for AST, HIR, etc. r? `@lqd`
This commit is contained in:
commit
f21b6129a0
@ -839,10 +839,6 @@ pub struct LocalDecl<'tcx> {
|
||||
pub source_info: SourceInfo,
|
||||
}
|
||||
|
||||
// `LocalDecl` is used a lot. Make sure it doesn't unintentionally get bigger.
|
||||
#[cfg(all(target_arch = "x86_64", target_pointer_width = "64"))]
|
||||
static_assert_size!(LocalDecl<'_>, 56);
|
||||
|
||||
/// Extra information about a some locals that's used for diagnostics and for
|
||||
/// classifying variables into local variables, statics, etc, which is needed e.g.
|
||||
/// for unsafety checking.
|
||||
@ -1317,10 +1313,6 @@ pub struct Statement<'tcx> {
|
||||
pub kind: StatementKind<'tcx>,
|
||||
}
|
||||
|
||||
// `Statement` is used a lot. Make sure it doesn't unintentionally get bigger.
|
||||
#[cfg(all(target_arch = "x86_64", target_pointer_width = "64"))]
|
||||
static_assert_size!(Statement<'_>, 32);
|
||||
|
||||
impl Statement<'_> {
|
||||
/// Changes a statement to a nop. This is both faster than deleting instructions and avoids
|
||||
/// invalidating statement indices in `Location`s.
|
||||
@ -2900,3 +2892,17 @@ impl Location {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Some nodes are used a lot. Make sure they don't unintentionally get bigger.
|
||||
#[cfg(all(target_arch = "x86_64", target_pointer_width = "64"))]
|
||||
mod size_asserts {
|
||||
use super::*;
|
||||
use rustc_data_structures::static_assert_size;
|
||||
// These are in alphabetical order, which is easy to maintain.
|
||||
static_assert_size!(BasicBlockData<'_>, 144);
|
||||
static_assert_size!(LocalDecl<'_>, 56);
|
||||
static_assert_size!(Statement<'_>, 32);
|
||||
static_assert_size!(StatementKind<'_>, 16);
|
||||
static_assert_size!(Terminator<'_>, 112);
|
||||
static_assert_size!(TerminatorKind<'_>, 96);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user