File tree Expand file tree Collapse file tree 3 files changed +23
-2
lines changed
compiler/rustc_passes/src Expand file tree Collapse file tree 3 files changed +23
-2
lines changed Original file line number Diff line number Diff line change @@ -525,8 +525,11 @@ impl CheckAttrVisitor<'tcx> {
525525 self . doc_attr_str_error ( meta, "keyword" ) ;
526526 return false ;
527527 }
528- match self . tcx . hir ( ) . expect_item ( hir_id) . kind {
529- ItemKind :: Mod ( ref module) => {
528+ match self . tcx . hir ( ) . find ( hir_id) . and_then ( |node| match node {
529+ hir:: Node :: Item ( item) => Some ( & item. kind ) ,
530+ _ => None ,
531+ } ) {
532+ Some ( ItemKind :: Mod ( ref module) ) => {
530533 if !module. item_ids . is_empty ( ) {
531534 self . tcx
532535 . sess
Original file line number Diff line number Diff line change 1+ // Regression test for the ICE described in #83512.
2+
3+ #![ feature( doc_keyword) ]
4+ #![ crate_type="lib" ]
5+
6+ trait Foo {
7+ #[ doc( keyword = "match" ) ]
8+ //~^ ERROR: `#[doc(keyword = "...")]` can only be used on modules
9+ fn quux ( ) { }
10+ }
Original file line number Diff line number Diff line change 1+ error: `#[doc(keyword = "...")]` can only be used on modules
2+ --> $DIR/issue-83512.rs:7:11
3+ |
4+ LL | #[doc(keyword = "match")]
5+ | ^^^^^^^^^^^^^^^^^
6+
7+ error: aborting due to previous error
8+
You can’t perform that action at this time.
0 commit comments