Add static assertions to nodes (#6228)

This commit is contained in:
Micha Reiser 2023-08-01 11:54:49 +02:00 committed by GitHub
parent 07468f8be9
commit ecfdd8d58b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 15 additions and 0 deletions

1
Cargo.lock generated
View file

@ -2291,6 +2291,7 @@ dependencies = [
"rustc-hash",
"serde",
"smallvec",
"static_assertions",
]
[[package]]

View file

@ -28,6 +28,7 @@ once_cell = { workspace = true }
rustc-hash = { workspace = true }
serde = { workspace = true, optional = true }
smallvec = { workspace = true }
static_assertions = "1.1.0"
[dev-dependencies]
insta = { workspace = true }

View file

@ -3044,3 +3044,16 @@ impl Ranged for crate::nodes::ArgWithDefault {
self.range
}
}
#[cfg(target_pointer_width = "64")]
mod size_assertions {
#[allow(clippy::wildcard_imports)]
use super::*;
use static_assertions::assert_eq_size;
assert_eq_size!(Stmt, [u8; 168]);
assert_eq_size!(Expr, [u8; 80]);
assert_eq_size!(Constant, [u8; 32]);
assert_eq_size!(Pattern, [u8; 96]);
assert_eq_size!(Mod, [u8; 64]);
}