@@ -18,7 +18,7 @@ use std::fmt::Write;
18
18
use std:: hash:: Hash ;
19
19
use syntax:: ast;
20
20
use syntax_expand:: hygiene:: ExpnId ;
21
- use syntax:: symbol:: { Symbol , sym, InternedString } ;
21
+ use syntax:: symbol:: { Symbol , sym} ;
22
22
use syntax_pos:: { Span , DUMMY_SP } ;
23
23
24
24
/// The `DefPathTable` maps `DefIndex`es to `DefKey`s and vice versa.
@@ -218,7 +218,7 @@ impl DefPath {
218
218
for component in & self . data {
219
219
write ! ( s,
220
220
"::{}[{}]" ,
221
- component. data. as_interned_str ( ) ,
221
+ component. data. as_symbol ( ) ,
222
222
component. disambiguator)
223
223
. unwrap ( ) ;
224
224
}
@@ -238,11 +238,11 @@ impl DefPath {
238
238
239
239
for component in & self . data {
240
240
if component. disambiguator == 0 {
241
- write ! ( s, "::{}" , component. data. as_interned_str ( ) ) . unwrap ( ) ;
241
+ write ! ( s, "::{}" , component. data. as_symbol ( ) ) . unwrap ( ) ;
242
242
} else {
243
243
write ! ( s,
244
244
"{}[{}]" ,
245
- component. data. as_interned_str ( ) ,
245
+ component. data. as_symbol ( ) ,
246
246
component. disambiguator)
247
247
. unwrap ( ) ;
248
248
}
@@ -262,11 +262,11 @@ impl DefPath {
262
262
opt_delimiter. map ( |d| s. push ( d) ) ;
263
263
opt_delimiter = Some ( '-' ) ;
264
264
if component. disambiguator == 0 {
265
- write ! ( s, "{}" , component. data. as_interned_str ( ) ) . unwrap ( ) ;
265
+ write ! ( s, "{}" , component. data. as_symbol ( ) ) . unwrap ( ) ;
266
266
} else {
267
267
write ! ( s,
268
268
"{}[{}]" ,
269
- component. data. as_interned_str ( ) ,
269
+ component. data. as_symbol ( ) ,
270
270
component. disambiguator)
271
271
. unwrap ( ) ;
272
272
}
@@ -290,13 +290,13 @@ pub enum DefPathData {
290
290
/// An impl.
291
291
Impl ,
292
292
/// Something in the type namespace.
293
- TypeNs ( InternedString ) ,
293
+ TypeNs ( Symbol ) ,
294
294
/// Something in the value namespace.
295
- ValueNs ( InternedString ) ,
295
+ ValueNs ( Symbol ) ,
296
296
/// Something in the macro namespace.
297
- MacroNs ( InternedString ) ,
297
+ MacroNs ( Symbol ) ,
298
298
/// Something in the lifetime namespace.
299
- LifetimeNs ( InternedString ) ,
299
+ LifetimeNs ( Symbol ) ,
300
300
/// A closure expression.
301
301
ClosureExpr ,
302
302
@@ -311,7 +311,7 @@ pub enum DefPathData {
311
311
/// Identifies a piece of crate metadata that is global to a whole crate
312
312
/// (as opposed to just one item). `GlobalMetaData` components are only
313
313
/// supposed to show up right below the crate root.
314
- GlobalMetaData ( InternedString ) ,
314
+ GlobalMetaData ( Symbol ) ,
315
315
}
316
316
317
317
#[ derive( Copy , Clone , Hash , PartialEq , Eq , PartialOrd , Ord , Debug ,
@@ -545,7 +545,7 @@ impl Definitions {
545
545
}
546
546
547
547
impl DefPathData {
548
- pub fn get_opt_name ( & self ) -> Option < InternedString > {
548
+ pub fn get_opt_name ( & self ) -> Option < Symbol > {
549
549
use self :: DefPathData :: * ;
550
550
match * self {
551
551
TypeNs ( name) |
@@ -564,15 +564,15 @@ impl DefPathData {
564
564
}
565
565
}
566
566
567
- pub fn as_interned_str ( & self ) -> InternedString {
567
+ pub fn as_symbol ( & self ) -> Symbol {
568
568
use self :: DefPathData :: * ;
569
- let s = match * self {
569
+ match * self {
570
570
TypeNs ( name) |
571
571
ValueNs ( name) |
572
572
MacroNs ( name) |
573
573
LifetimeNs ( name) |
574
574
GlobalMetaData ( name) => {
575
- return name
575
+ name
576
576
}
577
577
// Note that this does not show up in user print-outs.
578
578
CrateRoot => sym:: double_braced_crate,
@@ -582,13 +582,11 @@ impl DefPathData {
582
582
Ctor => sym:: double_braced_constructor,
583
583
AnonConst => sym:: double_braced_constant,
584
584
ImplTrait => sym:: double_braced_opaque,
585
- } ;
586
-
587
- s. as_interned_str ( )
585
+ }
588
586
}
589
587
590
588
pub fn to_string ( & self ) -> String {
591
- self . as_interned_str ( ) . to_string ( )
589
+ self . as_symbol ( ) . to_string ( )
592
590
}
593
591
}
594
592
@@ -611,7 +609,7 @@ macro_rules! define_global_metadata_kind {
611
609
definitions. create_def_with_parent(
612
610
CRATE_DEF_INDEX ,
613
611
ast:: DUMMY_NODE_ID ,
614
- DefPathData :: GlobalMetaData ( instance. name( ) . as_interned_str ( ) ) ,
612
+ DefPathData :: GlobalMetaData ( instance. name( ) ) ,
615
613
ExpnId :: root( ) ,
616
614
DUMMY_SP
617
615
) ;
@@ -625,7 +623,7 @@ macro_rules! define_global_metadata_kind {
625
623
let def_key = DefKey {
626
624
parent: Some ( CRATE_DEF_INDEX ) ,
627
625
disambiguated_data: DisambiguatedDefPathData {
628
- data: DefPathData :: GlobalMetaData ( self . name( ) . as_interned_str ( ) ) ,
626
+ data: DefPathData :: GlobalMetaData ( self . name( ) ) ,
629
627
disambiguator: 0 ,
630
628
}
631
629
} ;
0 commit comments