1
Fork 0

Add more checks for unnamed_field during HIR analysis

This commit is contained in:
clubby789 2024-02-16 18:48:09 +00:00
parent ba824a2e25
commit 62b789fba4
8 changed files with 161 additions and 11 deletions

View file

@ -2998,6 +2998,12 @@ impl<'hir> Item<'hir> {
ItemId { owner_id: self.owner_id }
}
/// Check if this is an [`ItemKind::Enum`], [`ItemKind::Struct`] or
/// [`ItemKind::Union`].
pub fn is_adt(&self) -> bool {
matches!(self.kind, ItemKind::Enum(..) | ItemKind::Struct(..) | ItemKind::Union(..))
}
expect_methods_self_kind! {
expect_extern_crate, Option<Symbol>, ItemKind::ExternCrate(s), *s;