@@ -23,8 +23,8 @@ use syntax::attr::{self, HasAttrs};
23
23
use syntax:: errors:: DiagnosticBuilder ;
24
24
use syntax:: ext:: base:: { self , Annotatable , Determinacy , MultiModifier , MultiDecorator } ;
25
25
use syntax:: ext:: base:: { MacroKind , SyntaxExtension , Resolver as SyntaxResolver } ;
26
- use syntax:: ext:: expand:: { Expansion , ExpansionKind , Invocation , InvocationKind , find_attr_invoc } ;
27
- use syntax:: ext:: hygiene:: { self , Mark , MarkKind } ;
26
+ use syntax:: ext:: expand:: { self , AstFragment , AstFragmentKind , Invocation , InvocationKind } ;
27
+ use syntax:: ext:: hygiene:: { self , Mark , Transparency } ;
28
28
use syntax:: ext:: placeholders:: placeholder;
29
29
use syntax:: ext:: tt:: macro_rules;
30
30
use syntax:: feature_gate:: { self , emit_feature_err, GateIssue } ;
@@ -187,9 +187,10 @@ impl<'a> base::Resolver for Resolver<'a> {
187
187
self . whitelisted_legacy_custom_derives . contains ( & name)
188
188
}
189
189
190
- fn visit_expansion ( & mut self , mark : Mark , expansion : & Expansion , derives : & [ Mark ] ) {
190
+ fn visit_ast_fragment_with_placeholders ( & mut self , mark : Mark , fragment : & AstFragment ,
191
+ derives : & [ Mark ] ) {
191
192
let invocation = self . invocations [ & mark] ;
192
- self . collect_def_ids ( mark, invocation, expansion ) ;
193
+ self . collect_def_ids ( mark, invocation, fragment ) ;
193
194
194
195
self . current_module = invocation. module . get ( ) ;
195
196
self . current_module . unresolved_invocations . borrow_mut ( ) . remove ( & mark) ;
@@ -202,7 +203,7 @@ impl<'a> base::Resolver for Resolver<'a> {
202
203
legacy_scope : LegacyScope :: Invocation ( invocation) ,
203
204
expansion : mark,
204
205
} ;
205
- expansion . visit_with ( & mut visitor) ;
206
+ fragment . visit_with ( & mut visitor) ;
206
207
invocation. expansion . set ( visitor. legacy_scope ) ;
207
208
}
208
209
@@ -326,14 +327,15 @@ impl<'a> base::Resolver for Resolver<'a> {
326
327
self . macro_defs . insert ( invoc. expansion_data . mark , def_id) ;
327
328
let normal_module_def_id =
328
329
self . macro_def_scope ( invoc. expansion_data . mark ) . normal_ancestor_id ;
329
- self . definitions . add_macro_def_scope ( invoc. expansion_data . mark , normal_module_def_id) ;
330
+ self . definitions . add_parent_module_of_macro_def ( invoc. expansion_data . mark ,
331
+ normal_module_def_id) ;
330
332
331
333
self . unused_macros . remove ( & def_id) ;
332
334
let ext = self . get_macro ( def) ;
333
335
if ext. is_modern ( ) {
334
- invoc. expansion_data . mark . set_kind ( MarkKind :: Modern ) ;
336
+ invoc. expansion_data . mark . set_transparency ( Transparency :: Opaque ) ;
335
337
} else if def_id. krate == BUILTIN_MACROS_CRATE {
336
- invoc. expansion_data . mark . set_kind ( MarkKind :: Builtin ) ;
338
+ invoc. expansion_data . mark . set_is_builtin ( true ) ;
337
339
}
338
340
Ok ( Some ( ext) )
339
341
}
@@ -396,14 +398,14 @@ impl<'a> Resolver<'a> {
396
398
Ok ( ext) => if let SyntaxExtension :: ProcMacroDerive ( _, ref inert_attrs, _) = * ext {
397
399
if inert_attrs. contains ( & attr_name) {
398
400
// FIXME(jseyfried) Avoid `mem::replace` here.
399
- let dummy_item = placeholder ( ExpansionKind :: Items , ast:: DUMMY_NODE_ID )
401
+ let dummy_item = placeholder ( AstFragmentKind :: Items , ast:: DUMMY_NODE_ID )
400
402
. make_items ( ) . pop ( ) . unwrap ( ) ;
401
403
let dummy_item = Annotatable :: Item ( dummy_item) ;
402
404
* item = mem:: replace ( item, dummy_item) . map_attrs ( |mut attrs| {
403
405
let inert_attr = attr. take ( ) . unwrap ( ) ;
404
406
attr:: mark_known ( & inert_attr) ;
405
407
if self . proc_macro_enabled {
406
- * attr = find_attr_invoc ( & mut attrs) ;
408
+ * attr = expand :: find_attr_invoc ( & mut attrs) ;
407
409
}
408
410
attrs. push ( inert_attr) ;
409
411
attrs
@@ -769,7 +771,7 @@ impl<'a> Resolver<'a> {
769
771
fn collect_def_ids ( & mut self ,
770
772
mark : Mark ,
771
773
invocation : & ' a InvocationData < ' a > ,
772
- expansion : & Expansion ) {
774
+ fragment : & AstFragment ) {
773
775
let Resolver { ref mut invocations, arenas, graph_root, .. } = * self ;
774
776
let InvocationData { def_index, .. } = * invocation;
775
777
@@ -787,7 +789,7 @@ impl<'a> Resolver<'a> {
787
789
let mut def_collector = DefCollector :: new ( & mut self . definitions , mark) ;
788
790
def_collector. visit_macro_invoc = Some ( visit_macro_invoc) ;
789
791
def_collector. with_parent ( def_index, |def_collector| {
790
- expansion . visit_with ( def_collector)
792
+ fragment . visit_with ( def_collector)
791
793
} ) ;
792
794
}
793
795
0 commit comments