@@ -1229,6 +1229,7 @@ impl DefCollector<'_> {
1229
1229
No ,
1230
1230
}
1231
1231
1232
+ let mut eager_callback_buffer = vec ! [ ] ;
1232
1233
let mut res = ReachedFixedPoint :: Yes ;
1233
1234
// Retain unresolved macros after this round of resolution.
1234
1235
let mut retain = |directive : & MacroDirective | {
@@ -1261,11 +1262,8 @@ impl DefCollector<'_> {
1261
1262
* expand_to,
1262
1263
self . def_map . krate ,
1263
1264
resolver_def_id,
1264
- & mut |_ptr, _call_id| {
1265
- // FIXME:
1266
- // self.def_map.modules[directive.module_id]
1267
- // .scope
1268
- // .add_macro_invoc(ptr.map(|(_, it)| it), call_id);
1265
+ & mut |ptr, call_id| {
1266
+ eager_callback_buffer. push ( ( directive. module_id , ptr, call_id) ) ;
1269
1267
} ,
1270
1268
) ;
1271
1269
if let Ok ( Some ( call_id) ) = call_id {
@@ -1492,6 +1490,10 @@ impl DefCollector<'_> {
1492
1490
macros. extend ( mem:: take ( & mut self . unresolved_macros ) ) ;
1493
1491
self . unresolved_macros = macros;
1494
1492
1493
+ for ( module_id, ptr, call_id) in eager_callback_buffer {
1494
+ self . def_map . modules [ module_id] . scope . add_macro_invoc ( ptr. map ( |( _, it) | it) , call_id) ;
1495
+ }
1496
+
1495
1497
for ( module_id, depth, container, macro_call_id) in resolved {
1496
1498
self . collect_macro_expansion ( module_id, macro_call_id, depth, container) ;
1497
1499
}
@@ -2419,6 +2421,7 @@ impl ModCollector<'_, '_> {
2419
2421
// new legacy macros that create textual scopes. We need a way to resolve names in textual
2420
2422
// scopes without eager expansion.
2421
2423
2424
+ let mut eager_callback_buffer = vec ! [ ] ;
2422
2425
// Case 1: try to resolve macro calls with single-segment name and expand macro_rules
2423
2426
if let Ok ( res) = macro_call_as_call_id_with_eager (
2424
2427
db. upcast ( ) ,
@@ -2460,13 +2463,13 @@ impl ModCollector<'_, '_> {
2460
2463
) ;
2461
2464
resolved_res. resolved_def . take_macros ( ) . map ( |it| db. macro_def ( it) )
2462
2465
} ,
2463
- & mut |_ptr, _call_id| {
2464
- // FIXME:
2465
- // self.def_collector.def_map.modules[self.module_id]
2466
- // .scope
2467
- // .add_macro_invoc(ptr.map(|(_, it)| it), call_id);
2468
- } ,
2466
+ & mut |ptr, call_id| eager_callback_buffer. push ( ( ptr, call_id) ) ,
2469
2467
) {
2468
+ for ( ptr, call_id) in eager_callback_buffer {
2469
+ self . def_collector . def_map . modules [ self . module_id ]
2470
+ . scope
2471
+ . add_macro_invoc ( ptr. map ( |( _, it) | it) , call_id) ;
2472
+ }
2470
2473
// FIXME: if there were errors, this might've been in the eager expansion from an
2471
2474
// unresolved macro, so we need to push this into late macro resolution. see fixme above
2472
2475
if res. err . is_none ( ) {
@@ -2629,7 +2632,7 @@ foo!(KABOOM);
2629
2632
// the release mode. That's why the argument is not an ra_fixture --
2630
2633
// otherwise injection highlighting gets stuck.
2631
2634
//
2632
- // We need to find a way to fail this faster.
2635
+ // We need to find a way to fail this faster!
2633
2636
do_resolve (
2634
2637
r#"
2635
2638
macro_rules! foo {
0 commit comments