diff options
| author | Matthias Krüger <matthias.krueger@famsik.de> | 2023-01-29 06:14:20 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2023-01-29 06:14:20 +0100 |
| commit | 4e8f7e4fc9d7849227f96cd55e46c0337c3fc416 (patch) | |
| tree | 879e24873d1bd19b282a2168faedfaf933cab8c0 /compiler/rustc_parse/src/errors.rs | |
| parent | 5ff6cdca7ec664c7f96653e6c028b524757d60c4 (diff) | |
| parent | c5688794e2c3bb94f93e37a4f77576ac0d86a14e (diff) | |
| download | rust-4e8f7e4fc9d7849227f96cd55e46c0337c3fc416.tar.gz rust-4e8f7e4fc9d7849227f96cd55e46c0337c3fc416.zip | |
Rollup merge of #107425 - clubby789:match-range-missing-space, r=compiler-errors
Check for missing space between fat arrow and range pattern Fixes #107420 Ideally we wouldn't emit an error about expecting `=>` etc., but I'm not sure how to recover from this. `@rustbot` label +A-diagnostics
Diffstat (limited to 'compiler/rustc_parse/src/errors.rs')
| -rw-r--r-- | compiler/rustc_parse/src/errors.rs | 42 |
1 files changed, 42 insertions, 0 deletions
diff --git a/compiler/rustc_parse/src/errors.rs b/compiler/rustc_parse/src/errors.rs index 40763da0bb5..054b41b478d 100644 --- a/compiler/rustc_parse/src/errors.rs +++ b/compiler/rustc_parse/src/errors.rs @@ -649,6 +649,48 @@ pub(crate) struct MatchArmBodyWithoutBraces { pub sub: MatchArmBodyWithoutBracesSugg, } +#[derive(Diagnostic)] +#[diag(parse_inclusive_range_extra_equals)] +#[note] +pub(crate) struct InclusiveRangeExtraEquals { + #[primary_span] + #[suggestion( + suggestion_remove_eq, + style = "short", + code = "..=", + applicability = "maybe-incorrect" + )] + pub span: Span, +} + +#[derive(Diagnostic)] +#[diag(parse_inclusive_range_match_arrow)] +pub(crate) struct InclusiveRangeMatchArrow { + #[primary_span] + pub span: Span, + #[suggestion( + suggestion_add_space, + style = "verbose", + code = " ", + applicability = "machine-applicable" + )] + pub after_pat: Span, +} + +#[derive(Diagnostic)] +#[diag(parse_inclusive_range_no_end, code = "E0586")] +#[note] +pub(crate) struct InclusiveRangeNoEnd { + #[primary_span] + #[suggestion( + suggestion_open_range, + code = "..", + applicability = "machine-applicable", + style = "short" + )] + pub span: Span, +} + #[derive(Subdiagnostic)] pub(crate) enum MatchArmBodyWithoutBracesSugg { #[multipart_suggestion(suggestion_add_braces, applicability = "machine-applicable")] |
