From 5ade46246e89e7c4bc574d971e9b0a525f16d943 Mon Sep 17 00:00:00 2001 From: Jonathan Brouwer Date: Sat, 28 Feb 2026 19:30:55 +0100 Subject: [PATCH] Move `DiagArgMap` to `rustc_error_messages` --- compiler/rustc_error_messages/src/lib.rs | 3 +++ compiler/rustc_errors/src/diagnostic.rs | 5 +---- compiler/rustc_errors/src/lib.rs | 6 +++--- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/compiler/rustc_error_messages/src/lib.rs b/compiler/rustc_error_messages/src/lib.rs index a2807c852632..cf194ea6bbc4 100644 --- a/compiler/rustc_error_messages/src/lib.rs +++ b/compiler/rustc_error_messages/src/lib.rs @@ -13,6 +13,7 @@ mod diagnostic_impls; pub use diagnostic_impls::DiagArgFromDisplay; +use rustc_data_structures::fx::FxIndexMap; pub fn register_functions(bundle: &mut fluent_bundle::bundle::FluentBundle) { bundle @@ -310,6 +311,8 @@ pub enum DiagArgValue { StrListSepByAnd(Vec>), } +pub type DiagArgMap = FxIndexMap; + /// Converts a value of a type into a `DiagArg` (typically a field of an `Diag` struct). /// Implemented as a custom trait rather than `From` so that it is implemented on the type being /// converted rather than on `DiagArgValue`, which enables types from other `rustc_*` crates to diff --git a/compiler/rustc_errors/src/diagnostic.rs b/compiler/rustc_errors/src/diagnostic.rs index 41005d12a191..27a70534c5bc 100644 --- a/compiler/rustc_errors/src/diagnostic.rs +++ b/compiler/rustc_errors/src/diagnostic.rs @@ -7,8 +7,7 @@ use std::path::PathBuf; use std::thread::panicking; -use rustc_data_structures::fx::FxIndexMap; -use rustc_error_messages::{DiagArgName, DiagArgValue, IntoDiagArg}; +use rustc_error_messages::{DiagArgMap, DiagArgName, DiagArgValue, IntoDiagArg}; use rustc_lint_defs::{Applicability, LintExpectationId}; use rustc_macros::{Decodable, Encodable}; use rustc_span::source_map::Spanned; @@ -20,8 +19,6 @@ MultiSpan, StashKey, Style, Substitution, SubstitutionPart, SuggestionStyle, Suggestions, }; -pub type DiagArgMap = FxIndexMap; - /// Trait for types that `Diag::emit` can return as a "guarantee" (or "proof") /// token that the emission happened. pub trait EmissionGuarantee: Sized { diff --git a/compiler/rustc_errors/src/lib.rs b/compiler/rustc_errors/src/lib.rs index 0386ce9eed95..bc8e7af7fd5a 100644 --- a/compiler/rustc_errors/src/lib.rs +++ b/compiler/rustc_errors/src/lib.rs @@ -39,8 +39,8 @@ pub use codes::*; pub use decorate_diag::{BufferedEarlyLint, DecorateDiagCompat, LintBuffer}; pub use diagnostic::{ - BugAbort, Diag, DiagArgMap, DiagInner, DiagStyledString, Diagnostic, EmissionGuarantee, - FatalAbort, LintDiagnostic, LintDiagnosticBox, StringPart, Subdiag, Subdiagnostic, + BugAbort, Diag, DiagInner, DiagStyledString, Diagnostic, EmissionGuarantee, FatalAbort, + LintDiagnostic, LintDiagnosticBox, StringPart, Subdiag, Subdiagnostic, }; pub use diagnostic_impls::{ DiagSymbolList, ElidedLifetimeInPathSubdiag, ExpectedLifetimeParameter, @@ -53,7 +53,7 @@ use rustc_data_structures::sync::{DynSend, Lock}; use rustc_data_structures::{AtomicRef, assert_matches}; pub use rustc_error_messages::{ - DiagArg, DiagArgFromDisplay, DiagArgName, DiagArgValue, DiagMessage, IntoDiagArg, + DiagArg, DiagArgFromDisplay, DiagArgMap, DiagArgName, DiagArgValue, DiagMessage, IntoDiagArg, LanguageIdentifier, MultiSpan, SpanLabel, fluent_bundle, into_diag_arg_using_display, }; use rustc_hashes::Hash128;