diff options
| author | David Wood <david.wood@huawei.com> | 2022-10-03 14:02:49 +0100 |
|---|---|---|
| committer | David Wood <david.wood@huawei.com> | 2022-10-10 14:20:16 +0100 |
| commit | 508d7e6d26bd636081c96ee6ed61f833917343ea (patch) | |
| tree | e49e445b601f1532a438e10fa1b5a58e3957a484 /compiler/rustc_errors/src/json.rs | |
| parent | febbf71219001cd7948c3d1e5ffa68706896d955 (diff) | |
| download | rust-508d7e6d26bd636081c96ee6ed61f833917343ea.tar.gz rust-508d7e6d26bd636081c96ee6ed61f833917343ea.zip | |
errors: use `HashMap` to store diagnostic args
Eager translation will enable subdiagnostics to be translated multiple times with different arguments - this requires the ability to replace the value of one argument with a new value, which is better suited to a `HashMap` than the previous storage, a `Vec`. Signed-off-by: David Wood <david.wood@huawei.com>
Diffstat (limited to 'compiler/rustc_errors/src/json.rs')
| -rw-r--r-- | compiler/rustc_errors/src/json.rs | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/compiler/rustc_errors/src/json.rs b/compiler/rustc_errors/src/json.rs index 1680c6accd7..4cc7be47fc2 100644 --- a/compiler/rustc_errors/src/json.rs +++ b/compiler/rustc_errors/src/json.rs @@ -13,7 +13,7 @@ use rustc_span::source_map::{FilePathMapping, SourceMap}; use crate::emitter::{Emitter, HumanReadableErrorType}; use crate::registry::Registry; -use crate::translation::Translate; +use crate::translation::{to_fluent_args, Translate}; use crate::DiagnosticId; use crate::{ CodeSuggestion, FluentBundle, LazyFallbackBundle, MultiSpan, SpanLabel, SubDiagnostic, @@ -312,7 +312,7 @@ struct UnusedExterns<'a, 'b, 'c> { impl Diagnostic { fn from_errors_diagnostic(diag: &crate::Diagnostic, je: &JsonEmitter) -> Diagnostic { - let args = je.to_fluent_args(diag.args()); + let args = to_fluent_args(diag.args()); let sugg = diag.suggestions.iter().flatten().map(|sugg| { let translated_message = je.translate_message(&sugg.msg, &args); Diagnostic { |
