@@ -761,16 +761,22 @@ impl Crate<'_> {
761
761
/// A macro definition, in this crate or imported from another.
762
762
///
763
763
/// Not parsed directly, but created on macro import or `macro_rules!` expansion.
764
- #[ derive( Debug , HashStable_Generic ) ]
764
+ #[ derive( Debug ) ]
765
765
pub struct MacroDef < ' hir > {
766
766
pub ident : Ident ,
767
767
pub vis : Visibility < ' hir > ,
768
768
pub attrs : & ' hir [ Attribute ] ,
769
- pub hir_id : HirId ,
769
+ pub def_id : LocalDefId ,
770
770
pub span : Span ,
771
771
pub ast : ast:: MacroDef ,
772
772
}
773
773
774
+ impl MacroDef < ' _ > {
775
+ pub fn hir_id ( & self ) -> HirId {
776
+ HirId :: make_owner ( self . def_id )
777
+ }
778
+ }
779
+
774
780
/// A block of statements `{ .. }`, which may have a label (in this case the
775
781
/// `targeted_by_break` field will be `true`) and may be `unsafe` by means of
776
782
/// the `rules` being anything but `DefaultBlock`.
@@ -2941,7 +2947,8 @@ impl<'hir> Node<'hir> {
2941
2947
Node :: Item ( Item { def_id, .. } )
2942
2948
| Node :: TraitItem ( TraitItem { def_id, .. } )
2943
2949
| 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) ) ,
2945
2952
Node :: Field ( StructField { hir_id, .. } )
2946
2953
| Node :: AnonConst ( AnonConst { hir_id, .. } )
2947
2954
| Node :: Expr ( Expr { hir_id, .. } )
@@ -2952,7 +2959,6 @@ impl<'hir> Node<'hir> {
2952
2959
| Node :: Arm ( Arm { hir_id, .. } )
2953
2960
| Node :: Block ( Block { hir_id, .. } )
2954
2961
| Node :: Local ( Local { hir_id, .. } )
2955
- | Node :: MacroDef ( MacroDef { hir_id, .. } )
2956
2962
| Node :: Lifetime ( Lifetime { hir_id, .. } )
2957
2963
| Node :: Param ( Param { hir_id, .. } )
2958
2964
| Node :: GenericParam ( GenericParam { hir_id, .. } ) => Some ( * hir_id) ,
0 commit comments