@@ -693,10 +693,6 @@ pub struct SyntaxExtension {
693693 pub span : Span ,
694694 /// List of unstable features that are treated as stable inside this macro.
695695 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 ,
700696 /// The macro's stability info.
701697 pub stability : Option < Stability > ,
702698 /// The macro's deprecation info.
@@ -708,6 +704,13 @@ pub struct SyntaxExtension {
708704 /// Built-in macros have a couple of special properties like availability
709705 /// in `#[no_implicit_prelude]` modules, so we have to keep this flag.
710706 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 ,
711714}
712715
713716impl SyntaxExtension {
@@ -729,14 +732,15 @@ impl SyntaxExtension {
729732 SyntaxExtension {
730733 span : DUMMY_SP ,
731734 allow_internal_unstable : None ,
732- allow_internal_unsafe : false ,
733- local_inner_macros : false ,
734735 stability : None ,
735736 deprecation : None ,
736737 helper_attrs : Vec :: new ( ) ,
737738 edition,
738739 builtin_name : None ,
739740 kind,
741+ allow_internal_unsafe : false ,
742+ local_inner_macros : false ,
743+ collapse_debuginfo : false ,
740744 }
741745 }
742746
@@ -754,12 +758,13 @@ impl SyntaxExtension {
754758 let allow_internal_unstable =
755759 attr:: allow_internal_unstable ( sess, & attrs) . collect :: < Vec < Symbol > > ( ) ;
756760
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) ;
763768
764769 let ( builtin_name, helper_attrs) = sess
765770 . find_by_name ( attrs, sym:: rustc_builtin_macro)
@@ -801,13 +806,14 @@ impl SyntaxExtension {
801806 span,
802807 allow_internal_unstable : ( !allow_internal_unstable. is_empty ( ) )
803808 . then ( || allow_internal_unstable. into ( ) ) ,
804- allow_internal_unsafe : sess. contains_name ( attrs, sym:: allow_internal_unsafe) ,
805- local_inner_macros,
806809 stability : stability. map ( |( s, _) | s) ,
807810 deprecation : attr:: find_deprecation ( & sess, attrs) . map ( |( d, _) | d) ,
808811 helper_attrs,
809812 edition,
810813 builtin_name,
814+ allow_internal_unsafe,
815+ local_inner_macros,
816+ collapse_debuginfo,
811817 }
812818 }
813819
@@ -852,11 +858,12 @@ impl SyntaxExtension {
852858 call_site,
853859 self . span ,
854860 self . allow_internal_unstable . clone ( ) ,
855- self . allow_internal_unsafe ,
856- self . local_inner_macros ,
857861 self . edition ,
858862 macro_def_id,
859863 parent_module,
864+ self . allow_internal_unsafe ,
865+ self . local_inner_macros ,
866+ self . collapse_debuginfo ,
860867 )
861868 }
862869}
0 commit comments