2
2
3
3
use std:: sync:: Arc ;
4
4
5
- use hir_expand:: { name:: Name , AstId , ExpandResult , HirFileId , MacroCallId , MacroDefKind } ;
5
+ use hir_expand:: { name:: Name , AstId , ExpandResult , HirFileId , MacroCallId , MacroDefKind , InFile } ;
6
6
use smallvec:: SmallVec ;
7
7
use syntax:: ast;
8
8
@@ -12,7 +12,7 @@ use crate::{
12
12
db:: DefDatabase ,
13
13
intern:: Interned ,
14
14
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 } ,
16
16
type_ref:: { TraitRef , TypeBound , TypeRef } ,
17
17
visibility:: RawVisibility ,
18
18
AssocItemId , AstIdWithPath , ConstId , ConstLoc , FunctionId , FunctionLoc , HasModule , ImplId ,
@@ -479,6 +479,13 @@ impl<'a> AssocItemCollector<'a> {
479
479
' items: for & item in assoc_items {
480
480
let attrs = item_tree. attrs ( self . db , self . module_id . krate , ModItem :: from ( item) . into ( ) ) ;
481
481
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!" ) ;
482
489
continue ;
483
490
}
484
491
0 commit comments