@@ -506,21 +506,19 @@ impl<'a, 'cl> Resolver<'a, 'cl> {
506
506
507
507
def
508
508
} 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 ,
513
515
Err ( Determinacy :: Undetermined ) => return Err ( Determinacy :: Undetermined ) ,
514
- Err ( Determinacy :: Determined ) => {
515
- self . found_unresolved_macro = true ;
516
- Err ( Determinacy :: Determined )
517
- }
518
- } ;
516
+ }
519
517
520
518
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 ( ) ) ) ;
522
520
523
- def
521
+ binding . map ( |binding| binding . def_ignoring_ambiguity ( ) )
524
522
}
525
523
}
526
524
@@ -866,15 +864,16 @@ impl<'a, 'cl> Resolver<'a, 'cl> {
866
864
867
865
let legacy_macro_resolutions =
868
866
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 {
870
868
let binding = self . early_resolve_ident_in_lexical_scope (
871
869
ident, MacroNS , Some ( kind) , & parent_scope, true , true , ident. span
872
870
) ;
873
871
match binding {
874
872
Ok ( binding) => {
875
- self . record_use ( ident, MacroNS , binding) ;
876
873
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 ( ) ;
878
877
if self . ambiguity_errors . is_empty ( ) &&
879
878
def != initial_def && def != Def :: Err {
880
879
// Make sure compilation does not succeed if preferred macro resolution
@@ -894,7 +893,7 @@ impl<'a, 'cl> Resolver<'a, 'cl> {
894
893
}
895
894
}
896
895
Err ( ..) => {
897
- assert ! ( initial_def . is_none( ) ) ;
896
+ assert ! ( initial_binding . is_none( ) ) ;
898
897
let bang = if kind == MacroKind :: Bang { "!" } else { "" } ;
899
898
let msg =
900
899
format ! ( "cannot find {} `{}{}` in this scope" , kind. descr( ) , ident, bang) ;
0 commit comments