about summary refs log tree commit diff
path: root/compiler/rustc_errors/src
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2024-07-08 16:01:38 +0000
committerbors <bors@rust-lang.org>2024-07-08 16:01:38 +0000
commita06e9c83f6bc6b9b69f1b0d9f1ab659f8f03db4d (patch)
tree5cfc3f26bad3ba0c2e488a4ab4902166a3eb7783 /compiler/rustc_errors/src
parentcfd7cf5a0e497c238dcf9947e2eeec01837beeb4 (diff)
parenta659f7a2bcefccb1a945656743a853ca0ac98c67 (diff)
downloadrust-a06e9c83f6bc6b9b69f1b0d9f1ab659f8f03db4d.tar.gz
rust-a06e9c83f6bc6b9b69f1b0d9f1ab659f8f03db4d.zip
Auto merge of #127486 - matthiaskrgr:rollup-lvv018b, r=matthiaskrgr
Rollup of 5 pull requests

Successful merges:

 - #120248 (Make casts of pointers to trait objects stricter)
 - #127355 (Mark format! with must_use hint)
 - #127399 (Verify that allocations output by GVN are sufficiently aligned.)
 - #127460 (clarify `sys::unix::fd::FileDesc::drop` comment)
 - #127467 (bootstrap: once_cell::sync::Lazy -> std::sync::LazyLock)

Failed merges:

 - #127357 (Remove `StructuredDiag`)

r? `@ghost`
`@rustbot` modify labels: rollup
Diffstat (limited to 'compiler/rustc_errors/src')
-rw-r--r--compiler/rustc_errors/src/diagnostic_impls.rs14
1 files changed, 10 insertions, 4 deletions
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 @@ impl IntoDiagArg for hir::def::Namespace {
 }
 
 #[derive(Clone)]
-pub struct DiagSymbolList(Vec<Symbol>);
+pub struct DiagSymbolList<S = Symbol>(Vec<S>);
 
-impl From<Vec<Symbol>> for DiagSymbolList {
-    fn from(v: Vec<Symbol>) -> Self {
+impl<S> From<Vec<S>> for DiagSymbolList<S> {
+    fn from(v: Vec<S>) -> Self {
         DiagSymbolList(v)
     }
 }
 
-impl IntoDiagArg for DiagSymbolList {
+impl<S> FromIterator<S> for DiagSymbolList<S> {
+    fn from_iter<T: IntoIterator<Item = S>>(iter: T) -> Self {
+        iter.into_iter().collect::<Vec<_>>().into()
+    }
+}
+
+impl<S: std::fmt::Display> IntoDiagArg for DiagSymbolList<S> {
     fn into_diag_arg(self) -> DiagArgValue {
         DiagArgValue::StrListSepByAnd(
             self.0.into_iter().map(|sym| Cow::Owned(format!("`{sym}`"))).collect(),