@@ -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
}
@@ -811,9 +810,9 @@ impl<'a> Resolver<'a> {
811
810
break ;
812
811
}
813
812
MetaItemKind :: List ( nested_metas) => for nested_meta in nested_metas {
814
- match nested_meta. word ( ) {
815
- Some ( word ) => single_imports. push ( ( word . name ( ) , word . span ) ) ,
816
- None => ill_formed ( nested_meta. span ) ,
813
+ match nested_meta. ident ( ) {
814
+ Some ( ident ) if nested_meta . is_word ( ) => single_imports. push ( ident ) ,
815
+ _ => ill_formed ( nested_meta. span ) ,
817
816
}
818
817
}
819
818
MetaItemKind :: NameValue ( ..) => ill_formed ( meta. span ) ,
@@ -849,23 +848,23 @@ impl<'a> Resolver<'a> {
849
848
self . legacy_import_macro ( ident. name , imported_binding, span, allow_shadowing) ;
850
849
} ) ;
851
850
} else {
852
- for ( name, span) in single_imports. iter ( ) . cloned ( ) {
853
- let ident = Ident :: with_empty_ctxt ( name) ;
851
+ for ident in single_imports. iter ( ) . cloned ( ) {
854
852
let result = self . resolve_ident_in_module (
855
853
ModuleOrUniformRoot :: Module ( module) ,
856
854
ident,
857
855
MacroNS ,
858
856
None ,
859
857
false ,
860
- span,
858
+ ident . span ,
861
859
) ;
862
860
if let Ok ( binding) = result {
863
- let directive = macro_use_directive ( span) ;
861
+ let directive = macro_use_directive ( ident . span ) ;
864
862
self . potentially_unused_imports . push ( directive) ;
865
863
let imported_binding = self . import ( binding, directive) ;
866
- self . legacy_import_macro ( name, imported_binding, span, allow_shadowing) ;
864
+ self . legacy_import_macro ( ident. name , imported_binding,
865
+ ident. span , allow_shadowing) ;
867
866
} else {
868
- span_err ! ( self . session, span, E0469 , "imported macro not found" ) ;
867
+ span_err ! ( self . session, ident . span, E0469 , "imported macro not found" ) ;
869
868
}
870
869
}
871
870
}
0 commit comments