about summary refs log tree commit diff
path: root/compiler/rustc_codegen_ssa/src
diff options
context:
space:
mode:
authorNicholas Nethercote <n.nethercote@gmail.com>2024-02-16 06:07:49 +1100
committerNicholas Nethercote <n.nethercote@gmail.com>2024-02-22 12:51:05 +1100
commitb38ed1afa6cae65e5895f419ab8af98bdf5af840 (patch)
tree366bdab311fc7b656ce052d36e63f198510b55cd /compiler/rustc_codegen_ssa/src
parentf8131a48a46ac3bc8a3d0fe0477055b132cffdc3 (diff)
downloadrust-b38ed1afa6cae65e5895f419ab8af98bdf5af840.tar.gz
rust-b38ed1afa6cae65e5895f419ab8af98bdf5af840.zip
Overhaul `Diagnostic` args.
First, introduce a typedef `DiagnosticArgMap`.

Second, make the `args` field public, and remove the `args` getter and
`replace_args` setter. These were necessary previously because the getter
had a `#[allow(rustc::potential_query_instability)]` attribute, but that
was removed in #120931 when the args were changed from `FxHashMap` to
`FxIndexMap`. (All the other `Diagnostic` fields are public.)
Diffstat (limited to 'compiler/rustc_codegen_ssa/src')
-rw-r--r--compiler/rustc_codegen_ssa/src/back/write.rs12
1 files changed, 6 insertions, 6 deletions
diff --git a/compiler/rustc_codegen_ssa/src/back/write.rs b/compiler/rustc_codegen_ssa/src/back/write.rs
index 7a981217b52..0258d1d493d 100644
--- a/compiler/rustc_codegen_ssa/src/back/write.rs
+++ b/compiler/rustc_codegen_ssa/src/back/write.rs
@@ -16,8 +16,8 @@ use rustc_data_structures::sync::Lrc;
 use rustc_errors::emitter::Emitter;
 use rustc_errors::translation::Translate;
 use rustc_errors::{
-    DiagCtxt, DiagnosticArgName, DiagnosticArgValue, DiagnosticBuilder, DiagnosticMessage, ErrCode,
-    FatalError, FluentBundle, Level, Style,
+    DiagCtxt, DiagnosticArgMap, DiagnosticBuilder, DiagnosticMessage, ErrCode, FatalError,
+    FluentBundle, Level, Style,
 };
 use rustc_fs_util::link_or_copy;
 use rustc_hir::def_id::{CrateNum, LOCAL_CRATE};
@@ -1001,7 +1001,7 @@ pub struct CguMessage;
 
 struct Diagnostic {
     msgs: Vec<(DiagnosticMessage, Style)>,
-    args: FxIndexMap<DiagnosticArgName, DiagnosticArgValue>,
+    args: DiagnosticArgMap,
     code: Option<ErrCode>,
     lvl: Level,
 }
@@ -1813,8 +1813,8 @@ impl Translate for SharedEmitter {
 
 impl Emitter for SharedEmitter {
     fn emit_diagnostic(&mut self, diag: rustc_errors::Diagnostic) {
-        let args: FxIndexMap<DiagnosticArgName, DiagnosticArgValue> =
-            diag.args().map(|(name, arg)| (name.clone(), arg.clone())).collect();
+        let args: DiagnosticArgMap =
+            diag.args.iter().map(|(name, arg)| (name.clone(), arg.clone())).collect();
         drop(self.sender.send(SharedEmitterMessage::Diagnostic(Diagnostic {
             msgs: diag.messages.clone(),
             args: args.clone(),
@@ -1857,7 +1857,7 @@ impl SharedEmitterMain {
                     let dcx = sess.dcx();
                     let mut d = rustc_errors::Diagnostic::new_with_messages(diag.lvl, diag.msgs);
                     d.code = diag.code; // may be `None`, that's ok
-                    d.replace_args(diag.args);
+                    d.args = diag.args;
                     dcx.emit_diagnostic(d);
                 }
                 Ok(SharedEmitterMessage::InlineAsmError(cookie, msg, level, source)) => {