Skip to content

Commit

Permalink
Add a static size assertion for MatcherPos.
Browse files Browse the repository at this point in the history
  • Loading branch information
nnethercote committed Mar 3, 2022
1 parent 11c565f commit b9fabc3
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions compiler/rustc_expand/src/mbe/macro_parser.rs
Expand Up @@ -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) {
Expand Down

0 comments on commit b9fabc3

Please sign in to comment.