1
Fork 0

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

@ -341,7 +341,7 @@ struct UnusedExterns<'a, 'b, 'c> {
impl Diagnostic {
fn from_errors_diagnostic(diag: crate::Diagnostic, je: &JsonEmitter) -> Diagnostic {
let args = to_fluent_args(diag.args());
let args = to_fluent_args(diag.args.iter());
let sugg = diag.suggestions.iter().flatten().map(|sugg| {
let translated_message =
je.translate_message(&sugg.msg, &args).map_err(Report::new).unwrap();