1
Fork 0

Fix ICE when using #[doc(keyword = "...")] on non-items

This commit is contained in:
Fabian Wolff 2021-06-17 16:45:26 +02:00
parent b17d9c1332
commit 2cedd86b1c
3 changed files with 23 additions and 2 deletions

View file

@ -525,8 +525,11 @@ impl CheckAttrVisitor<'tcx> {
self.doc_attr_str_error(meta, "keyword");
return false;
}
match self.tcx.hir().expect_item(hir_id).kind {
ItemKind::Mod(ref module) => {
match self.tcx.hir().find(hir_id).and_then(|node| match node {
hir::Node::Item(item) => Some(&item.kind),
_ => None,
}) {
Some(ItemKind::Mod(ref module)) => {
if !module.item_ids.is_empty() {
self.tcx
.sess