@@ -24,17 +24,17 @@ use std::thread::panicking;
2424pub struct SuggestionsDisabled ;
2525
2626/// Simplified version of `FluentArg` that can implement `Encodable` and `Decodable`. Collection of
27- /// `DiagnosticArg ` are converted to `FluentArgs` (consuming the collection) at the start of
28- /// diagnostic emission.
29- pub type DiagnosticArg < ' iter > = ( & ' iter DiagnosticArgName , & ' iter DiagnosticArgValue ) ;
27+ /// `DiagArg ` are converted to `FluentArgs` (consuming the collection) at the start of diagnostic
28+ /// emission.
29+ pub type DiagArg < ' iter > = ( & ' iter DiagArgName , & ' iter DiagArgValue ) ;
3030
3131/// Name of a diagnostic argument.
32- pub type DiagnosticArgName = Cow < ' static , str > ;
32+ pub type DiagArgName = Cow < ' static , str > ;
3333
3434/// Simplified version of `FluentValue` that can implement `Encodable` and `Decodable`. Converted
3535/// to a `FluentValue` by the emitter to be used in diagnostic translation.
3636#[ derive( Clone , Debug , PartialEq , Eq , Hash , Encodable , Decodable ) ]
37- pub enum DiagnosticArgValue {
37+ pub enum DiagArgValue {
3838 Str ( Cow < ' static , str > ) ,
3939 // This gets converted to a `FluentNumber`, which is an `f64`. An `i32`
4040 // safely fits in an `f64`. Any integers bigger than that will be converted
@@ -43,7 +43,7 @@ pub enum DiagnosticArgValue {
4343 StrListSepByAnd ( Vec < Cow < ' static , str > > ) ,
4444}
4545
46- pub type DiagnosticArgMap = FxIndexMap < DiagnosticArgName , DiagnosticArgValue > ;
46+ pub type DiagArgMap = FxIndexMap < DiagArgName , DiagArgValue > ;
4747
4848/// Trait for types that `Diag::emit` can return as a "guarantee" (or "proof")
4949/// token that the emission happened.
@@ -125,26 +125,26 @@ where
125125 }
126126}
127127
128- /// Converts a value of a type into a `DiagnosticArg ` (typically a field of an `IntoDiagnostic`
129- /// struct). Implemented as a custom trait rather than `From` so that it is implemented on the type
130- /// being converted rather than on `DiagnosticArgValue `, which enables types from other `rustc_*`
131- /// crates to implement this.
128+ /// Converts a value of a type into a `DiagArg ` (typically a field of an `IntoDiagnostic` struct).
129+ /// Implemented as a custom trait rather than `From` so that it is implemented on the type being
130+ /// converted rather than on `DiagArgValue `, which enables types from other `rustc_*` crates to
131+ /// implement this.
132132pub trait IntoDiagnosticArg {
133- fn into_diagnostic_arg ( self ) -> DiagnosticArgValue ;
133+ fn into_diagnostic_arg ( self ) -> DiagArgValue ;
134134}
135135
136- impl IntoDiagnosticArg for DiagnosticArgValue {
137- fn into_diagnostic_arg ( self ) -> DiagnosticArgValue {
136+ impl IntoDiagnosticArg for DiagArgValue {
137+ fn into_diagnostic_arg ( self ) -> DiagArgValue {
138138 self
139139 }
140140}
141141
142- impl Into < FluentValue < ' static > > for DiagnosticArgValue {
142+ impl Into < FluentValue < ' static > > for DiagArgValue {
143143 fn into ( self ) -> FluentValue < ' static > {
144144 match self {
145- DiagnosticArgValue :: Str ( s) => From :: from ( s) ,
146- DiagnosticArgValue :: Number ( n) => From :: from ( n) ,
147- DiagnosticArgValue :: StrListSepByAnd ( l) => fluent_value_from_str_list_sep_by_and ( l) ,
145+ DiagArgValue :: Str ( s) => From :: from ( s) ,
146+ DiagArgValue :: Number ( n) => From :: from ( n) ,
147+ DiagArgValue :: StrListSepByAnd ( l) => fluent_value_from_str_list_sep_by_and ( l) ,
148148 }
149149 }
150150}
@@ -277,7 +277,7 @@ pub struct DiagInner {
277277 pub span : MultiSpan ,
278278 pub children : Vec < Subdiag > ,
279279 pub suggestions : Result < Vec < CodeSuggestion > , SuggestionsDisabled > ,
280- pub args : DiagnosticArgMap ,
280+ pub args : DiagArgMap ,
281281
282282 /// This is not used for highlighting or rendering any error message. Rather, it can be used
283283 /// as a sort key to sort a buffer of diagnostics. By default, it is the primary span of
@@ -401,7 +401,7 @@ impl DiagInner {
401401 self . children . push ( sub) ;
402402 }
403403
404- pub ( crate ) fn arg ( & mut self , name : impl Into < DiagnosticArgName > , arg : impl IntoDiagnosticArg ) {
404+ pub ( crate ) fn arg ( & mut self , name : impl Into < DiagArgName > , arg : impl IntoDiagnosticArg ) {
405405 self . args . insert ( name. into ( ) , arg. into_diagnostic_arg ( ) ) ;
406406 }
407407
@@ -415,7 +415,7 @@ impl DiagInner {
415415 & MultiSpan ,
416416 & [ Subdiag ] ,
417417 & Result < Vec < CodeSuggestion > , SuggestionsDisabled > ,
418- Vec < ( & DiagnosticArgName , & DiagnosticArgValue ) > ,
418+ Vec < ( & DiagArgName , & DiagArgValue ) > ,
419419 & Option < IsLint > ,
420420 ) {
421421 (
@@ -1193,7 +1193,7 @@ impl<'a, G: EmissionGuarantee> Diag<'a, G> {
11931193 /// Add an argument.
11941194 pub fn arg(
11951195 & mut self ,
1196- name: impl Into <DiagnosticArgName >,
1196+ name: impl Into <DiagArgName >,
11971197 arg: impl IntoDiagnosticArg ,
11981198 ) -> & mut Self {
11991199 self . deref_mut( ) . arg( name, arg) ;
0 commit comments