Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 0a7816f

Browse files
authoredJan 23, 2025
Rollup merge of rust-lang#135855 - cuviper:parser-size, r=wesleywiser
Only assert the `Parser` size on specific arches The size of this struct depends on the alignment of `u128`, for example powerpc64le and s390x have align-8 and end up with only 280 bytes. Our 64-bit tier-1 arches are the same though, so let's just assert on those. r? nnethercote
2 parents 44859e6 + aef640a commit 0a7816f

File tree

1 file changed

+3
-2
lines changed
  • compiler/rustc_parse/src/parser

1 file changed

+3
-2
lines changed
 

‎compiler/rustc_parse/src/parser/mod.rs

+3-2
Original file line numberDiff line numberDiff line change
@@ -189,8 +189,9 @@ pub struct Parser<'a> {
189189
}
190190

191191
// This type is used a lot, e.g. it's cloned when matching many declarative macro rules with
192-
// nonterminals. Make sure it doesn't unintentionally get bigger.
193-
#[cfg(all(target_pointer_width = "64", not(target_arch = "s390x")))]
192+
// nonterminals. Make sure it doesn't unintentionally get bigger. We only check a few arches
193+
// though, because `TokenTypeSet(u128)` alignment varies on others, changing the total size.
194+
#[cfg(all(target_pointer_width = "64", any(target_arch = "aarch64", target_arch = "x86_64")))]
194195
rustc_data_structures::static_assert_size!(Parser<'_>, 288);
195196

196197
/// Stores span information about a closure.

0 commit comments

Comments
 (0)
Failed to load comments.