@@ -552,16 +552,35 @@ impl<'a> Resolver<'a> {
552552 used = true ; // Avoid the normal unused extern crate warning
553553 }
554554
555+ let ( graph_root, arenas) = ( self . graph_root , self . arenas ) ;
556+ let macro_use_directive = |span| arenas. alloc_import_directive ( ImportDirective {
557+ id : item. id ,
558+ parent : graph_root,
559+ imported_module : Cell :: new ( Some ( module) ) ,
560+ subclass : ImportDirectiveSubclass :: MacroUse ,
561+ span : span,
562+ module_path : Vec :: new ( ) ,
563+ vis : Cell :: new ( ty:: Visibility :: Restricted ( DefId :: local ( CRATE_DEF_INDEX ) ) ) ,
564+ expansion : expansion,
565+ used : Cell :: new ( false ) ,
566+ } ) ;
567+
555568 if let Some ( span) = legacy_imports. import_all {
569+ let directive = macro_use_directive ( span) ;
570+ self . potentially_unused_imports . push ( directive) ;
556571 module. for_each_child ( |ident, ns, binding| if ns == MacroNS {
557- self . legacy_import_macro ( ident. name , binding, span, allow_shadowing) ;
572+ let imported_binding = self . import ( binding, directive) ;
573+ self . legacy_import_macro ( ident. name , imported_binding, span, allow_shadowing) ;
558574 } ) ;
559575 } else {
560576 for ( name, span) in legacy_imports. imports {
561577 let ident = Ident :: with_empty_ctxt ( name) ;
562578 let result = self . resolve_ident_in_module ( module, ident, MacroNS , false , None ) ;
563579 if let Ok ( binding) = result {
564- self . legacy_import_macro ( name, binding, span, allow_shadowing) ;
580+ let directive = macro_use_directive ( span) ;
581+ self . potentially_unused_imports . push ( directive) ;
582+ let imported_binding = self . import ( binding, directive) ;
583+ self . legacy_import_macro ( name, imported_binding, span, allow_shadowing) ;
565584 } else {
566585 span_err ! ( self . session, span, E0469 , "imported macro not found" ) ;
567586 }
0 commit comments