@@ -542,32 +542,32 @@ impl<'db> SemanticsImpl<'db> {
542
542
None => return ,
543
543
} ;
544
544
let sa = self . analyze ( & parent) ;
545
- let mut queue = vec ! [ InFile :: new( sa. file_id, token) ] ;
545
+ let mut stack : SmallVec < [ _ ; 1 ] > = smallvec ! [ InFile :: new( sa. file_id, token) ] ;
546
546
let mut cache = self . expansion_info_cache . borrow_mut ( ) ;
547
547
548
548
let mut process_expansion_for_token =
549
- |queue : & mut Vec < _ > , file_id, item, token : InFile < & _ > | {
549
+ |stack : & mut SmallVec < _ > , file_id, item, token : InFile < & _ > | {
550
550
let mapped_tokens = cache
551
551
. entry ( file_id)
552
552
. or_insert_with ( || file_id. expansion_info ( self . db . upcast ( ) ) )
553
553
. as_ref ( ) ?
554
554
. map_token_down ( self . db . upcast ( ) , item, token) ?;
555
555
556
- let len = queue . len ( ) ;
556
+ let len = stack . len ( ) ;
557
557
// requeue the tokens we got from mapping our current token down
558
- queue . extend ( mapped_tokens. inspect ( |token| {
558
+ stack . extend ( mapped_tokens. inspect ( |token| {
559
559
if let Some ( parent) = token. value . parent ( ) {
560
560
self . cache ( find_root ( & parent) , token. file_id ) ;
561
561
}
562
562
} ) ) ;
563
563
// if the length changed we have found a mapping for the token
564
- ( queue . len ( ) != len) . then ( || ( ) )
564
+ ( stack . len ( ) != len) . then ( || ( ) )
565
565
} ;
566
566
567
567
// Remap the next token in the queue into a macro call its in, if it is not being remapped
568
568
// either due to not being in a macro-call or because its unused push it into the result vec,
569
569
// otherwise push the remapped tokens back into the queue as they can potentially be remapped again.
570
- while let Some ( token) = queue . pop ( ) {
570
+ while let Some ( token) = stack . pop ( ) {
571
571
self . db . unwind_if_cancelled ( ) ;
572
572
let was_not_remapped = ( || {
573
573
// are we inside an attribute macro call
@@ -584,7 +584,7 @@ impl<'db> SemanticsImpl<'db> {
584
584
if let Some ( ( call_id, item) ) = containing_attribute_macro_call {
585
585
let file_id = call_id. as_file ( ) ;
586
586
return process_expansion_for_token (
587
- & mut queue ,
587
+ & mut stack ,
588
588
file_id,
589
589
Some ( item) ,
590
590
token. as_ref ( ) ,
@@ -607,7 +607,7 @@ impl<'db> SemanticsImpl<'db> {
607
607
}
608
608
609
609
let file_id = sa. expand ( self . db , token. with_value ( & macro_call) ) ?;
610
- return process_expansion_for_token ( & mut queue , file_id, None , token. as_ref ( ) ) ;
610
+ return process_expansion_for_token ( & mut stack , file_id, None , token. as_ref ( ) ) ;
611
611
}
612
612
613
613
// outside of a macro invocation so this is a "final" token
0 commit comments