@@ -6,6 +6,7 @@ use crate::{
6
6
Level , CodeSuggestion , DiagnosticBuilder , SubDiagnostic ,
7
7
SuggestionStyle , SourceMapperDyn , DiagnosticId ,
8
8
} ;
9
+ use crate :: Level :: Error ;
9
10
use crate :: snippet:: { Annotation , AnnotationType , Line , MultilineAnnotation , StyledString , Style } ;
10
11
use crate :: styled_buffer:: StyledBuffer ;
11
12
@@ -72,6 +73,7 @@ impl Emitter for EmitterWriter {
72
73
73
74
self . fix_multispans_in_std_macros ( & mut primary_span,
74
75
& mut children,
76
+ & db. level ,
75
77
db. handler . flags . external_macro_backtrace ) ;
76
78
77
79
self . emit_messages_default ( & db. level ,
@@ -888,18 +890,27 @@ impl EmitterWriter {
888
890
fn fix_multispans_in_std_macros ( & mut self ,
889
891
span : & mut MultiSpan ,
890
892
children : & mut Vec < SubDiagnostic > ,
893
+ level : & Level ,
891
894
backtrace : bool ) {
892
895
let mut spans_updated = self . fix_multispan_in_std_macros ( span, backtrace) ;
893
896
for child in children. iter_mut ( ) {
894
897
spans_updated |= self . fix_multispan_in_std_macros ( & mut child. span , backtrace) ;
895
898
}
899
+ let msg = if level == & Error {
900
+ "this error originates in a macro outside of the current crate \
901
+ (in Nightly builds, run with -Z external-macro-backtrace \
902
+ for more info)". to_string ( )
903
+ } else {
904
+ "this warning originates in a macro outside of the current crate \
905
+ (in Nightly builds, run with -Z external-macro-backtrace \
906
+ for more info)". to_string ( )
907
+ } ;
908
+
896
909
if spans_updated {
897
910
children. push ( SubDiagnostic {
898
911
level : Level :: Note ,
899
912
message : vec ! [
900
- ( "this error originates in a macro outside of the current crate \
901
- (in Nightly builds, run with -Z external-macro-backtrace \
902
- for more info)". to_string( ) ,
913
+ ( msg,
903
914
Style :: NoStyle ) ,
904
915
] ,
905
916
span : MultiSpan :: new ( ) ,
0 commit comments