about summary refs log tree commit diff
path: root/compiler/rustc_codegen_ssa/src/back
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2023-12-23 04:09:45 +0000
committerbors <bors@rust-lang.org>2023-12-23 04:09:45 +0000
commitc03d978a4bcb7c01d8cdf80bd7600b27e2d21588 (patch)
treead0c5d00194aa5bb53375d28a77f3a3077aaa980 /compiler/rustc_codegen_ssa/src/back
parent495203bf61efabecc2c460be38e1eb0f9952601b (diff)
parent8c50e3eaeef34470a80f099feb2cbbdba2e7d61f (diff)
downloadrust-c03d978a4bcb7c01d8cdf80bd7600b27e2d21588.tar.gz
rust-c03d978a4bcb7c01d8cdf80bd7600b27e2d21588.zip
Auto merge of #119237 - compiler-errors:rollup-umyyu7d, r=compiler-errors
Rollup of 6 pull requests

Successful merges:

 - #119012 (Extract `layout_of_{struct,enum}` fn)
 - #119077 (Separate MIR lints from validation)
 - #119171 (Cleanup error handlers: round 4)
 - #119198 (Split coroutine desugaring kind from source)
 - #119222 (Add `IntoAsyncIterator`)
 - #119230 (Exhaustiveness: clean up after librarification)

r? `@ghost`
`@rustbot` modify labels: rollup
Diffstat (limited to 'compiler/rustc_codegen_ssa/src/back')
-rw-r--r--compiler/rustc_codegen_ssa/src/back/write.rs22
1 files changed, 11 insertions, 11 deletions
diff --git a/compiler/rustc_codegen_ssa/src/back/write.rs b/compiler/rustc_codegen_ssa/src/back/write.rs
index 0442bef8a44..53ae085a721 100644
--- a/compiler/rustc_codegen_ssa/src/back/write.rs
+++ b/compiler/rustc_codegen_ssa/src/back/write.rs
@@ -15,7 +15,7 @@ use rustc_data_structures::profiling::{SelfProfilerRef, VerboseTimingGuard};
 use rustc_data_structures::sync::Lrc;
 use rustc_errors::emitter::Emitter;
 use rustc_errors::{translation::Translate, DiagCtxt, DiagnosticId, FatalError, Level};
-use rustc_errors::{DiagnosticMessage, Style};
+use rustc_errors::{DiagnosticBuilder, DiagnosticMessage, Style};
 use rustc_fs_util::link_or_copy;
 use rustc_hir::def_id::{CrateNum, LOCAL_CRATE};
 use rustc_incremental::{
@@ -986,7 +986,7 @@ pub struct CguMessage;
 type DiagnosticArgName<'source> = Cow<'source, str>;
 
 struct Diagnostic {
-    msg: Vec<(DiagnosticMessage, Style)>,
+    msgs: Vec<(DiagnosticMessage, Style)>,
     args: FxHashMap<DiagnosticArgName<'static>, rustc_errors::DiagnosticArgValue<'static>>,
     code: Option<DiagnosticId>,
     lvl: Level,
@@ -1799,14 +1799,14 @@ impl Emitter for SharedEmitter {
         let args: FxHashMap<Cow<'_, str>, rustc_errors::DiagnosticArgValue<'_>> =
             diag.args().map(|(name, arg)| (name.clone(), arg.clone())).collect();
         drop(self.sender.send(SharedEmitterMessage::Diagnostic(Diagnostic {
-            msg: diag.message.clone(),
+            msgs: diag.messages.clone(),
             args: args.clone(),
             code: diag.code.clone(),
             lvl: diag.level(),
         })));
         for child in &diag.children {
             drop(self.sender.send(SharedEmitterMessage::Diagnostic(Diagnostic {
-                msg: child.message.clone(),
+                msgs: child.messages.clone(),
                 args: args.clone(),
                 code: None,
                 lvl: child.level,
@@ -1838,7 +1838,7 @@ impl SharedEmitterMain {
             match message {
                 Ok(SharedEmitterMessage::Diagnostic(diag)) => {
                     let dcx = sess.dcx();
-                    let mut d = rustc_errors::Diagnostic::new_with_messages(diag.lvl, diag.msg);
+                    let mut d = rustc_errors::Diagnostic::new_with_messages(diag.lvl, diag.msgs);
                     if let Some(code) = diag.code {
                         d.code(code);
                     }
@@ -1846,14 +1846,14 @@ impl SharedEmitterMain {
                     dcx.emit_diagnostic(d);
                 }
                 Ok(SharedEmitterMessage::InlineAsmError(cookie, msg, level, source)) => {
-                    let msg = msg.strip_prefix("error: ").unwrap_or(&msg).to_string();
-
-                    let mut err = match level {
-                        Level::Error { lint: false } => sess.struct_err(msg).forget_guarantee(),
-                        Level::Warning(_) => sess.struct_warn(msg),
-                        Level::Note => sess.struct_note(msg),
+                    let err_level = match level {
+                        Level::Error { lint: false } => rustc_errors::Level::Error { lint: false },
+                        Level::Warning(_) => rustc_errors::Level::Warning(None),
+                        Level::Note => rustc_errors::Level::Note,
                         _ => bug!("Invalid inline asm diagnostic level"),
                     };
+                    let msg = msg.strip_prefix("error: ").unwrap_or(&msg).to_string();
+                    let mut err = DiagnosticBuilder::<()>::new(sess.dcx(), err_level, msg);
 
                     // If the cookie is 0 then we don't have span information.
                     if cookie != 0 {