Skip to content

Commit fcbe2b3

Browse files
committed
more updates on parser
1 parent ca7531b commit fcbe2b3

File tree

1 file changed

+14
-7
lines changed

1 file changed

+14
-7
lines changed

compiler/rustc_parse/src/errors.rs

+14-7
Original file line numberDiff line numberDiff line change
@@ -1262,21 +1262,28 @@ impl<'a, G: EmissionGuarantee> IntoDiagnostic<'a, G> for ExpectedSemi {
12621262
let token_descr = TokenDescription::from_token(&self.token);
12631263

12641264
let mut diag = handler.struct_diagnostic(match token_descr {
1265-
Some(TokenDescription::ReservedIdentifier) => {
1266-
fluent::parse_expected_semi_found_reserved_identifier_str
1265+
Some(TokenDescription::ReservedIdentifier) => DiagnosticMessage::Str(Cow::from(
1266+
"expected `;`, found reserved identifier `{$token}`",
1267+
)),
1268+
Some(TokenDescription::Keyword) => {
1269+
DiagnosticMessage::Str(Cow::from("expected `;`, found keyword `{$token}`"))
12671270
}
1268-
Some(TokenDescription::Keyword) => fluent::parse_expected_semi_found_keyword_str,
12691271
Some(TokenDescription::ReservedKeyword) => {
1270-
fluent::parse_expected_semi_found_reserved_keyword_str
1272+
DiagnosticMessage::Str(Cow::from("expected `;`, found reserved keyword `{$token}`"))
1273+
}
1274+
Some(TokenDescription::DocComment) => {
1275+
DiagnosticMessage::Str(Cow::from("expected `;`, found doc comment `{$token}`"))
12711276
}
1272-
Some(TokenDescription::DocComment) => fluent::parse_expected_semi_found_doc_comment_str,
1273-
None => fluent::parse_expected_semi_found_str,
1277+
None => DiagnosticMessage::Str(Cow::from("expected `;`, found `{$token}`")),
12741278
});
12751279
diag.set_span(self.span);
12761280
diag.set_arg("token", self.token);
12771281

12781282
if let Some(unexpected_token_label) = self.unexpected_token_label {
1279-
diag.span_label(unexpected_token_label, fluent::parse_label_unexpected_token);
1283+
diag.span_label(
1284+
unexpected_token_label,
1285+
DiagnosticMessage::Str(Cow::from("unexpected token")),
1286+
);
12801287
}
12811288

12821289
self.sugg.add_to_diagnostic(&mut diag);

0 commit comments

Comments
 (0)