Skip to content

Commit

Permalink
Assert the size of the refactored enums
Browse files Browse the repository at this point in the history
  • Loading branch information
bugadani committed Feb 1, 2021
1 parent b87e1ec commit 003fba3
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions compiler/rustc_ast/src/ast.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2663,6 +2663,7 @@ pub struct TraitKind(
pub GenericBounds,
pub Vec<P<AssocItem>>,
);

#[derive(Clone, Encodable, Decodable, Debug)]
pub struct TyAliasKind(pub Defaultness, pub Generics, pub GenericBounds, pub Option<P<Ty>>);

Expand Down Expand Up @@ -2753,6 +2754,9 @@ pub enum ItemKind {
MacroDef(MacroDef),
}

#[cfg(target_arch = "x86_64")]
rustc_data_structures::static_assert_size!(ItemKind, 112);

impl ItemKind {
pub fn article(&self) -> &str {
use ItemKind::*;
Expand Down Expand Up @@ -2824,6 +2828,9 @@ pub enum AssocItemKind {
MacCall(MacCall),
}

#[cfg(target_arch = "x86_64")]
rustc_data_structures::static_assert_size!(AssocItemKind, 72);

impl AssocItemKind {
pub fn defaultness(&self) -> Defaultness {
match *self {
Expand Down Expand Up @@ -2873,6 +2880,9 @@ pub enum ForeignItemKind {
MacCall(MacCall),
}

#[cfg(target_arch = "x86_64")]
rustc_data_structures::static_assert_size!(ForeignItemKind, 72);

impl From<ForeignItemKind> for ItemKind {
fn from(foreign_item_kind: ForeignItemKind) -> ItemKind {
match foreign_item_kind {
Expand Down

0 comments on commit 003fba3

Please sign in to comment.