1
Fork 0

Specify the kind of the item for E0121

This commit is contained in:
Deadbeef 2021-06-19 07:01:37 +08:00
parent 3824017f8e
commit 200fdaac77
No known key found for this signature in database
GPG key ID: 6525773485376D92
4 changed files with 81 additions and 19 deletions

View file

@ -2815,6 +2815,27 @@ impl ItemKind<'_> {
_ => return None,
})
}
pub fn descr(&self) -> &'static str {
match self {
ItemKind::ExternCrate(..) => "extern crate",
ItemKind::Use(..) => "`use` import",
ItemKind::Static(..) => "static item",
ItemKind::Const(..) => "constant item",
ItemKind::Fn(..) => "function",
ItemKind::Mod(..) => "module",
ItemKind::ForeignMod { .. } => "extern block",
ItemKind::GlobalAsm(..) => "global asm item",
ItemKind::TyAlias(..) => "type alias",
ItemKind::OpaqueTy(..) => "opaque type",
ItemKind::Enum(..) => "enum",
ItemKind::Struct(..) => "struct",
ItemKind::Union(..) => "union",
ItemKind::Trait(..) => "trait",
ItemKind::TraitAlias(..) => "trait alias",
ItemKind::Impl(..) => "implementation",
}
}
}
/// A reference from an trait to one of its associated items. This