@@ -327,7 +327,7 @@ impl<'a, 'crateloader: 'a> base::Resolver for Resolver<'a, 'crateloader> {
327327 } ;
328328
329329 let parent_scope = self . invoc_parent_scope ( invoc_id, derives_in_scope) ;
330- let ( def, ext) = self . resolve_macro_to_def ( path, kind, & parent_scope, force) ?;
330+ let ( def, ext) = self . resolve_macro_to_def ( path, kind, & parent_scope, true , force) ?;
331331
332332 if let Def :: Macro ( def_id, _) = def {
333333 if after_derive {
@@ -350,7 +350,7 @@ impl<'a, 'crateloader: 'a> base::Resolver for Resolver<'a, 'crateloader> {
350350 derives_in_scope : Vec < ast:: Path > , force : bool )
351351 -> Result < Lrc < SyntaxExtension > , Determinacy > {
352352 let parent_scope = self . invoc_parent_scope ( invoc_id, derives_in_scope) ;
353- Ok ( self . resolve_macro_to_def ( path, kind, & parent_scope, force) ?. 1 )
353+ Ok ( self . resolve_macro_to_def ( path, kind, & parent_scope, false , force) ?. 1 )
354354 }
355355
356356 fn check_unused_macros ( & self ) {
@@ -391,9 +391,10 @@ impl<'a, 'cl> Resolver<'a, 'cl> {
391391 path : & ast:: Path ,
392392 kind : MacroKind ,
393393 parent_scope : & ParentScope < ' a > ,
394+ trace : bool ,
394395 force : bool ,
395396 ) -> Result < ( Def , Lrc < SyntaxExtension > ) , Determinacy > {
396- let def = self . resolve_macro_to_def_inner ( path, kind, parent_scope, force) ;
397+ let def = self . resolve_macro_to_def_inner ( path, kind, parent_scope, trace , force) ;
397398
398399 // Report errors and enforce feature gates for the resolved macro.
399400 if def != Err ( Determinacy :: Undetermined ) {
@@ -465,6 +466,7 @@ impl<'a, 'cl> Resolver<'a, 'cl> {
465466 path : & ast:: Path ,
466467 kind : MacroKind ,
467468 parent_scope : & ParentScope < ' a > ,
469+ trace : bool ,
468470 force : bool ,
469471 ) -> Result < Def , Determinacy > {
470472 let path_span = path. span ;
@@ -492,8 +494,10 @@ impl<'a, 'cl> Resolver<'a, 'cl> {
492494 PathResult :: Module ( ..) => unreachable ! ( ) ,
493495 } ;
494496
495- parent_scope. module . multi_segment_macro_resolutions . borrow_mut ( )
496- . push ( ( path, path_span, kind, parent_scope. clone ( ) , def. ok ( ) ) ) ;
497+ if trace {
498+ parent_scope. module . multi_segment_macro_resolutions . borrow_mut ( )
499+ . push ( ( path, path_span, kind, parent_scope. clone ( ) , def. ok ( ) ) ) ;
500+ }
497501
498502 def
499503 } else {
@@ -506,8 +510,10 @@ impl<'a, 'cl> Resolver<'a, 'cl> {
506510 Err ( Determinacy :: Undetermined ) => return Err ( Determinacy :: Undetermined ) ,
507511 }
508512
509- parent_scope. module . single_segment_macro_resolutions . borrow_mut ( )
510- . push ( ( path[ 0 ] . ident , kind, parent_scope. clone ( ) , binding. ok ( ) ) ) ;
513+ if trace {
514+ parent_scope. module . single_segment_macro_resolutions . borrow_mut ( )
515+ . push ( ( path[ 0 ] . ident , kind, parent_scope. clone ( ) , binding. ok ( ) ) ) ;
516+ }
511517
512518 binding. map ( |binding| binding. def_ignoring_ambiguity ( ) )
513519 }
@@ -634,7 +640,7 @@ impl<'a, 'cl> Resolver<'a, 'cl> {
634640 for derive in & parent_scope. derives {
635641 let parent_scope = ParentScope { derives : Vec :: new ( ) , ..* parent_scope } ;
636642 match self . resolve_macro_to_def ( derive, MacroKind :: Derive ,
637- & parent_scope, force) {
643+ & parent_scope, true , force) {
638644 Ok ( ( _, ext) ) => {
639645 if let SyntaxExtension :: ProcMacroDerive ( _, helpers, _) = & * ext {
640646 if helpers. contains ( & ident. name ) {
0 commit comments