@@ -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 ;
@@ -491,8 +493,10 @@ impl<'a, 'cl> Resolver<'a, 'cl> {
491493 PathResult :: Module ( ..) => unreachable ! ( ) ,
492494 } ;
493495
494- parent_scope. module . multi_segment_macro_resolutions . borrow_mut ( )
495- . push ( ( path, path_span, kind, parent_scope. clone ( ) , def. ok ( ) ) ) ;
496+ if trace {
497+ parent_scope. module . multi_segment_macro_resolutions . borrow_mut ( )
498+ . push ( ( path, path_span, kind, parent_scope. clone ( ) , def. ok ( ) ) ) ;
499+ }
496500
497501 def
498502 } else {
@@ -505,8 +509,10 @@ impl<'a, 'cl> Resolver<'a, 'cl> {
505509 Err ( Determinacy :: Undetermined ) => return Err ( Determinacy :: Undetermined ) ,
506510 }
507511
508- parent_scope. module . single_segment_macro_resolutions . borrow_mut ( )
509- . push ( ( path[ 0 ] , kind, parent_scope. clone ( ) , binding. ok ( ) ) ) ;
512+ if trace {
513+ parent_scope. module . single_segment_macro_resolutions . borrow_mut ( )
514+ . push ( ( path[ 0 ] , kind, parent_scope. clone ( ) , binding. ok ( ) ) ) ;
515+ }
510516
511517 binding. map ( |binding| binding. def_ignoring_ambiguity ( ) )
512518 }
@@ -633,7 +639,7 @@ impl<'a, 'cl> Resolver<'a, 'cl> {
633639 for derive in & parent_scope. derives {
634640 let parent_scope = ParentScope { derives : Vec :: new ( ) , ..* parent_scope } ;
635641 match self . resolve_macro_to_def ( derive, MacroKind :: Derive ,
636- & parent_scope, force) {
642+ & parent_scope, true , force) {
637643 Ok ( ( _, ext) ) => {
638644 if let SyntaxExtension :: ProcMacroDerive ( _, helpers, _) = & * ext {
639645 if helpers. contains ( & ident. name ) {
0 commit comments