@@ -141,14 +141,13 @@ impl<'a> visit::Visitor<'a> for DefCollector<'a> {
141
141
// information we encapsulate into, the better
142
142
let def_data = match i. node {
143
143
ItemKind :: Impl ( ..) => DefPathData :: Impl ,
144
- ItemKind :: Trait ( ..) => DefPathData :: Trait ( i. ident . as_interned_str ( ) ) ,
145
- ItemKind :: TraitAlias ( ..) => DefPathData :: TraitAlias ( i. ident . as_interned_str ( ) ) ,
146
- ItemKind :: Enum ( ..) | ItemKind :: Struct ( ..) | ItemKind :: Union ( ..) |
147
- ItemKind :: Existential ( ..) | ItemKind :: ExternCrate ( ..) | ItemKind :: ForeignMod ( ..) |
148
- ItemKind :: Ty ( ..) => DefPathData :: TypeNs ( i. ident . as_interned_str ( ) ) ,
149
144
ItemKind :: Mod ( ..) if i. ident == keywords:: Invalid . ident ( ) => {
150
145
return visit:: walk_item ( self , i) ;
151
146
}
147
+ ItemKind :: Mod ( ..) | ItemKind :: Trait ( ..) | ItemKind :: TraitAlias ( ..) |
148
+ ItemKind :: Enum ( ..) | ItemKind :: Struct ( ..) | ItemKind :: Union ( ..) |
149
+ ItemKind :: Existential ( ..) | ItemKind :: ExternCrate ( ..) | ItemKind :: ForeignMod ( ..) |
150
+ ItemKind :: Ty ( ..) => DefPathData :: TypeNs ( i. ident . as_interned_str ( ) ) ,
152
151
ItemKind :: Fn (
153
152
ref decl,
154
153
ref header,
@@ -165,10 +164,9 @@ impl<'a> visit::Visitor<'a> for DefCollector<'a> {
165
164
body,
166
165
)
167
166
}
168
- ItemKind :: Mod ( ..) => DefPathData :: Module ( i. ident . as_interned_str ( ) ) ,
169
167
ItemKind :: Static ( ..) | ItemKind :: Const ( ..) | ItemKind :: Fn ( ..) =>
170
168
DefPathData :: ValueNs ( i. ident . as_interned_str ( ) ) ,
171
- ItemKind :: MacroDef ( ..) => DefPathData :: MacroDef ( i. ident . as_interned_str ( ) ) ,
169
+ ItemKind :: MacroDef ( ..) => DefPathData :: MacroNs ( i. ident . as_interned_str ( ) ) ,
172
170
ItemKind :: Mac ( ..) => return self . visit_macro_invoc ( i. id ) ,
173
171
ItemKind :: GlobalAsm ( ..) => DefPathData :: Misc ,
174
172
ItemKind :: Use ( ..) => {
@@ -213,7 +211,7 @@ impl<'a> visit::Visitor<'a> for DefCollector<'a> {
213
211
214
212
fn visit_variant ( & mut self , v : & ' a Variant , g : & ' a Generics , item_id : NodeId ) {
215
213
let def = self . create_def ( v. node . id ,
216
- DefPathData :: EnumVariant ( v. node . ident . as_interned_str ( ) ) ,
214
+ DefPathData :: TypeNs ( v. node . ident . as_interned_str ( ) ) ,
217
215
REGULAR_SPACE ,
218
216
v. span ) ;
219
217
self . with_parent ( def, |this| {
@@ -230,7 +228,7 @@ impl<'a> visit::Visitor<'a> for DefCollector<'a> {
230
228
let name = field. ident . map ( |ident| ident. name )
231
229
. unwrap_or_else ( || Symbol :: intern ( & index. to_string ( ) ) ) ;
232
230
let def = self . create_def ( field. id ,
233
- DefPathData :: Field ( name. as_interned_str ( ) ) ,
231
+ DefPathData :: ValueNs ( name. as_interned_str ( ) ) ,
234
232
REGULAR_SPACE ,
235
233
field. span ) ;
236
234
self . with_parent ( def, |this| this. visit_struct_field ( field) ) ;
@@ -240,9 +238,9 @@ impl<'a> visit::Visitor<'a> for DefCollector<'a> {
240
238
fn visit_generic_param ( & mut self , param : & ' a GenericParam ) {
241
239
let name = param. ident . as_interned_str ( ) ;
242
240
let def_path_data = match param. kind {
243
- GenericParamKind :: Lifetime { .. } => DefPathData :: LifetimeParam ( name) ,
244
- GenericParamKind :: Type { .. } => DefPathData :: TypeParam ( name) ,
245
- GenericParamKind :: Const { .. } => DefPathData :: ConstParam ( name) ,
241
+ GenericParamKind :: Lifetime { .. } => DefPathData :: LifetimeNs ( name) ,
242
+ GenericParamKind :: Type { .. } => DefPathData :: TypeNs ( name) ,
243
+ GenericParamKind :: Const { .. } => DefPathData :: ValueNs ( name) ,
246
244
} ;
247
245
self . create_def ( param. id , def_path_data, REGULAR_SPACE , param. ident . span ) ;
248
246
@@ -254,7 +252,7 @@ impl<'a> visit::Visitor<'a> for DefCollector<'a> {
254
252
TraitItemKind :: Method ( ..) | TraitItemKind :: Const ( ..) =>
255
253
DefPathData :: ValueNs ( ti. ident . as_interned_str ( ) ) ,
256
254
TraitItemKind :: Type ( ..) => {
257
- DefPathData :: AssocTypeInTrait ( ti. ident . as_interned_str ( ) )
255
+ DefPathData :: TypeNs ( ti. ident . as_interned_str ( ) )
258
256
} ,
259
257
TraitItemKind :: Macro ( ..) => return self . visit_macro_invoc ( ti. id ) ,
260
258
} ;
@@ -281,9 +279,9 @@ impl<'a> visit::Visitor<'a> for DefCollector<'a> {
281
279
}
282
280
ImplItemKind :: Method ( ..) | ImplItemKind :: Const ( ..) =>
283
281
DefPathData :: ValueNs ( ii. ident . as_interned_str ( ) ) ,
284
- ImplItemKind :: Type ( ..) => DefPathData :: AssocTypeInImpl ( ii . ident . as_interned_str ( ) ) ,
282
+ ImplItemKind :: Type ( ..) |
285
283
ImplItemKind :: Existential ( ..) => {
286
- DefPathData :: AssocExistentialInImpl ( ii. ident . as_interned_str ( ) )
284
+ DefPathData :: TypeNs ( ii. ident . as_interned_str ( ) )
287
285
} ,
288
286
ImplItemKind :: Macro ( ..) => return self . visit_macro_invoc ( ii. id ) ,
289
287
} ;
0 commit comments