about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
authorGuillaume Gomez <guillaume1.gomez@gmail.com>2022-05-07 15:23:46 +0200
committerGitHub <noreply@github.com>2022-05-07 15:23:46 +0200
commita6441973914de920db875f6968cd9e080ae87a6f (patch)
tree6951fef91a8c952feaade6d021611c9b0b62fc7e /src
parent3346d11f4e8521894377636f145bfc68fad10bea (diff)
parentaf47257c0dfc5b38468417d36a465a613c675d6e (diff)
downloadrust-a6441973914de920db875f6968cd9e080ae87a6f.tar.gz
rust-a6441973914de920db875f6968cd9e080ae87a6f.zip
Rollup merge of #96760 - davidtwco:diagnostic-translation-vec, r=oli-obk
diagnostics: port more diagnostics to derive + add support for `Vec` fields

- Port "unconstrained opaque type" diagnostic to using the derive.
- Allow `Vec` fields in diagnostic derive - enables support for diagnostics that have multiple primary spans, or have subdiagnostics repeated at multiple locations. `Vec<..>` fields in the diagnostic derive become loops in the generated code.
- Add `create_{err,warning}` - there wasn't a way to create a diagnostic from a struct and not emit it straight away.
- Port "explicit generic args w/ impl trait" diagnostic to using the derive.

r? `````@oli-obk`````
cc `````@pvdrz`````
Diffstat (limited to 'src')
-rw-r--r--src/test/ui-fulldeps/session-diagnostic/diagnostic-derive.rs8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/test/ui-fulldeps/session-diagnostic/diagnostic-derive.rs b/src/test/ui-fulldeps/session-diagnostic/diagnostic-derive.rs
index efbf78ac87d..c63410fa35b 100644
--- a/src/test/ui-fulldeps/session-diagnostic/diagnostic-derive.rs
+++ b/src/test/ui-fulldeps/session-diagnostic/diagnostic-derive.rs
@@ -474,3 +474,11 @@ struct Subdiagnostic {
     #[subdiagnostic]
     note: Note,
 }
+
+#[derive(SessionDiagnostic)]
+#[error(code = "E0123", slug = "foo")]
+struct VecField {
+    #[primary_span]
+    #[label]
+    spans: Vec<Span>,
+}