@@ -31,8 +31,8 @@ use tracing::debug;
3131
3232use crate :: Namespace :: { MacroNS , TypeNS , ValueNS } ;
3333use crate :: def_collector:: DefCollector ;
34- use crate :: error_helper:: StructCtor ;
35- use crate :: imports:: { ImportData , ImportKind , OnUnknownData } ;
34+ use crate :: error_helper:: { OnUnknownData , StructCtor } ;
35+ use crate :: imports:: { ImportData , ImportKind } ;
3636use crate :: macros:: { MacroRulesDecl , MacroRulesScope , MacroRulesScopeRef } ;
3737use crate :: ref_mut:: CmCell ;
3838use crate :: {
@@ -548,7 +548,7 @@ impl<'a, 'ra, 'tcx> DefCollector<'a, 'ra, 'tcx> {
548548 root_id,
549549 vis,
550550 vis_span : item. vis . span ,
551- on_unknown_attr : OnUnknownData :: from_attrs ( self . r . tcx , item) ,
551+ on_unknown_attr : OnUnknownData :: from_attrs ( self . r . tcx , & item. attrs ) ,
552552 } ) ;
553553
554554 self . r . indeterminate_imports . push ( import) ;
@@ -863,6 +863,9 @@ impl<'a, 'ra, 'tcx> DefCollector<'a, 'ra, 'tcx> {
863863 || ast:: attr:: contains_name ( & item. attrs , sym:: no_implicit_prelude) ,
864864 ) ;
865865 self . parent_scope . module = module. to_module ( ) ;
866+ if let Some ( directive) = OnUnknownData :: from_attrs ( self . r . tcx , & item. attrs ) {
867+ self . r . on_unknown_data . insert ( local_def_id, directive) ;
868+ }
866869 }
867870
868871 // These items live in the value namespace.
@@ -1037,7 +1040,7 @@ impl<'a, 'ra, 'tcx> DefCollector<'a, 'ra, 'tcx> {
10371040 module_path : Vec :: new ( ) ,
10381041 vis,
10391042 vis_span : item. vis . span ,
1040- on_unknown_attr : OnUnknownData :: from_attrs ( self . r . tcx , item) ,
1043+ on_unknown_attr : OnUnknownData :: from_attrs ( self . r . tcx , & item. attrs ) ,
10411044 } ) ;
10421045 if used {
10431046 self . r . import_use_map . insert ( import, Used :: Other ) ;
@@ -1169,7 +1172,7 @@ impl<'a, 'ra, 'tcx> DefCollector<'a, 'ra, 'tcx> {
11691172 module_path : Vec :: new ( ) ,
11701173 vis : Visibility :: Restricted ( CRATE_DEF_ID ) ,
11711174 vis_span : item. vis . span ,
1172- on_unknown_attr : OnUnknownData :: from_attrs ( this. r . tcx , item) ,
1175+ on_unknown_attr : OnUnknownData :: from_attrs ( this. r . tcx , & item. attrs ) ,
11731176 } )
11741177 } ;
11751178
@@ -1350,7 +1353,7 @@ impl<'a, 'ra, 'tcx> DefCollector<'a, 'ra, 'tcx> {
13501353 module_path : Vec :: new ( ) ,
13511354 vis,
13521355 vis_span : item. vis . span ,
1353- on_unknown_attr : OnUnknownData :: from_attrs ( self . r . tcx , item) ,
1356+ on_unknown_attr : OnUnknownData :: from_attrs ( self . r . tcx , & item. attrs ) ,
13541357 } ) ;
13551358 self . r . import_use_map . insert ( import, Used :: Other ) ;
13561359 let import_decl = self . r . new_import_decl ( decl, import) ;
0 commit comments