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.)
This commit is contained in:
Nicholas Nethercote 2024-02-16 06:07:49 +11:00
parent f8131a48a4
commit b38ed1afa6
10 changed files with 24 additions and 31 deletions

View file

@ -446,7 +446,7 @@ pub fn format_interp_error<'tcx>(dcx: &DiagCtxt, e: InterpErrorInfo<'tcx>) -> St
let mut diag = dcx.struct_allow("");
let msg = e.diagnostic_message();
e.add_args(&mut diag);
let s = dcx.eagerly_translate_to_string(msg, diag.args());
let s = dcx.eagerly_translate_to_string(msg, diag.args.iter());
diag.cancel();
s
}