@@ -506,21 +506,19 @@ impl<'a, 'cl> Resolver<'a, 'cl> {
506506
507507 def
508508 } else {
509- let def = match self . early_resolve_ident_in_lexical_scope ( path[ 0 ] , MacroNS , Some ( kind) ,
510- parent_scope, false , force,
511- span) {
512- Ok ( binding) => Ok ( binding. def_ignoring_ambiguity ( ) ) ,
509+ let binding = self . early_resolve_ident_in_lexical_scope (
510+ path[ 0 ] , MacroNS , Some ( kind) , parent_scope, false , force, span
511+ ) ;
512+ match binding {
513+ Ok ( ..) => { }
514+ Err ( Determinacy :: Determined ) => self . found_unresolved_macro = true ,
513515 Err ( Determinacy :: Undetermined ) => return Err ( Determinacy :: Undetermined ) ,
514- Err ( Determinacy :: Determined ) => {
515- self . found_unresolved_macro = true ;
516- Err ( Determinacy :: Determined )
517- }
518- } ;
516+ }
519517
520518 parent_scope. module . legacy_macro_resolutions . borrow_mut ( )
521- . push ( ( path[ 0 ] , kind, parent_scope. clone ( ) , def . ok ( ) ) ) ;
519+ . push ( ( path[ 0 ] , kind, parent_scope. clone ( ) , binding . ok ( ) ) ) ;
522520
523- def
521+ binding . map ( |binding| binding . def_ignoring_ambiguity ( ) )
524522 }
525523 }
526524
@@ -866,15 +864,16 @@ impl<'a, 'cl> Resolver<'a, 'cl> {
866864
867865 let legacy_macro_resolutions =
868866 mem:: replace ( & mut * module. legacy_macro_resolutions . borrow_mut ( ) , Vec :: new ( ) ) ;
869- for ( ident, kind, parent_scope, initial_def ) in legacy_macro_resolutions {
867+ for ( ident, kind, parent_scope, initial_binding ) in legacy_macro_resolutions {
870868 let binding = self . early_resolve_ident_in_lexical_scope (
871869 ident, MacroNS , Some ( kind) , & parent_scope, true , true , ident. span
872870 ) ;
873871 match binding {
874872 Ok ( binding) => {
875- self . record_use ( ident, MacroNS , binding) ;
876873 let def = binding. def_ignoring_ambiguity ( ) ;
877- if let Some ( initial_def) = initial_def {
874+ if let Some ( initial_binding) = initial_binding {
875+ self . record_use ( ident, MacroNS , initial_binding) ;
876+ let initial_def = initial_binding. def_ignoring_ambiguity ( ) ;
878877 if self . ambiguity_errors . is_empty ( ) &&
879878 def != initial_def && def != Def :: Err {
880879 // Make sure compilation does not succeed if preferred macro resolution
@@ -894,7 +893,7 @@ impl<'a, 'cl> Resolver<'a, 'cl> {
894893 }
895894 }
896895 Err ( ..) => {
897- assert ! ( initial_def . is_none( ) ) ;
896+ assert ! ( initial_binding . is_none( ) ) ;
898897 let bang = if kind == MacroKind :: Bang { "!" } else { "" } ;
899898 let msg =
900899 format ! ( "cannot find {} `{}{}` in this scope" , kind. descr( ) , ident, bang) ;
0 commit comments