@@ -618,43 +618,6 @@ impl MetadataBlob {
618
618
}
619
619
}
620
620
621
- impl EntryKind {
622
- fn def_kind ( & self ) -> DefKind {
623
- match * self {
624
- EntryKind :: AnonConst ( ..) => DefKind :: AnonConst ,
625
- EntryKind :: Const ( ..) => DefKind :: Const ,
626
- EntryKind :: AssocConst ( ..) => DefKind :: AssocConst ,
627
- EntryKind :: ImmStatic
628
- | EntryKind :: MutStatic
629
- | EntryKind :: ForeignImmStatic
630
- | EntryKind :: ForeignMutStatic => DefKind :: Static ,
631
- EntryKind :: Struct ( _, _) => DefKind :: Struct ,
632
- EntryKind :: Union ( _, _) => DefKind :: Union ,
633
- EntryKind :: Fn ( _) | EntryKind :: ForeignFn ( _) => DefKind :: Fn ,
634
- EntryKind :: AssocFn ( _) => DefKind :: AssocFn ,
635
- EntryKind :: Type => DefKind :: TyAlias ,
636
- EntryKind :: TypeParam => DefKind :: TyParam ,
637
- EntryKind :: ConstParam => DefKind :: ConstParam ,
638
- EntryKind :: OpaqueTy => DefKind :: OpaqueTy ,
639
- EntryKind :: AssocType ( _) => DefKind :: AssocTy ,
640
- EntryKind :: Mod ( _) => DefKind :: Mod ,
641
- EntryKind :: Variant ( _) => DefKind :: Variant ,
642
- EntryKind :: Trait ( _) => DefKind :: Trait ,
643
- EntryKind :: TraitAlias => DefKind :: TraitAlias ,
644
- EntryKind :: Enum ( ..) => DefKind :: Enum ,
645
- EntryKind :: MacroDef ( _) => DefKind :: Macro ( MacroKind :: Bang ) ,
646
- EntryKind :: ProcMacro ( kind) => DefKind :: Macro ( kind) ,
647
- EntryKind :: ForeignType => DefKind :: ForeignTy ,
648
- EntryKind :: Impl ( _) => DefKind :: Impl ,
649
- EntryKind :: Closure => DefKind :: Closure ,
650
- EntryKind :: ForeignMod => DefKind :: ForeignMod ,
651
- EntryKind :: GlobalAsm => DefKind :: GlobalAsm ,
652
- EntryKind :: Field => DefKind :: Field ,
653
- EntryKind :: Generator ( _) => DefKind :: Generator ,
654
- }
655
- }
656
- }
657
-
658
621
impl CrateRoot < ' _ > {
659
622
crate fn is_proc_macro_crate ( & self ) -> bool {
660
623
self . proc_macro_data . is_some ( )
@@ -685,21 +648,6 @@ impl CrateRoot<'_> {
685
648
}
686
649
687
650
impl < ' a , ' tcx > CrateMetadataRef < ' a > {
688
- fn maybe_kind ( & self , item_id : DefIndex ) -> Option < EntryKind > {
689
- self . root . tables . kind . get ( self , item_id) . map ( |k| k. decode ( self ) )
690
- }
691
-
692
- fn kind ( & self , item_id : DefIndex ) -> EntryKind {
693
- self . maybe_kind ( item_id) . unwrap_or_else ( || {
694
- bug ! (
695
- "CrateMetadata::kind({:?}): id not found, in crate {:?} with number {}" ,
696
- item_id,
697
- self . root. name,
698
- self . cnum,
699
- )
700
- } )
701
- }
702
-
703
651
fn raw_proc_macro ( & self , id : DefIndex ) -> & ProcMacro {
704
652
// DefIndex's in root.proc_macro_data have a one-to-one correspondence
705
653
// with items in 'raw_proc_macros'.
@@ -736,8 +684,30 @@ impl<'a, 'tcx> CrateMetadataRef<'a> {
736
684
self . try_item_ident ( item_index, sess) . unwrap ( )
737
685
}
738
686
739
- fn def_kind ( & self , index : DefIndex ) -> DefKind {
740
- self . kind ( index) . def_kind ( )
687
+ fn maybe_kind ( & self , item_id : DefIndex ) -> Option < EntryKind > {
688
+ self . root . tables . kind . get ( self , item_id) . map ( |k| k. decode ( self ) )
689
+ }
690
+
691
+ fn kind ( & self , item_id : DefIndex ) -> EntryKind {
692
+ self . maybe_kind ( item_id) . unwrap_or_else ( || {
693
+ bug ! (
694
+ "CrateMetadata::kind({:?}): id not found, in crate {:?} with number {}" ,
695
+ item_id,
696
+ self . root. name,
697
+ self . cnum,
698
+ )
699
+ } )
700
+ }
701
+
702
+ fn def_kind ( & self , item_id : DefIndex ) -> DefKind {
703
+ self . root . tables . def_kind . get ( self , item_id) . map ( |k| k. decode ( self ) ) . unwrap_or_else ( || {
704
+ bug ! (
705
+ "CrateMetadata::def_kind({:?}): id not found, in crate {:?} with number {}" ,
706
+ item_id,
707
+ self . root. name,
708
+ self . cnum,
709
+ )
710
+ } )
741
711
}
742
712
743
713
fn get_span ( & self , index : DefIndex , sess : & Session ) -> Span {
0 commit comments