@@ -670,9 +670,6 @@ pub struct ModuleItems {
670670/// [rustc dev guide]: https://rustc-dev-guide.rust-lang.org/hir.html
671671#[ derive( Debug ) ]
672672pub struct Crate < ' hir > {
673- // Attributes from non-exported macros, kept only for collecting the library feature list.
674- pub non_exported_macro_attrs : & ' hir [ Attribute ] ,
675-
676673 pub owners : IndexVec < LocalDefId , Option < OwnerNode < ' hir > > > ,
677674 pub bodies : BTreeMap < BodyId , Body < ' hir > > ,
678675 pub trait_impls : BTreeMap < DefId , Vec < LocalDefId > > ,
@@ -768,32 +765,6 @@ impl Crate<'_> {
768765 _ => None ,
769766 } )
770767 }
771-
772- pub fn exported_macros < ' hir > ( & ' hir self ) -> impl Iterator < Item = & ' hir MacroDef < ' hir > > + ' hir {
773- self . owners . iter ( ) . filter_map ( |owner| match owner {
774- Some ( OwnerNode :: MacroDef ( macro_def) ) => Some ( * macro_def) ,
775- _ => None ,
776- } )
777- }
778- }
779-
780- /// A macro definition, in this crate or imported from another.
781- ///
782- /// Not parsed directly, but created on macro import or `macro_rules!` expansion.
783- #[ derive( Debug ) ]
784- pub struct MacroDef < ' hir > {
785- pub ident : Ident ,
786- pub vis : Visibility < ' hir > ,
787- pub def_id : LocalDefId ,
788- pub span : Span ,
789- pub ast : ast:: MacroDef ,
790- }
791-
792- impl MacroDef < ' _ > {
793- #[ inline]
794- pub fn hir_id ( & self ) -> HirId {
795- HirId :: make_owner ( self . def_id )
796- }
797768}
798769
799770/// A block of statements `{ .. }`, which may have a label (in this case the
@@ -2602,7 +2573,7 @@ pub struct PolyTraitRef<'hir> {
26022573
26032574pub type Visibility < ' hir > = Spanned < VisibilityKind < ' hir > > ;
26042575
2605- #[ derive( Debug ) ]
2576+ #[ derive( Copy , Clone , Debug ) ]
26062577pub enum VisibilityKind < ' hir > {
26072578 Public ,
26082579 Crate ( CrateSugar ) ,
@@ -2791,6 +2762,8 @@ pub enum ItemKind<'hir> {
27912762 Const ( & ' hir Ty < ' hir > , BodyId ) ,
27922763 /// A function declaration.
27932764 Fn ( FnSig < ' hir > , Generics < ' hir > , BodyId ) ,
2765+ /// A MBE macro definition (`macro_rules!` or `macro`).
2766+ Macro ( ast:: MacroDef ) ,
27942767 /// A module.
27952768 Mod ( Mod < ' hir > ) ,
27962769 /// An external module, e.g. `extern { .. }`.
@@ -2856,6 +2829,7 @@ impl ItemKind<'_> {
28562829 ItemKind :: Static ( ..) => "static item" ,
28572830 ItemKind :: Const ( ..) => "constant item" ,
28582831 ItemKind :: Fn ( ..) => "function" ,
2832+ ItemKind :: Macro ( ..) => "macro" ,
28592833 ItemKind :: Mod ( ..) => "module" ,
28602834 ItemKind :: ForeignMod { .. } => "extern block" ,
28612835 ItemKind :: GlobalAsm ( ..) => "global asm item" ,
0 commit comments