@@ -6,6 +6,7 @@ use crate::{
66 Level , CodeSuggestion , DiagnosticBuilder , SubDiagnostic ,
77 SuggestionStyle , SourceMapperDyn , DiagnosticId ,
88} ;
9+ use crate :: Level :: Error ;
910use crate :: snippet:: { Annotation , AnnotationType , Line , MultilineAnnotation , StyledString , Style } ;
1011use crate :: styled_buffer:: StyledBuffer ;
1112
@@ -72,6 +73,7 @@ impl Emitter for EmitterWriter {
7273
7374 self . fix_multispans_in_std_macros ( & mut primary_span,
7475 & mut children,
76+ & db. level ,
7577 db. handler . flags . external_macro_backtrace ) ;
7678
7779 self . emit_messages_default ( & db. level ,
@@ -856,18 +858,27 @@ impl EmitterWriter {
856858 fn fix_multispans_in_std_macros ( & mut self ,
857859 span : & mut MultiSpan ,
858860 children : & mut Vec < SubDiagnostic > ,
861+ level : & Level ,
859862 backtrace : bool ) {
860863 let mut spans_updated = self . fix_multispan_in_std_macros ( span, backtrace) ;
861864 for child in children. iter_mut ( ) {
862865 spans_updated |= self . fix_multispan_in_std_macros ( & mut child. span , backtrace) ;
863866 }
867+ let msg = if level == & Error {
868+ "this error originates in a macro outside of the current crate \
869+ (in Nightly builds, run with -Z external-macro-backtrace \
870+ for more info)". to_string ( )
871+ } else {
872+ "this warning originates in a macro outside of the current crate \
873+ (in Nightly builds, run with -Z external-macro-backtrace \
874+ for more info)". to_string ( )
875+ } ;
876+
864877 if spans_updated {
865878 children. push ( SubDiagnostic {
866879 level : Level :: Note ,
867880 message : vec ! [
868- ( "this error originates in a macro outside of the current crate \
869- (in Nightly builds, run with -Z external-macro-backtrace \
870- for more info)". to_string( ) ,
881+ ( msg,
871882 Style :: NoStyle ) ,
872883 ] ,
873884 span : MultiSpan :: new ( ) ,
0 commit comments