diff options
| author | Nicholas Nethercote <n.nethercote@gmail.com> | 2024-01-30 16:04:03 +1100 |
|---|---|---|
| committer | Nicholas Nethercote <n.nethercote@gmail.com> | 2024-01-30 18:46:08 +1100 |
| commit | f0426b77fc1f4bc170ababce990c88565310eb26 (patch) | |
| tree | b16f02c8c20330f8f6d00e9541bc716ab78c8edc | |
| parent | 06aa381adbd5bac561c57dc6fc0390da8ec45b69 (diff) | |
| download | rust-f0426b77fc1f4bc170ababce990c88565310eb26.tar.gz rust-f0426b77fc1f4bc170ababce990c88565310eb26.zip | |
Remove the lifetime from `DiagnosticArgName`.
Because it's always 'static.
| -rw-r--r-- | compiler/rustc_codegen_ssa/src/back/write.rs | 2 | ||||
| -rw-r--r-- | compiler/rustc_errors/src/diagnostic.rs | 12 |
2 files changed, 5 insertions, 9 deletions
diff --git a/compiler/rustc_codegen_ssa/src/back/write.rs b/compiler/rustc_codegen_ssa/src/back/write.rs index 562359a6b39..06edb794537 100644 --- a/compiler/rustc_codegen_ssa/src/back/write.rs +++ b/compiler/rustc_codegen_ssa/src/back/write.rs @@ -1000,7 +1000,7 @@ pub struct CguMessage; struct Diagnostic { msgs: Vec<(DiagnosticMessage, Style)>, - args: FxHashMap<DiagnosticArgName<'static>, DiagnosticArgValue>, + args: FxHashMap<DiagnosticArgName, DiagnosticArgValue>, code: Option<ErrCode>, lvl: Level, } diff --git a/compiler/rustc_errors/src/diagnostic.rs b/compiler/rustc_errors/src/diagnostic.rs index b3a4e1c5843..0ce20fda27f 100644 --- a/compiler/rustc_errors/src/diagnostic.rs +++ b/compiler/rustc_errors/src/diagnostic.rs @@ -23,11 +23,10 @@ pub struct SuggestionsDisabled; /// Simplified version of `FluentArg` that can implement `Encodable` and `Decodable`. Collection of /// `DiagnosticArg` are converted to `FluentArgs` (consuming the collection) at the start of /// diagnostic emission. -pub type DiagnosticArg<'iter, 'source> = - (&'iter DiagnosticArgName<'source>, &'iter DiagnosticArgValue); +pub type DiagnosticArg<'iter, 'source> = (&'iter DiagnosticArgName, &'iter DiagnosticArgValue); /// Name of a diagnostic argument. -pub type DiagnosticArgName<'source> = Cow<'source, str>; +pub type DiagnosticArgName = Cow<'static, str>; /// Simplified version of `FluentValue` that can implement `Encodable` and `Decodable`. Converted /// to a `FluentValue` by the emitter to be used in diagnostic translation. @@ -103,7 +102,7 @@ pub struct Diagnostic { pub span: MultiSpan, pub children: Vec<SubDiagnostic>, pub suggestions: Result<Vec<CodeSuggestion>, SuggestionsDisabled>, - args: FxHashMap<DiagnosticArgName<'static>, DiagnosticArgValue>, + args: FxHashMap<DiagnosticArgName, DiagnosticArgValue>, /// This is not used for highlighting or rendering any error message. Rather, it can be used /// as a sort key to sort a buffer of diagnostics. By default, it is the primary span of @@ -923,10 +922,7 @@ impl Diagnostic { self } - pub fn replace_args( - &mut self, - args: FxHashMap<DiagnosticArgName<'static>, DiagnosticArgValue>, - ) { + pub fn replace_args(&mut self, args: FxHashMap<DiagnosticArgName, DiagnosticArgValue>) { self.args = args; } |
