@@ -50,7 +50,7 @@ use hir_def::{
5050 resolver:: { HasResolver , Resolver } ,
5151 src:: HasSource as _,
5252 AdtId , AssocItemId , AssocItemLoc , AttrDefId , ConstId , ConstParamId , DefWithBodyId , EnumId ,
53- FunctionId , GenericDefId , HasModule , ImplId , ItemContainerId , LifetimeParamId ,
53+ EnumVariantId , FunctionId , GenericDefId , HasModule , ImplId , ItemContainerId , LifetimeParamId ,
5454 LocalEnumVariantId , LocalFieldId , Lookup , MacroExpander , MacroId , ModuleId , StaticId , StructId ,
5555 TraitId , TypeAliasId , TypeOrConstParamId , TypeParamId , UnionId ,
5656} ;
@@ -348,7 +348,10 @@ impl ModuleDef {
348348 ModuleDef :: Module ( it) => it. id . into ( ) ,
349349 ModuleDef :: Const ( it) => it. id . into ( ) ,
350350 ModuleDef :: Static ( it) => it. id . into ( ) ,
351- _ => return Vec :: new ( ) ,
351+ ModuleDef :: Variant ( it) => {
352+ EnumVariantId { parent : it. parent . into ( ) , local_id : it. id } . into ( )
353+ }
354+ ModuleDef :: BuiltinType ( _) | ModuleDef :: Macro ( _) => return Vec :: new ( ) ,
352355 } ;
353356
354357 let module = match self . module ( db) {
@@ -537,6 +540,12 @@ impl Module {
537540 }
538541 acc. extend ( decl. diagnostics ( db) )
539542 }
543+ ModuleDef :: Adt ( Adt :: Enum ( e) ) => {
544+ for v in e. variants ( db) {
545+ acc. extend ( ModuleDef :: Variant ( v) . diagnostics ( db) ) ;
546+ }
547+ acc. extend ( decl. diagnostics ( db) )
548+ }
540549 _ => acc. extend ( decl. diagnostics ( db) ) ,
541550 }
542551 }
0 commit comments