about summary refs log tree commit diff
diff options
context:
space:
mode:
authorNicholas Nethercote <n.nethercote@gmail.com>2022-03-03 11:02:43 +1100
committerNicholas Nethercote <n.nethercote@gmail.com>2022-03-03 21:45:45 +1100
commitb9fabc3f9cce1e29cd54f1809b4ac8dc3c52980f (patch)
tree8d707a43b124dd0edd708f31a9355e9c54cbbc21
parent11c565f14b03fe06e3149ebb83e546a627a6b649 (diff)
downloadrust-b9fabc3f9cce1e29cd54f1809b4ac8dc3c52980f.tar.gz
rust-b9fabc3f9cce1e29cd54f1809b4ac8dc3c52980f.zip
Add a static size assertion for `MatcherPos`.
-rw-r--r--compiler/rustc_expand/src/mbe/macro_parser.rs4
1 files changed, 4 insertions, 0 deletions
diff --git a/compiler/rustc_expand/src/mbe/macro_parser.rs b/compiler/rustc_expand/src/mbe/macro_parser.rs
index 596fee21cdd..577e2c823ba 100644
--- a/compiler/rustc_expand/src/mbe/macro_parser.rs
+++ b/compiler/rustc_expand/src/mbe/macro_parser.rs
@@ -207,6 +207,10 @@ struct MatcherPos<'root, 'tt> {
     stack: SmallVec<[MatcherTtFrame<'tt>; 1]>,
 }
 
+// This type is used a lot. Make sure it doesn't unintentionally get bigger.
+#[cfg(all(target_arch = "x86_64", target_pointer_width = "64"))]
+rustc_data_structures::static_assert_size!(MatcherPos<'_, '_>, 192);
+
 impl<'root, 'tt> MatcherPos<'root, 'tt> {
     /// Adds `m` as a named match for the `idx`-th metavar.
     fn push_match(&mut self, idx: usize, m: NamedMatch) {