@@ -670,9 +670,6 @@ pub struct ModuleItems {
670
670
/// [rustc dev guide]: https://rustc-dev-guide.rust-lang.org/hir.html
671
671
#[ derive( Debug ) ]
672
672
pub 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
-
676
673
pub owners : IndexVec < LocalDefId , Option < OwnerNode < ' hir > > > ,
677
674
pub bodies : BTreeMap < BodyId , Body < ' hir > > ,
678
675
pub trait_impls : BTreeMap < DefId , Vec < LocalDefId > > ,
@@ -768,32 +765,6 @@ impl Crate<'_> {
768
765
_ => None ,
769
766
} )
770
767
}
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
- }
797
768
}
798
769
799
770
/// A block of statements `{ .. }`, which may have a label (in this case the
@@ -2602,7 +2573,7 @@ pub struct PolyTraitRef<'hir> {
2602
2573
2603
2574
pub type Visibility < ' hir > = Spanned < VisibilityKind < ' hir > > ;
2604
2575
2605
- #[ derive( Debug ) ]
2576
+ #[ derive( Copy , Clone , Debug ) ]
2606
2577
pub enum VisibilityKind < ' hir > {
2607
2578
Public ,
2608
2579
Crate ( CrateSugar ) ,
@@ -2791,6 +2762,8 @@ pub enum ItemKind<'hir> {
2791
2762
Const ( & ' hir Ty < ' hir > , BodyId ) ,
2792
2763
/// A function declaration.
2793
2764
Fn ( FnSig < ' hir > , Generics < ' hir > , BodyId ) ,
2765
+ /// A MBE macro definition (`macro_rules!` or `macro`).
2766
+ Macro ( ast:: MacroDef ) ,
2794
2767
/// A module.
2795
2768
Mod ( Mod < ' hir > ) ,
2796
2769
/// An external module, e.g. `extern { .. }`.
@@ -2856,6 +2829,7 @@ impl ItemKind<'_> {
2856
2829
ItemKind :: Static ( ..) => "static item" ,
2857
2830
ItemKind :: Const ( ..) => "constant item" ,
2858
2831
ItemKind :: Fn ( ..) => "function" ,
2832
+ ItemKind :: Macro ( ..) => "macro" ,
2859
2833
ItemKind :: Mod ( ..) => "module" ,
2860
2834
ItemKind :: ForeignMod { .. } => "extern block" ,
2861
2835
ItemKind :: GlobalAsm ( ..) => "global asm item" ,
0 commit comments