@@ -24,17 +24,17 @@ use std::thread::panicking;
24
24
pub struct SuggestionsDisabled ;
25
25
26
26
/// 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 ) ;
30
30
31
31
/// Name of a diagnostic argument.
32
- pub type DiagnosticArgName = Cow < ' static , str > ;
32
+ pub type DiagArgName = Cow < ' static , str > ;
33
33
34
34
/// Simplified version of `FluentValue` that can implement `Encodable` and `Decodable`. Converted
35
35
/// to a `FluentValue` by the emitter to be used in diagnostic translation.
36
36
#[ derive( Clone , Debug , PartialEq , Eq , Hash , Encodable , Decodable ) ]
37
- pub enum DiagnosticArgValue {
37
+ pub enum DiagArgValue {
38
38
Str ( Cow < ' static , str > ) ,
39
39
// This gets converted to a `FluentNumber`, which is an `f64`. An `i32`
40
40
// safely fits in an `f64`. Any integers bigger than that will be converted
@@ -43,7 +43,7 @@ pub enum DiagnosticArgValue {
43
43
StrListSepByAnd ( Vec < Cow < ' static , str > > ) ,
44
44
}
45
45
46
- pub type DiagnosticArgMap = FxIndexMap < DiagnosticArgName , DiagnosticArgValue > ;
46
+ pub type DiagArgMap = FxIndexMap < DiagArgName , DiagArgValue > ;
47
47
48
48
/// Trait for types that `Diag::emit` can return as a "guarantee" (or "proof")
49
49
/// token that the emission happened.
@@ -125,26 +125,26 @@ where
125
125
}
126
126
}
127
127
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.
132
132
pub trait IntoDiagnosticArg {
133
- fn into_diagnostic_arg ( self ) -> DiagnosticArgValue ;
133
+ fn into_diagnostic_arg ( self ) -> DiagArgValue ;
134
134
}
135
135
136
- impl IntoDiagnosticArg for DiagnosticArgValue {
137
- fn into_diagnostic_arg ( self ) -> DiagnosticArgValue {
136
+ impl IntoDiagnosticArg for DiagArgValue {
137
+ fn into_diagnostic_arg ( self ) -> DiagArgValue {
138
138
self
139
139
}
140
140
}
141
141
142
- impl Into < FluentValue < ' static > > for DiagnosticArgValue {
142
+ impl Into < FluentValue < ' static > > for DiagArgValue {
143
143
fn into ( self ) -> FluentValue < ' static > {
144
144
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) ,
148
148
}
149
149
}
150
150
}
@@ -277,7 +277,7 @@ pub struct DiagInner {
277
277
pub span : MultiSpan ,
278
278
pub children : Vec < Subdiag > ,
279
279
pub suggestions : Result < Vec < CodeSuggestion > , SuggestionsDisabled > ,
280
- pub args : DiagnosticArgMap ,
280
+ pub args : DiagArgMap ,
281
281
282
282
/// This is not used for highlighting or rendering any error message. Rather, it can be used
283
283
/// as a sort key to sort a buffer of diagnostics. By default, it is the primary span of
@@ -401,7 +401,7 @@ impl DiagInner {
401
401
self . children . push ( sub) ;
402
402
}
403
403
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 ) {
405
405
self . args . insert ( name. into ( ) , arg. into_diagnostic_arg ( ) ) ;
406
406
}
407
407
@@ -415,7 +415,7 @@ impl DiagInner {
415
415
& MultiSpan ,
416
416
& [ Subdiag ] ,
417
417
& Result < Vec < CodeSuggestion > , SuggestionsDisabled > ,
418
- Vec < ( & DiagnosticArgName , & DiagnosticArgValue ) > ,
418
+ Vec < ( & DiagArgName , & DiagArgValue ) > ,
419
419
& Option < IsLint > ,
420
420
) {
421
421
(
@@ -1193,7 +1193,7 @@ impl<'a, G: EmissionGuarantee> Diag<'a, G> {
1193
1193
/// Add an argument.
1194
1194
pub fn arg(
1195
1195
& mut self ,
1196
- name: impl Into <DiagnosticArgName >,
1196
+ name: impl Into <DiagArgName >,
1197
1197
arg: impl IntoDiagnosticArg ,
1198
1198
) -> & mut Self {
1199
1199
self . deref_mut( ) . arg( name, arg) ;
0 commit comments