@@ -761,16 +761,22 @@ impl Crate<'_> {
761761/// A macro definition, in this crate or imported from another.
762762///
763763/// Not parsed directly, but created on macro import or `macro_rules!` expansion.
764- #[ derive( Debug , HashStable_Generic ) ]
764+ #[ derive( Debug ) ]
765765pub struct MacroDef < ' hir > {
766766 pub ident : Ident ,
767767 pub vis : Visibility < ' hir > ,
768768 pub attrs : & ' hir [ Attribute ] ,
769- pub hir_id : HirId ,
769+ pub def_id : LocalDefId ,
770770 pub span : Span ,
771771 pub ast : ast:: MacroDef ,
772772}
773773
774+ impl MacroDef < ' _ > {
775+ pub fn hir_id ( & self ) -> HirId {
776+ HirId :: make_owner ( self . def_id )
777+ }
778+ }
779+
774780/// A block of statements `{ .. }`, which may have a label (in this case the
775781/// `targeted_by_break` field will be `true`) and may be `unsafe` by means of
776782/// the `rules` being anything but `DefaultBlock`.
@@ -2941,7 +2947,8 @@ impl<'hir> Node<'hir> {
29412947 Node :: Item ( Item { def_id, .. } )
29422948 | Node :: TraitItem ( TraitItem { def_id, .. } )
29432949 | Node :: ImplItem ( ImplItem { def_id, .. } )
2944- | Node :: ForeignItem ( ForeignItem { def_id, .. } ) => Some ( HirId :: make_owner ( * def_id) ) ,
2950+ | Node :: ForeignItem ( ForeignItem { def_id, .. } )
2951+ | Node :: MacroDef ( MacroDef { def_id, .. } ) => Some ( HirId :: make_owner ( * def_id) ) ,
29452952 Node :: Field ( StructField { hir_id, .. } )
29462953 | Node :: AnonConst ( AnonConst { hir_id, .. } )
29472954 | Node :: Expr ( Expr { hir_id, .. } )
@@ -2952,7 +2959,6 @@ impl<'hir> Node<'hir> {
29522959 | Node :: Arm ( Arm { hir_id, .. } )
29532960 | Node :: Block ( Block { hir_id, .. } )
29542961 | Node :: Local ( Local { hir_id, .. } )
2955- | Node :: MacroDef ( MacroDef { hir_id, .. } )
29562962 | Node :: Lifetime ( Lifetime { hir_id, .. } )
29572963 | Node :: Param ( Param { hir_id, .. } )
29582964 | Node :: GenericParam ( GenericParam { hir_id, .. } ) => Some ( * hir_id) ,
0 commit comments