diff options
| author | Christian Poveda <git@pvdrz.com> | 2022-05-31 12:33:35 -0500 |
|---|---|---|
| committer | Christian Poveda <git@pvdrz.com> | 2022-05-31 12:33:35 -0500 |
| commit | 93a427e3ca48bdb7f107e0dd0cf48dd53fb8aea8 (patch) | |
| tree | 145b6322696032632acb183517355c489795961f /compiler/rustc_parse/src/parser | |
| parent | 29ed9a56e3b5538f52f45723933fd769e9411d58 (diff) | |
| download | rust-93a427e3ca48bdb7f107e0dd0cf48dd53fb8aea8.tar.gz rust-93a427e3ca48bdb7f107e0dd0cf48dd53fb8aea8.zip | |
migrate `recover_from_await_method_call` diagnostic
Diffstat (limited to 'compiler/rustc_parse/src/parser')
| -rw-r--r-- | compiler/rustc_parse/src/parser/diagnostics.rs | 18 |
1 files changed, 10 insertions, 8 deletions
diff --git a/compiler/rustc_parse/src/parser/diagnostics.rs b/compiler/rustc_parse/src/parser/diagnostics.rs index 9bfd4098968..466b69ec339 100644 --- a/compiler/rustc_parse/src/parser/diagnostics.rs +++ b/compiler/rustc_parse/src/parser/diagnostics.rs @@ -306,6 +306,14 @@ struct IncorrectSemicolon<'a> { name: &'a str, } +#[derive(SessionDiagnostic)] +#[error(slug = "parser-incorrect-use-of-await")] +struct IncorrectUseOfAwait { + #[primary_span] + #[suggestion(applicability = "machine-applicable")] + span: Span, +} + // SnapshotParser is used to create a snapshot of the parser // without causing duplicate errors being emitted when the `Parser` // is dropped. @@ -1659,14 +1667,8 @@ impl<'a> Parser<'a> { self.bump(); // ( let sp = lo.to(self.token.span); self.bump(); // ) - self.struct_span_err(sp, "incorrect use of `await`") - .span_suggestion( - sp, - "`await` is not a method call, remove the parentheses", - String::new(), - Applicability::MachineApplicable, - ) - .emit(); + + self.sess.emit_err(IncorrectUseOfAwait { span: sp }); } } |
