@@ -19,7 +19,7 @@ use std::hash::Hash;
19
19
use syntax:: ast;
20
20
use syntax_pos:: symbol:: { Symbol , sym} ;
21
21
use syntax_pos:: hygiene:: ExpnId ;
22
- use syntax_pos:: { Span , DUMMY_SP } ;
22
+ use syntax_pos:: Span ;
23
23
24
24
/// The `DefPathTable` maps `DefIndex`es to `DefKey`s and vice versa.
25
25
/// Internally the `DefPathTable` holds a tree of `DefKey`s, where each `DefKey`
@@ -310,10 +310,6 @@ pub enum DefPathData {
310
310
AnonConst ,
311
311
/// An `impl Trait` type node.
312
312
ImplTrait ,
313
- /// Identifies a piece of crate metadata that is global to a whole crate
314
- /// (as opposed to just one item). `GlobalMetaData` components are only
315
- /// supposed to show up right below the crate root.
316
- GlobalMetaData ( Symbol ) ,
317
313
}
318
314
319
315
#[ derive( Copy , Clone , Hash , PartialEq , Eq , PartialOrd , Ord , Debug ,
@@ -444,9 +440,6 @@ impl Definitions {
444
440
self . node_to_def_index . insert ( ast:: CRATE_NODE_ID , root_index) ;
445
441
self . set_invocation_parent ( ExpnId :: root ( ) , root_index) ;
446
442
447
- // Allocate some other `DefIndex`es that always must exist.
448
- GlobalMetaDataKind :: allocate_def_indices ( self ) ;
449
-
450
443
root_index
451
444
}
452
445
@@ -553,8 +546,7 @@ impl DefPathData {
553
546
TypeNs ( name) |
554
547
ValueNs ( name) |
555
548
MacroNs ( name) |
556
- LifetimeNs ( name) |
557
- GlobalMetaData ( name) => Some ( name) ,
549
+ LifetimeNs ( name) => Some ( name) ,
558
550
559
551
Impl |
560
552
CrateRoot |
@@ -572,8 +564,7 @@ impl DefPathData {
572
564
TypeNs ( name) |
573
565
ValueNs ( name) |
574
566
MacroNs ( name) |
575
- LifetimeNs ( name) |
576
- GlobalMetaData ( name) => {
567
+ LifetimeNs ( name) => {
577
568
name
578
569
}
579
570
// Note that this does not show up in user print-outs.
@@ -591,78 +582,3 @@ impl DefPathData {
591
582
self . as_symbol ( ) . to_string ( )
592
583
}
593
584
}
594
-
595
- // We define the `GlobalMetaDataKind` enum with this macro because we want to
596
- // make sure that we exhaustively iterate over all variants when registering
597
- // the corresponding `DefIndex`es in the `DefTable`.
598
- macro_rules! define_global_metadata_kind {
599
- ( pub enum GlobalMetaDataKind {
600
- $( $variant: ident) ,*
601
- } ) => (
602
- pub enum GlobalMetaDataKind {
603
- $( $variant) ,*
604
- }
605
-
606
- impl GlobalMetaDataKind {
607
- fn allocate_def_indices( definitions: & mut Definitions ) {
608
- $( {
609
- let instance = GlobalMetaDataKind :: $variant;
610
- definitions. create_def_with_parent(
611
- CRATE_DEF_INDEX ,
612
- ast:: DUMMY_NODE_ID ,
613
- DefPathData :: GlobalMetaData ( instance. name( ) ) ,
614
- ExpnId :: root( ) ,
615
- DUMMY_SP
616
- ) ;
617
-
618
- // Make sure calling `def_index` does not crash.
619
- instance. def_index( & definitions. table) ;
620
- } ) *
621
- }
622
-
623
- pub fn def_index( & self , def_path_table: & DefPathTable ) -> DefIndex {
624
- let def_key = DefKey {
625
- parent: Some ( CRATE_DEF_INDEX ) ,
626
- disambiguated_data: DisambiguatedDefPathData {
627
- data: DefPathData :: GlobalMetaData ( self . name( ) ) ,
628
- disambiguator: 0 ,
629
- }
630
- } ;
631
-
632
- // These `DefKey`s are all right after the root,
633
- // so a linear search is fine.
634
- let index = def_path_table. index_to_key
635
- . iter( )
636
- . position( |k| * k == def_key)
637
- . unwrap( ) ;
638
-
639
- DefIndex :: from( index)
640
- }
641
-
642
- fn name( & self ) -> Symbol {
643
-
644
- let string = match * self {
645
- $(
646
- GlobalMetaDataKind :: $variant => {
647
- concat!( "{{GlobalMetaData::" , stringify!( $variant) , "}}" )
648
- }
649
- ) *
650
- } ;
651
-
652
- Symbol :: intern( string)
653
- }
654
- }
655
- )
656
- }
657
-
658
- define_global_metadata_kind ! ( pub enum GlobalMetaDataKind {
659
- Krate ,
660
- CrateDeps ,
661
- DylibDependencyFormats ,
662
- LangItems ,
663
- LangItemsMissing ,
664
- NativeLibraries ,
665
- SourceMap ,
666
- Impls ,
667
- ExportedSymbols
668
- } ) ;
0 commit comments