@@ -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 ;
@@ -491,8 +493,10 @@ impl<'a, 'cl> Resolver<'a, 'cl> {
491
493
PathResult :: Module ( ..) => unreachable ! ( ) ,
492
494
} ;
493
495
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
+ }
496
500
497
501
def
498
502
} else {
@@ -505,8 +509,10 @@ impl<'a, 'cl> Resolver<'a, 'cl> {
505
509
Err ( Determinacy :: Undetermined ) => return Err ( Determinacy :: Undetermined ) ,
506
510
}
507
511
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
+ }
510
516
511
517
binding. map ( |binding| binding. def_ignoring_ambiguity ( ) )
512
518
}
@@ -633,7 +639,7 @@ impl<'a, 'cl> Resolver<'a, 'cl> {
633
639
for derive in & parent_scope. derives {
634
640
let parent_scope = ParentScope { derives : Vec :: new ( ) , ..* parent_scope } ;
635
641
match self . resolve_macro_to_def ( derive, MacroKind :: Derive ,
636
- & parent_scope, force) {
642
+ & parent_scope, true , force) {
637
643
Ok ( ( _, ext) ) => {
638
644
if let SyntaxExtension :: ProcMacroDerive ( _, helpers, _) = & * ext {
639
645
if helpers. contains ( & ident. name ) {
0 commit comments