Auto merge of #121129 - nnethercote:codegen-Diags, r=estebank

Improve codegen diagnostic handling

Clarify the workings of the temporary `Diagnostic` type used to send diagnostics from codegen threads to the main thread.

r? `@estebank`
This commit is contained in:
bors 2024-02-22 08:01:37 +00:00
commit f70f19fef4
11 changed files with 81 additions and 56 deletions

View file

@ -37,9 +37,10 @@ extern crate self as rustc_errors;
pub use codes::*;
pub use diagnostic::{
AddToDiagnostic, BugAbort, DecorateLint, Diagnostic, DiagnosticArg, DiagnosticArgName,
DiagnosticArgValue, DiagnosticBuilder, DiagnosticStyledString, EmissionGuarantee, FatalAbort,
IntoDiagnostic, IntoDiagnosticArg, StringPart, SubDiagnostic, SubdiagnosticMessageOp,
AddToDiagnostic, BugAbort, DecorateLint, Diagnostic, DiagnosticArg, DiagnosticArgMap,
DiagnosticArgName, DiagnosticArgValue, DiagnosticBuilder, DiagnosticStyledString,
EmissionGuarantee, FatalAbort, IntoDiagnostic, IntoDiagnosticArg, StringPart, SubDiagnostic,
SubdiagnosticMessageOp,
};
pub use diagnostic_impls::{
DiagnosticArgFromDisplay, DiagnosticSymbolList, ExpectedLifetimeParameter,
@ -1496,9 +1497,8 @@ impl DiagCtxtInner {
diag: &Diagnostic,
msg: impl Into<SubdiagnosticMessage>,
) -> SubdiagnosticMessage {
let args = diag.args();
let msg = diag.subdiagnostic_message_to_diagnostic_message(msg);
self.eagerly_translate(msg, args)
self.eagerly_translate(msg, diag.args.iter())
}
fn flush_delayed(&mut self) {