diff --git a/Cargo.lock b/Cargo.lock index 70245d286e5c6..9e252ab60126e 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2291,6 +2291,7 @@ dependencies = [ "rustc-hash", "serde", "smallvec", + "static_assertions", ] [[package]] diff --git a/crates/ruff_python_ast/Cargo.toml b/crates/ruff_python_ast/Cargo.toml index 21c7546c9209d..b85f740223267 100644 --- a/crates/ruff_python_ast/Cargo.toml +++ b/crates/ruff_python_ast/Cargo.toml @@ -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 } diff --git a/crates/ruff_python_ast/src/nodes.rs b/crates/ruff_python_ast/src/nodes.rs index 2b8420c625325..f42f831c763a6 100644 --- a/crates/ruff_python_ast/src/nodes.rs +++ b/crates/ruff_python_ast/src/nodes.rs @@ -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]); +}