Skip to content

Commit 022c914

Browse files
Remove ItemKind::descr method
1 parent f46ce66 commit 022c914

File tree

3 files changed

+2
-23
lines changed

3 files changed

+2
-23
lines changed

compiler/rustc_hir/src/hir.rs

Lines changed: 0 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -4400,27 +4400,6 @@ impl ItemKind<'_> {
44004400
_ => return None,
44014401
})
44024402
}
4403-
4404-
pub fn descr(&self) -> &'static str {
4405-
match self {
4406-
ItemKind::ExternCrate(..) => "extern crate",
4407-
ItemKind::Use(..) => "`use` import",
4408-
ItemKind::Static(..) => "static item",
4409-
ItemKind::Const(..) => "constant item",
4410-
ItemKind::Fn { .. } => "function",
4411-
ItemKind::Macro(..) => "macro",
4412-
ItemKind::Mod(..) => "module",
4413-
ItemKind::ForeignMod { .. } => "extern block",
4414-
ItemKind::GlobalAsm { .. } => "global asm item",
4415-
ItemKind::TyAlias(..) => "type alias",
4416-
ItemKind::Enum(..) => "enum",
4417-
ItemKind::Struct(..) => "struct",
4418-
ItemKind::Union(..) => "union",
4419-
ItemKind::Trait(..) => "trait",
4420-
ItemKind::TraitAlias(..) => "trait alias",
4421-
ItemKind::Impl(..) => "implementation",
4422-
}
4423-
}
44244403
}
44254404

44264405
/// A reference from an trait to one of its associated items. This

compiler/rustc_passes/src/check_attr.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2844,7 +2844,7 @@ fn check_invalid_crate_level_attr(tcx: TyCtxt<'_>, attrs: &[Attribute]) {
28442844
.find(|item| !item.span.is_dummy()) // Skip prelude `use`s
28452845
.map(|item| errors::ItemFollowingInnerAttr {
28462846
span: if let Some(ident) = item.kind.ident() { ident.span } else { item.span },
2847-
kind: item.kind.descr(),
2847+
kind: tcx.def_descr(item.owner_id.to_def_id()),
28482848
});
28492849
let err = tcx.dcx().create_err(errors::InvalidAttrAtCrateLevel {
28502850
span,

tests/ui/lowering/issue-121108.stderr

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ LL | #![derive(Clone, Copy)]
55
| ^^^^^^^^^^^^^^^^^^^^^^^
66
LL |
77
LL | use std::ptr::addr_of;
8-
| ------- the inner attribute doesn't annotate this `use` import
8+
| ------- the inner attribute doesn't annotate this import
99
|
1010
help: perhaps you meant to use an outer attribute
1111
|

0 commit comments

Comments
 (0)