@@ -1002,11 +1002,12 @@ pub struct CguMessage;
10021002// A cut-down version of `rustc_errors::Diagnostic` that impls `Send`, which
10031003// can be used to send diagnostics from codegen threads to the main thread.
10041004// It's missing the following fields from `rustc_errors::Diagnostic`.
1005- // - `span`: because `MultiSpan` doesn't impl `Send`.
1006- // - `suggestions`: because it doesn't impl `Send`, and is not worth the complexity.
1007- // - `sort_span`: because `Span` doesn't impl `Send`.
1008- // - `is_lint`: because lints aren't relevant during codegen.
1009- // - `emitted_at`: not worth the complexity.
1005+ // - `span`: it doesn't impl `Send`.
1006+ // - `suggestions`: it doesn't impl `Send`, and isn't used for codegen
1007+ // diagnostics.
1008+ // - `sort_span`: it doesn't impl `Send`.
1009+ // - `is_lint`: lints aren't relevant during codegen.
1010+ // - `emitted_at`: not used for codegen diagnostics.
10101011struct Diagnostic {
10111012 level : Level ,
10121013 messages : Vec < ( DiagnosticMessage , Style ) > ,
@@ -1017,7 +1018,7 @@ struct Diagnostic {
10171018
10181019// A cut-down version of `rustc_errors::SubDiagnostic` that impls `Send`. It's
10191020// missing the following fields from `rustc_errors::SubDiagnostic`.
1020- // - `span`: because `MultiSpan` doesn't impl `Send`.
1021+ // - `span`: it doesn't impl `Send`.
10211022pub struct Subdiagnostic {
10221023 level : Level ,
10231024 messages : Vec < ( DiagnosticMessage , Style ) > ,
@@ -1783,7 +1784,6 @@ fn spawn_work<'a, B: ExtraBackendMethods>(
17831784enum SharedEmitterMessage {
17841785 Diagnostic ( Diagnostic ) ,
17851786 InlineAsmError ( u32 , String , Level , Option < ( String , Vec < InnerSpan > ) > ) ,
1786- AbortIfErrors ,
17871787 Fatal ( String ) ,
17881788}
17891789
@@ -1852,7 +1852,6 @@ impl Emitter for SharedEmitter {
18521852 args,
18531853 } ) ) ,
18541854 ) ;
1855- drop ( self . sender . send ( SharedEmitterMessage :: AbortIfErrors ) ) ;
18561855 }
18571856
18581857 fn source_map ( & self ) -> Option < & Lrc < SourceMap > > {
@@ -1894,6 +1893,7 @@ impl SharedEmitterMain {
18941893 . collect ( ) ;
18951894 d. args = diag. args ;
18961895 dcx. emit_diagnostic ( d) ;
1896+ sess. dcx ( ) . abort_if_errors ( ) ;
18971897 }
18981898 Ok ( SharedEmitterMessage :: InlineAsmError ( cookie, msg, level, source) ) => {
18991899 assert ! ( matches!( level, Level :: Error | Level :: Warning | Level :: Note ) ) ;
@@ -1926,9 +1926,6 @@ impl SharedEmitterMain {
19261926
19271927 err. emit ( ) ;
19281928 }
1929- Ok ( SharedEmitterMessage :: AbortIfErrors ) => {
1930- sess. dcx ( ) . abort_if_errors ( ) ;
1931- }
19321929 Ok ( SharedEmitterMessage :: Fatal ( msg) ) => {
19331930 sess. dcx ( ) . fatal ( msg) ;
19341931 }
0 commit comments