about summary refs log tree commit diff
path: root/compiler/rustc_parse/src/errors.rs
diff options
context:
space:
mode:
authorMichael Goulet <michael@errs.io>2023-11-14 00:13:30 +0000
committerMichael Goulet <michael@errs.io>2023-11-14 00:15:10 +0000
commita8a2ee4e8f5e3c20c826d2cce6d500fb9bedfdd0 (patch)
treedfcc57fff15d17050f1c1bcd5514e1be025b0aa3 /compiler/rustc_parse/src/errors.rs
parent85b84504669c6c779fab7b96fbe5b26635067cd1 (diff)
downloadrust-a8a2ee4e8f5e3c20c826d2cce6d500fb9bedfdd0.tar.gz
rust-a8a2ee4e8f5e3c20c826d2cce6d500fb9bedfdd0.zip
Recover `dyn` and `impl` after `for<...>`
Diffstat (limited to 'compiler/rustc_parse/src/errors.rs')
-rw-r--r--compiler/rustc_parse/src/errors.rs20
1 files changed, 20 insertions, 0 deletions
diff --git a/compiler/rustc_parse/src/errors.rs b/compiler/rustc_parse/src/errors.rs
index 8ab1ec298a1..0a077d40ec7 100644
--- a/compiler/rustc_parse/src/errors.rs
+++ b/compiler/rustc_parse/src/errors.rs
@@ -2828,3 +2828,23 @@ pub(crate) struct GenericArgsInPatRequireTurbofishSyntax {
     )]
     pub suggest_turbofish: Span,
 }
+
+#[derive(Diagnostic)]
+#[diag(parse_transpose_dyn_or_impl)]
+pub(crate) struct TransposeDynOrImpl<'a> {
+    #[primary_span]
+    pub span: Span,
+    pub kw: &'a str,
+    #[subdiagnostic]
+    pub sugg: TransposeDynOrImplSugg<'a>,
+}
+
+#[derive(Subdiagnostic)]
+#[multipart_suggestion(parse_suggestion, applicability = "machine-applicable")]
+pub(crate) struct TransposeDynOrImplSugg<'a> {
+    #[suggestion_part(code = "")]
+    pub removal_span: Span,
+    #[suggestion_part(code = "{kw} ")]
+    pub insertion_span: Span,
+    pub kw: &'a str,
+}