@@ -466,10 +466,9 @@ impl<'a> Resolver<'a> {
466
466
if let Some ( attr) = attr:: find_by_name ( & item. attrs , "proc_macro_derive" ) {
467
467
if let Some ( trait_attr) =
468
468
attr. meta_item_list ( ) . and_then ( |list| list. get ( 0 ) . cloned ( ) ) {
469
- if let Some ( ident) = trait_attr. name ( ) . map ( Ident :: with_empty_ctxt) {
470
- let sp = trait_attr. span ;
469
+ if let Some ( ident) = trait_attr. ident ( ) {
471
470
let def = Def :: Macro ( def. def_id ( ) , MacroKind :: ProcMacroStub ) ;
472
- self . define ( parent, ident, MacroNS , ( def, vis, sp , expansion) ) ;
471
+ self . define ( parent, ident, MacroNS , ( def, vis, ident . span , expansion) ) ;
473
472
}
474
473
}
475
474
}
@@ -815,9 +814,9 @@ impl<'a> Resolver<'a> {
815
814
break ;
816
815
}
817
816
MetaItemKind :: List ( nested_metas) => for nested_meta in nested_metas {
818
- match nested_meta. word ( ) {
819
- Some ( word ) => single_imports. push ( ( word . name ( ) , word . span ) ) ,
820
- None => ill_formed ( nested_meta. span ) ,
817
+ match nested_meta. ident ( ) {
818
+ Some ( ident ) if nested_meta . is_word ( ) => single_imports. push ( ident ) ,
819
+ _ => ill_formed ( nested_meta. span ) ,
821
820
}
822
821
}
823
822
MetaItemKind :: NameValue ( ..) => ill_formed ( meta. span ) ,
@@ -853,23 +852,23 @@ impl<'a> Resolver<'a> {
853
852
self . legacy_import_macro ( ident. name , imported_binding, span, allow_shadowing) ;
854
853
} ) ;
855
854
} else {
856
- for ( name, span) in single_imports. iter ( ) . cloned ( ) {
857
- let ident = Ident :: with_empty_ctxt ( name) ;
855
+ for ident in single_imports. iter ( ) . cloned ( ) {
858
856
let result = self . resolve_ident_in_module (
859
857
ModuleOrUniformRoot :: Module ( module) ,
860
858
ident,
861
859
MacroNS ,
862
860
None ,
863
861
false ,
864
- span,
862
+ ident . span ,
865
863
) ;
866
864
if let Ok ( binding) = result {
867
- let directive = macro_use_directive ( span) ;
865
+ let directive = macro_use_directive ( ident . span ) ;
868
866
self . potentially_unused_imports . push ( directive) ;
869
867
let imported_binding = self . import ( binding, directive) ;
870
- self . legacy_import_macro ( name, imported_binding, span, allow_shadowing) ;
868
+ self . legacy_import_macro ( ident. name , imported_binding,
869
+ ident. span , allow_shadowing) ;
871
870
} else {
872
- span_err ! ( self . session, span, E0469 , "imported macro not found" ) ;
871
+ span_err ! ( self . session, ident . span, E0469 , "imported macro not found" ) ;
873
872
}
874
873
}
875
874
}
0 commit comments