@@ -327,7 +327,7 @@ impl<'a, 'crateloader: 'a> base::Resolver for Resolver<'a, 'crateloader> {
327
327
} ;
328
328
329
329
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) ?;
331
331
332
332
if let Def :: Macro ( def_id, _) = def {
333
333
if after_derive {
@@ -350,7 +350,7 @@ impl<'a, 'crateloader: 'a> base::Resolver for Resolver<'a, 'crateloader> {
350
350
derives_in_scope : Vec < ast:: Path > , force : bool )
351
351
-> Result < Lrc < SyntaxExtension > , Determinacy > {
352
352
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 )
354
354
}
355
355
356
356
fn check_unused_macros ( & self ) {
@@ -391,9 +391,10 @@ impl<'a, 'cl> Resolver<'a, 'cl> {
391
391
path : & ast:: Path ,
392
392
kind : MacroKind ,
393
393
parent_scope : & ParentScope < ' a > ,
394
+ trace : bool ,
394
395
force : bool ,
395
396
) -> 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) ;
397
398
398
399
// Report errors and enforce feature gates for the resolved macro.
399
400
if def != Err ( Determinacy :: Undetermined ) {
@@ -465,6 +466,7 @@ impl<'a, 'cl> Resolver<'a, 'cl> {
465
466
path : & ast:: Path ,
466
467
kind : MacroKind ,
467
468
parent_scope : & ParentScope < ' a > ,
469
+ trace : bool ,
468
470
force : bool ,
469
471
) -> Result < Def , Determinacy > {
470
472
let path_span = path. span ;
@@ -492,8 +494,10 @@ impl<'a, 'cl> Resolver<'a, 'cl> {
492
494
PathResult :: Module ( ..) => unreachable ! ( ) ,
493
495
} ;
494
496
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
+ }
497
501
498
502
def
499
503
} else {
@@ -506,8 +510,10 @@ impl<'a, 'cl> Resolver<'a, 'cl> {
506
510
Err ( Determinacy :: Undetermined ) => return Err ( Determinacy :: Undetermined ) ,
507
511
}
508
512
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
+ }
511
517
512
518
binding. map ( |binding| binding. def_ignoring_ambiguity ( ) )
513
519
}
@@ -634,7 +640,7 @@ impl<'a, 'cl> Resolver<'a, 'cl> {
634
640
for derive in & parent_scope. derives {
635
641
let parent_scope = ParentScope { derives : Vec :: new ( ) , ..* parent_scope } ;
636
642
match self . resolve_macro_to_def ( derive, MacroKind :: Derive ,
637
- & parent_scope, force) {
643
+ & parent_scope, true , force) {
638
644
Ok ( ( _, ext) ) => {
639
645
if let SyntaxExtension :: ProcMacroDerive ( _, helpers, _) = & * ext {
640
646
if helpers. contains ( & ident. name ) {
0 commit comments