@@ -797,9 +797,9 @@ pub struct SyntaxExtension {
797797 /// Should debuginfo for the macro be collapsed to the outermost expansion site (in other
798798 /// words, was the macro definition annotated with `#[collapse_debuginfo]`)?
799799 pub collapse_debuginfo : bool ,
800- /// Suppresses the " this error originates in the macro" note when a diagnostic points at this
801- /// macro.
802- pub hide_backtrace : bool ,
800+ /// Prevents diagnostics pointing into this macro and suppresses the "this error originates in
801+ /// the macro" note when a diagnostic points at this macro.
802+ pub diagnostic_opaque : bool ,
803803}
804804
805805impl SyntaxExtension {
@@ -833,7 +833,7 @@ impl SyntaxExtension {
833833 allow_internal_unsafe : false ,
834834 local_inner_macros : false ,
835835 collapse_debuginfo : false ,
836- hide_backtrace : false ,
836+ diagnostic_opaque : false ,
837837 }
838838 }
839839
@@ -863,12 +863,6 @@ impl SyntaxExtension {
863863 collapse_table[ flag as usize ] [ attr as usize ]
864864 }
865865
866- fn get_hide_backtrace ( attrs : & [ hir:: Attribute ] ) -> bool {
867- // FIXME(estebank): instead of reusing `#[rustc_diagnostic_item]` as a proxy, introduce a
868- // new attribute purely for this under the `#[diagnostic]` namespace.
869- find_attr ! ( attrs, RustcDiagnosticItem ( ..) )
870- }
871-
872866 /// Constructs a syntax extension with the given properties
873867 /// and other properties converted from attributes.
874868 pub fn new (
@@ -903,7 +897,8 @@ impl SyntaxExtension {
903897 // Not a built-in macro
904898 None => ( None , helper_attrs) ,
905899 } ;
906- let hide_backtrace = builtin_name. is_some ( ) || Self :: get_hide_backtrace ( attrs) ;
900+ let diagnostic_opaque = builtin_name. is_some ( )
901+ || ( !sess. opts . unstable_opts . macro_backtrace && find_attr ! ( attrs, Opaque ) ) ;
907902
908903 let stability = find_attr ! ( attrs, Stability { stability, .. } => * stability) ;
909904
@@ -931,7 +926,7 @@ impl SyntaxExtension {
931926 allow_internal_unsafe,
932927 local_inner_macros,
933928 collapse_debuginfo,
934- hide_backtrace ,
929+ diagnostic_opaque ,
935930 }
936931 }
937932
@@ -1017,7 +1012,7 @@ impl SyntaxExtension {
10171012 self . allow_internal_unsafe ,
10181013 self . local_inner_macros ,
10191014 self . collapse_debuginfo ,
1020- self . hide_backtrace ,
1015+ self . diagnostic_opaque ,
10211016 )
10221017 }
10231018}
0 commit comments