about summary refs log tree commit diff
path: root/compiler/rustc_parse/src/errors.rs
diff options
context:
space:
mode:
authorLieselotte <52315535+she3py@users.noreply.github.com>2024-01-03 15:27:58 +0100
committerLieselotte <52315535+she3py@users.noreply.github.com>2024-01-03 15:27:58 +0100
commit4e0baddbbf1a6ceadda28f2eb7edc188822942f3 (patch)
tree9c5fab2d6c7cd2a9c2be4312ac28dbb238ac5337 /compiler/rustc_parse/src/errors.rs
parente51e98dde6a60637b6a71b8105245b629ac3fe77 (diff)
downloadrust-4e0baddbbf1a6ceadda28f2eb7edc188822942f3.tar.gz
rust-4e0baddbbf1a6ceadda28f2eb7edc188822942f3.zip
Recover parentheses in range patterns
Co-authored-by: León Orell Valerian Liehr <me@fmease.dev>
Diffstat (limited to 'compiler/rustc_parse/src/errors.rs')
-rw-r--r--compiler/rustc_parse/src/errors.rs21
1 files changed, 21 insertions, 0 deletions
diff --git a/compiler/rustc_parse/src/errors.rs b/compiler/rustc_parse/src/errors.rs
index e276b34ca37..d67ae149344 100644
--- a/compiler/rustc_parse/src/errors.rs
+++ b/compiler/rustc_parse/src/errors.rs
@@ -2379,6 +2379,27 @@ pub(crate) struct ExpectedCommaAfterPatternField {
 }
 
 #[derive(Diagnostic)]
+#[diag(parse_unexpected_paren_in_range_pat)]
+pub(crate) struct UnexpectedParenInRangePat {
+    #[primary_span]
+    pub span: Vec<Span>,
+    #[subdiagnostic]
+    pub sugg: UnexpectedParenInRangePatSugg,
+}
+
+#[derive(Subdiagnostic)]
+#[multipart_suggestion(
+    parse_unexpected_paren_in_range_pat_sugg,
+    applicability = "machine-applicable"
+)]
+pub(crate) struct UnexpectedParenInRangePatSugg {
+    #[suggestion_part(code = "")]
+    pub start_span: Span,
+    #[suggestion_part(code = "")]
+    pub end_span: Span,
+}
+
+#[derive(Diagnostic)]
 #[diag(parse_return_types_use_thin_arrow)]
 pub(crate) struct ReturnTypesUseThinArrow {
     #[primary_span]