22
33use std:: sync:: Arc ;
44
5- use hir_expand:: { name:: Name , AstId , ExpandResult , HirFileId , MacroCallId , MacroDefKind } ;
5+ use hir_expand:: { name:: Name , AstId , ExpandResult , HirFileId , MacroCallId , MacroDefKind , InFile } ;
66use smallvec:: SmallVec ;
77use syntax:: ast;
88
@@ -12,7 +12,7 @@ use crate::{
1212 db:: DefDatabase ,
1313 intern:: Interned ,
1414 item_tree:: { self , AssocItem , FnFlags , ItemTree , ItemTreeId , ModItem , Param , TreeId } ,
15- nameres:: { attr_resolution:: ResolvedAttr , proc_macro:: ProcMacroKind , DefMap } ,
15+ nameres:: { attr_resolution:: ResolvedAttr , proc_macro:: ProcMacroKind , DefMap , diagnostics :: DefDiagnostic } ,
1616 type_ref:: { TraitRef , TypeBound , TypeRef } ,
1717 visibility:: RawVisibility ,
1818 AssocItemId , AstIdWithPath , ConstId , ConstLoc , FunctionId , FunctionLoc , HasModule , ImplId ,
@@ -479,6 +479,13 @@ impl<'a> AssocItemCollector<'a> {
479479 ' items: for & item in assoc_items {
480480 let attrs = item_tree. attrs ( self . db , self . module_id . krate , ModItem :: from ( item) . into ( ) ) ;
481481 if !attrs. is_cfg_enabled ( self . expander . cfg_options ( ) ) {
482+ self . def_map . push_diagnostic ( DefDiagnostic :: unconfigured_code (
483+ self . module_id . local_id ,
484+ InFile :: new ( tree_id. file_id ( ) , item. ast_id ( & item_tree) . upcast ( ) ) ,
485+ attrs. cfg ( ) . unwrap ( ) ,
486+ self . expander . cfg_options ( ) . clone ( )
487+ ) ) ;
488+ dbg ! ( "Ignoring assoc item!" ) ;
482489 continue ;
483490 }
484491
0 commit comments