@@ -18,7 +18,7 @@ use std::fmt::Write;
1818use std:: hash:: Hash ;
1919use syntax:: ast;
2020use syntax_expand:: hygiene:: ExpnId ;
21- use syntax:: symbol:: { Symbol , sym, InternedString } ;
21+ use syntax:: symbol:: { Symbol , sym} ;
2222use syntax_pos:: { Span , DUMMY_SP } ;
2323
2424/// The `DefPathTable` maps `DefIndex`es to `DefKey`s and vice versa.
@@ -218,7 +218,7 @@ impl DefPath {
218218 for component in & self . data {
219219 write ! ( s,
220220 "::{}[{}]" ,
221- component. data. as_interned_str ( ) ,
221+ component. data. as_symbol ( ) ,
222222 component. disambiguator)
223223 . unwrap ( ) ;
224224 }
@@ -238,11 +238,11 @@ impl DefPath {
238238
239239 for component in & self . data {
240240 if component. disambiguator == 0 {
241- write ! ( s, "::{}" , component. data. as_interned_str ( ) ) . unwrap ( ) ;
241+ write ! ( s, "::{}" , component. data. as_symbol ( ) ) . unwrap ( ) ;
242242 } else {
243243 write ! ( s,
244244 "{}[{}]" ,
245- component. data. as_interned_str ( ) ,
245+ component. data. as_symbol ( ) ,
246246 component. disambiguator)
247247 . unwrap ( ) ;
248248 }
@@ -262,11 +262,11 @@ impl DefPath {
262262 opt_delimiter. map ( |d| s. push ( d) ) ;
263263 opt_delimiter = Some ( '-' ) ;
264264 if component. disambiguator == 0 {
265- write ! ( s, "{}" , component. data. as_interned_str ( ) ) . unwrap ( ) ;
265+ write ! ( s, "{}" , component. data. as_symbol ( ) ) . unwrap ( ) ;
266266 } else {
267267 write ! ( s,
268268 "{}[{}]" ,
269- component. data. as_interned_str ( ) ,
269+ component. data. as_symbol ( ) ,
270270 component. disambiguator)
271271 . unwrap ( ) ;
272272 }
@@ -290,13 +290,13 @@ pub enum DefPathData {
290290 /// An impl.
291291 Impl ,
292292 /// Something in the type namespace.
293- TypeNs ( InternedString ) ,
293+ TypeNs ( Symbol ) ,
294294 /// Something in the value namespace.
295- ValueNs ( InternedString ) ,
295+ ValueNs ( Symbol ) ,
296296 /// Something in the macro namespace.
297- MacroNs ( InternedString ) ,
297+ MacroNs ( Symbol ) ,
298298 /// Something in the lifetime namespace.
299- LifetimeNs ( InternedString ) ,
299+ LifetimeNs ( Symbol ) ,
300300 /// A closure expression.
301301 ClosureExpr ,
302302
@@ -311,7 +311,7 @@ pub enum DefPathData {
311311 /// Identifies a piece of crate metadata that is global to a whole crate
312312 /// (as opposed to just one item). `GlobalMetaData` components are only
313313 /// supposed to show up right below the crate root.
314- GlobalMetaData ( InternedString ) ,
314+ GlobalMetaData ( Symbol ) ,
315315}
316316
317317#[ derive( Copy , Clone , Hash , PartialEq , Eq , PartialOrd , Ord , Debug ,
@@ -545,7 +545,7 @@ impl Definitions {
545545}
546546
547547impl DefPathData {
548- pub fn get_opt_name ( & self ) -> Option < InternedString > {
548+ pub fn get_opt_name ( & self ) -> Option < Symbol > {
549549 use self :: DefPathData :: * ;
550550 match * self {
551551 TypeNs ( name) |
@@ -564,15 +564,15 @@ impl DefPathData {
564564 }
565565 }
566566
567- pub fn as_interned_str ( & self ) -> InternedString {
567+ pub fn as_symbol ( & self ) -> Symbol {
568568 use self :: DefPathData :: * ;
569- let s = match * self {
569+ match * self {
570570 TypeNs ( name) |
571571 ValueNs ( name) |
572572 MacroNs ( name) |
573573 LifetimeNs ( name) |
574574 GlobalMetaData ( name) => {
575- return name
575+ name
576576 }
577577 // Note that this does not show up in user print-outs.
578578 CrateRoot => sym:: double_braced_crate,
@@ -582,13 +582,11 @@ impl DefPathData {
582582 Ctor => sym:: double_braced_constructor,
583583 AnonConst => sym:: double_braced_constant,
584584 ImplTrait => sym:: double_braced_opaque,
585- } ;
586-
587- s. as_interned_str ( )
585+ }
588586 }
589587
590588 pub fn to_string ( & self ) -> String {
591- self . as_interned_str ( ) . to_string ( )
589+ self . as_symbol ( ) . to_string ( )
592590 }
593591}
594592
@@ -611,7 +609,7 @@ macro_rules! define_global_metadata_kind {
611609 definitions. create_def_with_parent(
612610 CRATE_DEF_INDEX ,
613611 ast:: DUMMY_NODE_ID ,
614- DefPathData :: GlobalMetaData ( instance. name( ) . as_interned_str ( ) ) ,
612+ DefPathData :: GlobalMetaData ( instance. name( ) ) ,
615613 ExpnId :: root( ) ,
616614 DUMMY_SP
617615 ) ;
@@ -625,7 +623,7 @@ macro_rules! define_global_metadata_kind {
625623 let def_key = DefKey {
626624 parent: Some ( CRATE_DEF_INDEX ) ,
627625 disambiguated_data: DisambiguatedDefPathData {
628- data: DefPathData :: GlobalMetaData ( self . name( ) . as_interned_str ( ) ) ,
626+ data: DefPathData :: GlobalMetaData ( self . name( ) ) ,
629627 disambiguator: 0 ,
630628 }
631629 } ;
0 commit comments