mirror of https://github.com/astral-sh/ruff
Add static assertions to nodes (#6228)
This commit is contained in:
parent
07468f8be9
commit
ecfdd8d58b
|
|
@ -2291,6 +2291,7 @@ dependencies = [
|
||||||
"rustc-hash",
|
"rustc-hash",
|
||||||
"serde",
|
"serde",
|
||||||
"smallvec",
|
"smallvec",
|
||||||
|
"static_assertions",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
|
|
|
||||||
|
|
@ -28,6 +28,7 @@ once_cell = { workspace = true }
|
||||||
rustc-hash = { workspace = true }
|
rustc-hash = { workspace = true }
|
||||||
serde = { workspace = true, optional = true }
|
serde = { workspace = true, optional = true }
|
||||||
smallvec = { workspace = true }
|
smallvec = { workspace = true }
|
||||||
|
static_assertions = "1.1.0"
|
||||||
|
|
||||||
[dev-dependencies]
|
[dev-dependencies]
|
||||||
insta = { workspace = true }
|
insta = { workspace = true }
|
||||||
|
|
|
||||||
|
|
@ -3044,3 +3044,16 @@ impl Ranged for crate::nodes::ArgWithDefault {
|
||||||
self.range
|
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]);
|
||||||
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue