@@ -107,18 +107,18 @@ impl<'a> visit::Visitor<'a> for DefCollector<'a> {
107107 // information we encapsulate into
108108 let def_data = match i. node {
109109 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 ( ) ) ,
111111 ItemKind :: Enum ( ..) | ItemKind :: Struct ( ..) | ItemKind :: Union ( ..) |
112112 ItemKind :: TraitAlias ( ..) |
113113 ItemKind :: ExternCrate ( ..) | ItemKind :: ForeignMod ( ..) | ItemKind :: Ty ( ..) =>
114- DefPathData :: TypeNs ( i. ident . name . as_str ( ) ) ,
114+ DefPathData :: TypeNs ( i. ident . name . as_interned_str ( ) ) ,
115115 ItemKind :: Mod ( ..) if i. ident == keywords:: Invalid . ident ( ) => {
116116 return visit:: walk_item ( self , i) ;
117117 }
118- ItemKind :: Mod ( ..) => DefPathData :: Module ( i. ident . name . as_str ( ) ) ,
118+ ItemKind :: Mod ( ..) => DefPathData :: Module ( i. ident . name . as_interned_str ( ) ) ,
119119 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 ( ) ) ,
122122 ItemKind :: Mac ( ..) => return self . visit_macro_invoc ( i. id , false ) ,
123123 ItemKind :: GlobalAsm ( ..) => DefPathData :: Misc ,
124124 ItemKind :: Use ( ..) => {
@@ -133,15 +133,16 @@ impl<'a> visit::Visitor<'a> for DefCollector<'a> {
133133 for v in & enum_definition. variants {
134134 let variant_def_index =
135135 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 ( ) ) ,
137138 REGULAR_SPACE ,
138139 v. span ) ;
139140 this. with_parent ( variant_def_index, |this| {
140141 for ( index, field) in v. node . data . fields ( ) . iter ( ) . enumerate ( ) {
141142 let name = field. ident . map ( |ident| ident. name )
142143 . unwrap_or_else ( || Symbol :: intern ( & index. to_string ( ) ) ) ;
143144 this. create_def ( field. id ,
144- DefPathData :: Field ( name. as_str ( ) ) ,
145+ DefPathData :: Field ( name. as_interned_str ( ) ) ,
145146 REGULAR_SPACE ,
146147 field. span ) ;
147148 }
@@ -165,7 +166,7 @@ impl<'a> visit::Visitor<'a> for DefCollector<'a> {
165166 let name = field. ident . map ( |ident| ident. name )
166167 . unwrap_or_else ( || Symbol :: intern ( & index. to_string ( ) ) ) ;
167168 this. create_def ( field. id ,
168- DefPathData :: Field ( name. as_str ( ) ) ,
169+ DefPathData :: Field ( name. as_interned_str ( ) ) ,
169170 REGULAR_SPACE ,
170171 field. span ) ;
171172 }
@@ -187,7 +188,7 @@ impl<'a> visit::Visitor<'a> for DefCollector<'a> {
187188 }
188189
189190 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 ( ) ) ,
191192 REGULAR_SPACE ,
192193 foreign_item. span ) ;
193194
@@ -201,15 +202,15 @@ impl<'a> visit::Visitor<'a> for DefCollector<'a> {
201202 GenericParam :: Lifetime ( ref lifetime_def) => {
202203 self . create_def (
203204 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 ( ) ) ,
205206 REGULAR_SPACE ,
206207 lifetime_def. lifetime . ident . span
207208 ) ;
208209 }
209210 GenericParam :: Type ( ref ty_param) => {
210211 self . create_def (
211212 ty_param. id ,
212- DefPathData :: TypeParam ( ty_param. ident . name . as_str ( ) ) ,
213+ DefPathData :: TypeParam ( ty_param. ident . name . as_interned_str ( ) ) ,
213214 REGULAR_SPACE ,
214215 ty_param. ident . span
215216 ) ;
@@ -222,8 +223,10 @@ impl<'a> visit::Visitor<'a> for DefCollector<'a> {
222223 fn visit_trait_item ( & mut self , ti : & ' a TraitItem ) {
223224 let def_data = match ti. node {
224225 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+ } ,
227230 TraitItemKind :: Macro ( ..) => return self . visit_macro_invoc ( ti. id , false ) ,
228231 } ;
229232
@@ -240,8 +243,8 @@ impl<'a> visit::Visitor<'a> for DefCollector<'a> {
240243 fn visit_impl_item ( & mut self , ii : & ' a ImplItem ) {
241244 let def_data = match ii. node {
242245 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 ( ) ) ,
245248 ImplItemKind :: Macro ( ..) => return self . visit_macro_invoc ( ii. id , false ) ,
246249 } ;
247250
0 commit comments