Skip to content

Commit 621282b

Browse files
committed
more updates on parser
1 parent bd3289e commit 621282b

File tree

1 file changed

+14
-7
lines changed

1 file changed

+14
-7
lines changed

compiler/rustc_parse/src/errors.rs

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1303,21 +1303,28 @@ impl<'a> IntoDiagnostic<'a> for ExpectedSemi {
13031303
let token_descr = TokenDescription::from_token(&self.token);
13041304

13051305
let mut diag = handler.struct_diagnostic(match token_descr {
1306-
Some(TokenDescription::ReservedIdentifier) => {
1307-
fluent::parse_expected_semi_found_reserved_identifier_str
1306+
Some(TokenDescription::ReservedIdentifier) => DiagnosticMessage::Str(Cow::from(
1307+
"expected `;`, found reserved identifier `{$token}`",
1308+
)),
1309+
Some(TokenDescription::Keyword) => {
1310+
DiagnosticMessage::Str(Cow::from("expected `;`, found keyword `{$token}`"))
13081311
}
1309-
Some(TokenDescription::Keyword) => fluent::parse_expected_semi_found_keyword_str,
13101312
Some(TokenDescription::ReservedKeyword) => {
1311-
fluent::parse_expected_semi_found_reserved_keyword_str
1313+
DiagnosticMessage::Str(Cow::from("expected `;`, found reserved keyword `{$token}`"))
1314+
}
1315+
Some(TokenDescription::DocComment) => {
1316+
DiagnosticMessage::Str(Cow::from("expected `;`, found doc comment `{$token}`"))
13121317
}
1313-
Some(TokenDescription::DocComment) => fluent::parse_expected_semi_found_doc_comment_str,
1314-
None => fluent::parse_expected_semi_found_str,
1318+
None => DiagnosticMessage::Str(Cow::from("expected `;`, found `{$token}`")),
13151319
});
13161320
diag.set_span(self.span);
13171321
diag.set_arg("token", self.token);
13181322

13191323
if let Some(unexpected_token_label) = self.unexpected_token_label {
1320-
diag.span_label(unexpected_token_label, fluent::parse_label_unexpected_token);
1324+
diag.span_label(
1325+
unexpected_token_label,
1326+
DiagnosticMessage::Str(Cow::from("unexpected token")),
1327+
);
13211328
}
13221329

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

0 commit comments

Comments
 (0)