@@ -17,12 +17,11 @@ use syntax::errors::DiagnosticBuilder;
17
17
use syntax:: ext:: base:: { self , Determinacy } ;
18
18
use syntax:: ext:: base:: { MacroKind , SyntaxExtension } ;
19
19
use syntax:: ext:: expand:: { AstFragment , Invocation , InvocationKind } ;
20
- use syntax:: ext:: hygiene:: Mark ;
20
+ use syntax:: ext:: hygiene:: { self , Mark } ;
21
21
use syntax:: ext:: tt:: macro_rules;
22
22
use syntax:: feature_gate:: { feature_err, emit_feature_err, is_builtin_attr_name} ;
23
23
use syntax:: feature_gate:: { AttributeGate , GateIssue , Stability , BUILTIN_ATTRIBUTES } ;
24
24
use syntax:: symbol:: { Symbol , kw, sym} ;
25
- use syntax:: visit:: Visitor ;
26
25
use syntax:: util:: lev_distance:: find_best_match_for_name;
27
26
use syntax_pos:: { Span , DUMMY_SP } ;
28
27
use errors:: Applicability ;
@@ -146,24 +145,14 @@ impl<'a> base::Resolver for Resolver<'a> {
146
145
mark
147
146
}
148
147
149
- fn resolve_dollar_crates ( & mut self , fragment : & AstFragment ) {
150
- struct ResolveDollarCrates < ' a , ' b > {
151
- resolver : & ' a mut Resolver < ' b >
152
- }
153
- impl < ' a > Visitor < ' a > for ResolveDollarCrates < ' a , ' _ > {
154
- fn visit_ident ( & mut self , ident : Ident ) {
155
- if ident. name == kw:: DollarCrate {
156
- let name = match self . resolver . resolve_crate_root ( ident) . kind {
157
- ModuleKind :: Def ( .., name) if name != kw:: Invalid => name,
158
- _ => kw:: Crate ,
159
- } ;
160
- ident. span . ctxt ( ) . set_dollar_crate_name ( name) ;
161
- }
148
+ fn resolve_dollar_crates ( & mut self ) {
149
+ hygiene:: update_dollar_crate_names ( |ctxt| {
150
+ let ident = Ident :: new ( kw:: DollarCrate , DUMMY_SP . with_ctxt ( ctxt) ) ;
151
+ match self . resolve_crate_root ( ident) . kind {
152
+ ModuleKind :: Def ( .., name) if name != kw:: Invalid => name,
153
+ _ => kw:: Crate ,
162
154
}
163
- fn visit_mac ( & mut self , _: & ast:: Mac ) { }
164
- }
165
-
166
- fragment. visit_with ( & mut ResolveDollarCrates { resolver : self } ) ;
155
+ } ) ;
167
156
}
168
157
169
158
fn visit_ast_fragment_with_placeholders ( & mut self , mark : Mark , fragment : & AstFragment ,
0 commit comments