@@ -693,10 +693,6 @@ pub struct SyntaxExtension {
693
693
pub span : Span ,
694
694
/// List of unstable features that are treated as stable inside this macro.
695
695
pub allow_internal_unstable : Option < Lrc < [ Symbol ] > > ,
696
- /// Suppresses the `unsafe_code` lint for code produced by this macro.
697
- pub allow_internal_unsafe : bool ,
698
- /// Enables the macro helper hack (`ident!(...)` -> `$crate::ident!(...)`) for this macro.
699
- pub local_inner_macros : bool ,
700
696
/// The macro's stability info.
701
697
pub stability : Option < Stability > ,
702
698
/// The macro's deprecation info.
@@ -708,6 +704,13 @@ pub struct SyntaxExtension {
708
704
/// Built-in macros have a couple of special properties like availability
709
705
/// in `#[no_implicit_prelude]` modules, so we have to keep this flag.
710
706
pub builtin_name : Option < Symbol > ,
707
+ /// Suppresses the `unsafe_code` lint for code produced by this macro.
708
+ pub allow_internal_unsafe : bool ,
709
+ /// Enables the macro helper hack (`ident!(...)` -> `$crate::ident!(...)`) for this macro.
710
+ pub local_inner_macros : bool ,
711
+ /// Should debuginfo for the macro be collapsed to the outermost expansion site (in other
712
+ /// words, was the macro definition annotated with `#[collapse_debuginfo]`)?
713
+ pub collapse_debuginfo : bool ,
711
714
}
712
715
713
716
impl SyntaxExtension {
@@ -729,14 +732,15 @@ impl SyntaxExtension {
729
732
SyntaxExtension {
730
733
span : DUMMY_SP ,
731
734
allow_internal_unstable : None ,
732
- allow_internal_unsafe : false ,
733
- local_inner_macros : false ,
734
735
stability : None ,
735
736
deprecation : None ,
736
737
helper_attrs : Vec :: new ( ) ,
737
738
edition,
738
739
builtin_name : None ,
739
740
kind,
741
+ allow_internal_unsafe : false ,
742
+ local_inner_macros : false ,
743
+ collapse_debuginfo : false ,
740
744
}
741
745
}
742
746
@@ -754,12 +758,13 @@ impl SyntaxExtension {
754
758
let allow_internal_unstable =
755
759
attr:: allow_internal_unstable ( sess, & attrs) . collect :: < Vec < Symbol > > ( ) ;
756
760
757
- let mut local_inner_macros = false ;
758
- if let Some ( macro_export) = sess. find_by_name ( attrs, sym:: macro_export) {
759
- if let Some ( l) = macro_export. meta_item_list ( ) {
760
- local_inner_macros = attr:: list_contains_name ( & l, sym:: local_inner_macros) ;
761
- }
762
- }
761
+ let allow_internal_unsafe = sess. contains_name ( attrs, sym:: allow_internal_unsafe) ;
762
+ let local_inner_macros = sess
763
+ . find_by_name ( attrs, sym:: macro_export)
764
+ . and_then ( |macro_export| macro_export. meta_item_list ( ) )
765
+ . map_or ( false , |l| attr:: list_contains_name ( & l, sym:: local_inner_macros) ) ;
766
+ let collapse_debuginfo = sess. contains_name ( attrs, sym:: collapse_debuginfo) ;
767
+ tracing:: debug!( ?local_inner_macros, ?collapse_debuginfo, ?allow_internal_unsafe) ;
763
768
764
769
let ( builtin_name, helper_attrs) = sess
765
770
. find_by_name ( attrs, sym:: rustc_builtin_macro)
@@ -801,13 +806,14 @@ impl SyntaxExtension {
801
806
span,
802
807
allow_internal_unstable : ( !allow_internal_unstable. is_empty ( ) )
803
808
. then ( || allow_internal_unstable. into ( ) ) ,
804
- allow_internal_unsafe : sess. contains_name ( attrs, sym:: allow_internal_unsafe) ,
805
- local_inner_macros,
806
809
stability : stability. map ( |( s, _) | s) ,
807
810
deprecation : attr:: find_deprecation ( & sess, attrs) . map ( |( d, _) | d) ,
808
811
helper_attrs,
809
812
edition,
810
813
builtin_name,
814
+ allow_internal_unsafe,
815
+ local_inner_macros,
816
+ collapse_debuginfo,
811
817
}
812
818
}
813
819
@@ -852,11 +858,12 @@ impl SyntaxExtension {
852
858
call_site,
853
859
self . span ,
854
860
self . allow_internal_unstable . clone ( ) ,
855
- self . allow_internal_unsafe ,
856
- self . local_inner_macros ,
857
861
self . edition ,
858
862
macro_def_id,
859
863
parent_module,
864
+ self . allow_internal_unsafe ,
865
+ self . local_inner_macros ,
866
+ self . collapse_debuginfo ,
860
867
)
861
868
}
862
869
}
0 commit comments