diff --git a/compiler/rustc_errors/src/diagnostic_impls.rs b/compiler/rustc_errors/src/diagnostic_impls.rs index 0af80bc5c67..e6ca1bf7bc4 100644 --- a/compiler/rustc_errors/src/diagnostic_impls.rs +++ b/compiler/rustc_errors/src/diagnostic_impls.rs @@ -298,15 +298,21 @@ fn into_diag_arg(self) -> DiagArgValue { } #[derive(Clone)] -pub struct DiagSymbolList(Vec); +pub struct DiagSymbolList(Vec); -impl From> for DiagSymbolList { - fn from(v: Vec) -> Self { +impl From> for DiagSymbolList { + fn from(v: Vec) -> Self { DiagSymbolList(v) } } -impl IntoDiagArg for DiagSymbolList { +impl FromIterator for DiagSymbolList { + fn from_iter>(iter: T) -> Self { + iter.into_iter().collect::>().into() + } +} + +impl IntoDiagArg for DiagSymbolList { fn into_diag_arg(self) -> DiagArgValue { DiagArgValue::StrListSepByAnd( self.0.into_iter().map(|sym| Cow::Owned(format!("`{sym}`"))).collect(),