diff options
| author | Esteban Küber <esteban@kuber.com.ar> | 2024-07-11 22:07:11 +0000 |
|---|---|---|
| committer | Esteban Küber <esteban@kuber.com.ar> | 2024-07-12 03:02:58 +0000 |
| commit | 377d14be88200d122f699aa989e4d1256f2173d2 (patch) | |
| tree | 9b28227ca0df88d3182f368050c6940529d9ff93 /compiler/rustc_parse/src/errors.rs | |
| parent | b5f94c61f72cc85151dbd9bb1081fde2ab78f806 (diff) | |
| download | rust-377d14be88200d122f699aa989e4d1256f2173d2.tar.gz rust-377d14be88200d122f699aa989e4d1256f2173d2.zip | |
More accurate incorrect use of `await` suggestion
Diffstat (limited to 'compiler/rustc_parse/src/errors.rs')
| -rw-r--r-- | compiler/rustc_parse/src/errors.rs | 23 |
1 files changed, 15 insertions, 8 deletions
diff --git a/compiler/rustc_parse/src/errors.rs b/compiler/rustc_parse/src/errors.rs index 18a3153bcd4..eee17a73acf 100644 --- a/compiler/rustc_parse/src/errors.rs +++ b/compiler/rustc_parse/src/errors.rs @@ -103,19 +103,26 @@ pub(crate) struct IncorrectUseOfAwait { pub span: Span, } +#[derive(Subdiagnostic)] +#[multipart_suggestion( + parse_incorrect_use_of_await_postfix_suggestion, + applicability = "machine-applicable" +)] +pub(crate) struct AwaitSuggestion { + #[suggestion_part(code = "")] + pub removal: Span, + #[suggestion_part(code = ".await{question_mark}")] + pub dot_await: Span, + pub question_mark: &'static str, +} + #[derive(Diagnostic)] #[diag(parse_incorrect_use_of_await)] pub(crate) struct IncorrectAwait { #[primary_span] pub span: Span, - #[suggestion( - parse_postfix_suggestion, - style = "verbose", - code = "{expr}.await{question_mark}" - )] - pub sugg_span: (Span, Applicability), - pub expr: String, - pub question_mark: &'static str, + #[subdiagnostic] + pub suggestion: AwaitSuggestion, } #[derive(Diagnostic)] |
