Skip to content

Commit

Permalink
Add static assertion for the size of ItemKind
Browse files Browse the repository at this point in the history
  • Loading branch information
jyn514 committed Dec 29, 2020
1 parent 4a44263 commit 5fce0dd
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/librustdoc/clean/types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,10 @@ crate struct Item {
crate def_id: DefId,
}

// `Item` is used a lot. Make sure it doesn't unintentionally get bigger.
#[cfg(target_arch = "x86_64")]
rustc_data_structures::static_assert_size!(Item, 136);

impl fmt::Debug for Item {
fn fmt(&self, fmt: &mut fmt::Formatter<'_>) -> fmt::Result {
let def_id: &dyn fmt::Debug = if self.is_fake() { &"**FAKE**" } else { &self.def_id };
Expand Down

0 comments on commit 5fce0dd

Please sign in to comment.