@@ -107,18 +107,18 @@ impl<'a> visit::Visitor<'a> for DefCollector<'a> {
107
107
// information we encapsulate into
108
108
let def_data = match i. node {
109
109
ItemKind :: Impl ( ..) => DefPathData :: Impl ,
110
- ItemKind :: Trait ( ..) => DefPathData :: Trait ( i. ident . name . as_str ( ) ) ,
110
+ ItemKind :: Trait ( ..) => DefPathData :: Trait ( i. ident . name . as_interned_str ( ) ) ,
111
111
ItemKind :: Enum ( ..) | ItemKind :: Struct ( ..) | ItemKind :: Union ( ..) |
112
112
ItemKind :: TraitAlias ( ..) |
113
113
ItemKind :: ExternCrate ( ..) | ItemKind :: ForeignMod ( ..) | ItemKind :: Ty ( ..) =>
114
- DefPathData :: TypeNs ( i. ident . name . as_str ( ) ) ,
114
+ DefPathData :: TypeNs ( i. ident . name . as_interned_str ( ) ) ,
115
115
ItemKind :: Mod ( ..) if i. ident == keywords:: Invalid . ident ( ) => {
116
116
return visit:: walk_item ( self , i) ;
117
117
}
118
- ItemKind :: Mod ( ..) => DefPathData :: Module ( i. ident . name . as_str ( ) ) ,
118
+ ItemKind :: Mod ( ..) => DefPathData :: Module ( i. ident . name . as_interned_str ( ) ) ,
119
119
ItemKind :: Static ( ..) | ItemKind :: Const ( ..) | ItemKind :: Fn ( ..) =>
120
- DefPathData :: ValueNs ( i. ident . name . as_str ( ) ) ,
121
- ItemKind :: MacroDef ( ..) => DefPathData :: MacroDef ( i. ident . name . as_str ( ) ) ,
120
+ DefPathData :: ValueNs ( i. ident . name . as_interned_str ( ) ) ,
121
+ ItemKind :: MacroDef ( ..) => DefPathData :: MacroDef ( i. ident . name . as_interned_str ( ) ) ,
122
122
ItemKind :: Mac ( ..) => return self . visit_macro_invoc ( i. id , false ) ,
123
123
ItemKind :: GlobalAsm ( ..) => DefPathData :: Misc ,
124
124
ItemKind :: Use ( ..) => {
@@ -133,15 +133,16 @@ impl<'a> visit::Visitor<'a> for DefCollector<'a> {
133
133
for v in & enum_definition. variants {
134
134
let variant_def_index =
135
135
this. create_def ( v. node . data . id ( ) ,
136
- DefPathData :: EnumVariant ( v. node . ident . name . as_str ( ) ) ,
136
+ DefPathData :: EnumVariant ( v. node . ident
137
+ . name . as_interned_str ( ) ) ,
137
138
REGULAR_SPACE ,
138
139
v. span ) ;
139
140
this. with_parent ( variant_def_index, |this| {
140
141
for ( index, field) in v. node . data . fields ( ) . iter ( ) . enumerate ( ) {
141
142
let name = field. ident . map ( |ident| ident. name )
142
143
. unwrap_or_else ( || Symbol :: intern ( & index. to_string ( ) ) ) ;
143
144
this. create_def ( field. id ,
144
- DefPathData :: Field ( name. as_str ( ) ) ,
145
+ DefPathData :: Field ( name. as_interned_str ( ) ) ,
145
146
REGULAR_SPACE ,
146
147
field. span ) ;
147
148
}
@@ -165,7 +166,7 @@ impl<'a> visit::Visitor<'a> for DefCollector<'a> {
165
166
let name = field. ident . map ( |ident| ident. name )
166
167
. unwrap_or_else ( || Symbol :: intern ( & index. to_string ( ) ) ) ;
167
168
this. create_def ( field. id ,
168
- DefPathData :: Field ( name. as_str ( ) ) ,
169
+ DefPathData :: Field ( name. as_interned_str ( ) ) ,
169
170
REGULAR_SPACE ,
170
171
field. span ) ;
171
172
}
@@ -187,7 +188,7 @@ impl<'a> visit::Visitor<'a> for DefCollector<'a> {
187
188
}
188
189
189
190
let def = self . create_def ( foreign_item. id ,
190
- DefPathData :: ValueNs ( foreign_item. ident . name . as_str ( ) ) ,
191
+ DefPathData :: ValueNs ( foreign_item. ident . name . as_interned_str ( ) ) ,
191
192
REGULAR_SPACE ,
192
193
foreign_item. span ) ;
193
194
@@ -201,15 +202,15 @@ impl<'a> visit::Visitor<'a> for DefCollector<'a> {
201
202
GenericParam :: Lifetime ( ref lifetime_def) => {
202
203
self . create_def (
203
204
lifetime_def. lifetime . id ,
204
- DefPathData :: LifetimeDef ( lifetime_def. lifetime . ident . name . as_str ( ) ) ,
205
+ DefPathData :: LifetimeDef ( lifetime_def. lifetime . ident . name . as_interned_str ( ) ) ,
205
206
REGULAR_SPACE ,
206
207
lifetime_def. lifetime . ident . span
207
208
) ;
208
209
}
209
210
GenericParam :: Type ( ref ty_param) => {
210
211
self . create_def (
211
212
ty_param. id ,
212
- DefPathData :: TypeParam ( ty_param. ident . name . as_str ( ) ) ,
213
+ DefPathData :: TypeParam ( ty_param. ident . name . as_interned_str ( ) ) ,
213
214
REGULAR_SPACE ,
214
215
ty_param. ident . span
215
216
) ;
@@ -222,8 +223,10 @@ impl<'a> visit::Visitor<'a> for DefCollector<'a> {
222
223
fn visit_trait_item ( & mut self , ti : & ' a TraitItem ) {
223
224
let def_data = match ti. node {
224
225
TraitItemKind :: Method ( ..) | TraitItemKind :: Const ( ..) =>
225
- DefPathData :: ValueNs ( ti. ident . name . as_str ( ) ) ,
226
- TraitItemKind :: Type ( ..) => DefPathData :: AssocTypeInTrait ( ti. ident . name . as_str ( ) ) ,
226
+ DefPathData :: ValueNs ( ti. ident . name . as_interned_str ( ) ) ,
227
+ TraitItemKind :: Type ( ..) => {
228
+ DefPathData :: AssocTypeInTrait ( ti. ident . name . as_interned_str ( ) )
229
+ } ,
227
230
TraitItemKind :: Macro ( ..) => return self . visit_macro_invoc ( ti. id , false ) ,
228
231
} ;
229
232
@@ -240,8 +243,8 @@ impl<'a> visit::Visitor<'a> for DefCollector<'a> {
240
243
fn visit_impl_item ( & mut self , ii : & ' a ImplItem ) {
241
244
let def_data = match ii. node {
242
245
ImplItemKind :: Method ( ..) | ImplItemKind :: Const ( ..) =>
243
- DefPathData :: ValueNs ( ii. ident . name . as_str ( ) ) ,
244
- ImplItemKind :: Type ( ..) => DefPathData :: AssocTypeInImpl ( ii. ident . name . as_str ( ) ) ,
246
+ DefPathData :: ValueNs ( ii. ident . name . as_interned_str ( ) ) ,
247
+ ImplItemKind :: Type ( ..) => DefPathData :: AssocTypeInImpl ( ii. ident . name . as_interned_str ( ) ) ,
245
248
ImplItemKind :: Macro ( ..) => return self . visit_macro_invoc ( ii. id , false ) ,
246
249
} ;
247
250
0 commit comments