We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent b0d3e04 commit f2a9356Copy full SHA for f2a9356
compiler/rustc_hir/src/hir.rs
@@ -3347,6 +3347,20 @@ pub enum OwnerNode<'hir> {
3347
}
3348
3349
impl<'hir> OwnerNode<'hir> {
3350
+ pub fn descr(&self) -> &'static str {
3351
+ match self {
3352
+ OwnerNode::Item(item) => item.kind.descr(),
3353
+ OwnerNode::ForeignItem(foreign_item) => match foreign_item.kind {
3354
+ ForeignItemKind::Fn(_, _, _) => "function",
3355
+ ForeignItemKind::Static(_, _) => "static",
3356
+ ForeignItemKind::Type => "extern type",
3357
+ },
3358
+ OwnerNode::TraitItem(_) => "trait item",
3359
+ OwnerNode::ImplItem(_) => "impl item",
3360
+ OwnerNode::Crate(_) => "crate",
3361
+ }
3362
3363
+
3364
pub fn ident(&self) -> Option<Ident> {
3365
match self {
3366
OwnerNode::Item(Item { ident, .. })
0 commit comments