Skip to content

Commit 514a5d8

Browse files
committed
Remove the second lifetime from DiagnosticArg.
Because it's always static. I'm surprised the compiler allowed this unused lifetime without any complaint.
1 parent f0426b7 commit 514a5d8

File tree

3 files changed

+5
-5
lines changed

3 files changed

+5
-5
lines changed

compiler/rustc_errors/src/diagnostic.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ 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> = (&'iter DiagnosticArgName, &'iter DiagnosticArgValue);
26+
pub type DiagnosticArg<'iter> = (&'iter DiagnosticArgName, &'iter DiagnosticArgValue);
2727

2828
/// Name of a diagnostic argument.
2929
pub type DiagnosticArgName = Cow<'static, str>;
@@ -909,7 +909,7 @@ impl Diagnostic {
909909
// Exact iteration order of diagnostic arguments shouldn't make a difference to output because
910910
// they're only used in interpolation.
911911
#[allow(rustc::potential_query_instability)]
912-
pub fn args(&self) -> impl Iterator<Item = DiagnosticArg<'_, 'static>> {
912+
pub fn args(&self) -> impl Iterator<Item = DiagnosticArg<'_>> {
913913
self.args.iter()
914914
}
915915

compiler/rustc_errors/src/lib.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -628,7 +628,7 @@ impl DiagCtxt {
628628
pub fn eagerly_translate<'a>(
629629
&self,
630630
message: DiagnosticMessage,
631-
args: impl Iterator<Item = DiagnosticArg<'a, 'static>>,
631+
args: impl Iterator<Item = DiagnosticArg<'a>>,
632632
) -> SubdiagnosticMessage {
633633
SubdiagnosticMessage::Eager(Cow::from(self.eagerly_translate_to_string(message, args)))
634634
}
@@ -637,7 +637,7 @@ impl DiagCtxt {
637637
pub fn eagerly_translate_to_string<'a>(
638638
&self,
639639
message: DiagnosticMessage,
640-
args: impl Iterator<Item = DiagnosticArg<'a, 'static>>,
640+
args: impl Iterator<Item = DiagnosticArg<'a>>,
641641
) -> String {
642642
let inner = self.inner.borrow();
643643
let args = crate::translation::to_fluent_args(args);

compiler/rustc_errors/src/translation.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ use std::error::Report;
1313
/// Typically performed once for each diagnostic at the start of `emit_diagnostic` and then
1414
/// passed around as a reference thereafter.
1515
pub fn to_fluent_args<'iter>(
16-
iter: impl Iterator<Item = DiagnosticArg<'iter, 'static>>,
16+
iter: impl Iterator<Item = DiagnosticArg<'iter>>,
1717
) -> FluentArgs<'static> {
1818
let mut args = if let Some(size) = iter.size_hint().1 {
1919
FluentArgs::with_capacity(size)

0 commit comments

Comments
 (0)