Skip to content

Commit f0426b7

Browse files
committed
Remove the lifetime from DiagnosticArgName.
Because it's always 'static.
1 parent 06aa381 commit f0426b7

File tree

2 files changed

+5
-9
lines changed

2 files changed

+5
-9
lines changed

compiler/rustc_codegen_ssa/src/back/write.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1000,7 +1000,7 @@ pub struct CguMessage;
10001000

10011001
struct Diagnostic {
10021002
msgs: Vec<(DiagnosticMessage, Style)>,
1003-
args: FxHashMap<DiagnosticArgName<'static>, DiagnosticArgValue>,
1003+
args: FxHashMap<DiagnosticArgName, DiagnosticArgValue>,
10041004
code: Option<ErrCode>,
10051005
lvl: Level,
10061006
}

compiler/rustc_errors/src/diagnostic.rs

+4-8
Original file line numberDiff line numberDiff line change
@@ -23,11 +23,10 @@ pub struct SuggestionsDisabled;
2323
/// Simplified version of `FluentArg` that can implement `Encodable` and `Decodable`. Collection of
2424
/// `DiagnosticArg` are converted to `FluentArgs` (consuming the collection) at the start of
2525
/// diagnostic emission.
26-
pub type DiagnosticArg<'iter, 'source> =
27-
(&'iter DiagnosticArgName<'source>, &'iter DiagnosticArgValue);
26+
pub type DiagnosticArg<'iter, 'source> = (&'iter DiagnosticArgName, &'iter DiagnosticArgValue);
2827

2928
/// Name of a diagnostic argument.
30-
pub type DiagnosticArgName<'source> = Cow<'source, str>;
29+
pub type DiagnosticArgName = Cow<'static, str>;
3130

3231
/// Simplified version of `FluentValue` that can implement `Encodable` and `Decodable`. Converted
3332
/// to a `FluentValue` by the emitter to be used in diagnostic translation.
@@ -103,7 +102,7 @@ pub struct Diagnostic {
103102
pub span: MultiSpan,
104103
pub children: Vec<SubDiagnostic>,
105104
pub suggestions: Result<Vec<CodeSuggestion>, SuggestionsDisabled>,
106-
args: FxHashMap<DiagnosticArgName<'static>, DiagnosticArgValue>,
105+
args: FxHashMap<DiagnosticArgName, DiagnosticArgValue>,
107106

108107
/// This is not used for highlighting or rendering any error message. Rather, it can be used
109108
/// as a sort key to sort a buffer of diagnostics. By default, it is the primary span of
@@ -923,10 +922,7 @@ impl Diagnostic {
923922
self
924923
}
925924

926-
pub fn replace_args(
927-
&mut self,
928-
args: FxHashMap<DiagnosticArgName<'static>, DiagnosticArgValue>,
929-
) {
925+
pub fn replace_args(&mut self, args: FxHashMap<DiagnosticArgName, DiagnosticArgValue>) {
930926
self.args = args;
931927
}
932928

0 commit comments

Comments
 (0)