File tree Expand file tree Collapse file tree 2 files changed +14
-8
lines changed
rustc_error_messages/locales/en-US Expand file tree Collapse file tree 2 files changed +14
-8
lines changed Original file line number Diff line number Diff line change @@ -23,3 +23,7 @@ parser-incorrect-semicolon =
23
23
expected item, found `;`
24
24
.suggestion = remove this semicolon
25
25
.help = { $name } declarations are not followed by a semicolon
26
+
27
+ parser-incorrect-use-of-await =
28
+ incorrect use of `await`
29
+ .suggestion = `await` is not a method call, remove the parentheses
Original file line number Diff line number Diff line change @@ -306,6 +306,14 @@ struct IncorrectSemicolon<'a> {
306
306
name : & ' a str ,
307
307
}
308
308
309
+ #[ derive( SessionDiagnostic ) ]
310
+ #[ error( slug = "parser-incorrect-use-of-await" ) ]
311
+ struct IncorrectUseOfAwait {
312
+ #[ primary_span]
313
+ #[ suggestion( applicability = "machine-applicable" ) ]
314
+ span : Span ,
315
+ }
316
+
309
317
// SnapshotParser is used to create a snapshot of the parser
310
318
// without causing duplicate errors being emitted when the `Parser`
311
319
// is dropped.
@@ -1659,14 +1667,8 @@ impl<'a> Parser<'a> {
1659
1667
self . bump ( ) ; // (
1660
1668
let sp = lo. to ( self . token . span ) ;
1661
1669
self . bump ( ) ; // )
1662
- self . struct_span_err ( sp, "incorrect use of `await`" )
1663
- . span_suggestion (
1664
- sp,
1665
- "`await` is not a method call, remove the parentheses" ,
1666
- String :: new ( ) ,
1667
- Applicability :: MachineApplicable ,
1668
- )
1669
- . emit ( ) ;
1670
+
1671
+ self . sess . emit_err ( IncorrectUseOfAwait { span : sp } ) ;
1670
1672
}
1671
1673
}
1672
1674
You can’t perform that action at this time.
0 commit comments