From: bors Date: Sun, 5 Feb 2023 23:13:41 +0000 (+0000) Subject: Auto merge of #107627 - nnethercote:optimize-fold_ty, r=compiler-errors X-Git-Url: https://git.lizzy.rs/?a=commitdiff_plain;h=14ea63a7e005f9ca48bc13df6cb4fc5afe32febe;hp=4aec1345aa5deabba4b63a71f5fb9bd2a3fde01b;p=rust.git Auto merge of #107627 - nnethercote:optimize-fold_ty, r=compiler-errors Optimize `fold_ty` Micro-optimizing the heck out of the important `fold_ty` methods. r? `@oli-obk` --- diff --git a/compiler/rustc_error_messages/locales/en-US/parse.ftl b/compiler/rustc_error_messages/locales/en-US/parse.ftl index 244eb41eb39..2ef3dba557e 100644 --- a/compiler/rustc_error_messages/locales/en-US/parse.ftl +++ b/compiler/rustc_error_messages/locales/en-US/parse.ftl @@ -128,6 +128,9 @@ parse_missing_in_in_for_loop = missing `in` in `for` loop .use_in_not_of = try using `in` here instead .add_in = try adding `in` here +parse_missing_expression_in_for_loop = missing expression to iterate on in `for` loop + .suggestion = try adding an expression to the `for` loop + parse_missing_comma_after_match_arm = expected `,` following `match` arm .suggestion = missing a comma here to end this `match` arm diff --git a/compiler/rustc_parse/src/errors.rs b/compiler/rustc_parse/src/errors.rs index fd4333dbbec..fc7c839f1c4 100644 --- a/compiler/rustc_parse/src/errors.rs +++ b/compiler/rustc_parse/src/errors.rs @@ -433,6 +433,18 @@ pub(crate) enum MissingInInForLoopSub { AddIn(#[primary_span] Span), } +#[derive(Diagnostic)] +#[diag(parse_missing_expression_in_for_loop)] +pub(crate) struct MissingExpressionInForLoop { + #[primary_span] + #[suggestion( + code = "/* expression */ ", + applicability = "has-placeholders", + style = "verbose" + )] + pub span: Span, +} + #[derive(Diagnostic)] #[diag(parse_missing_comma_after_match_arm)] pub(crate) struct MissingCommaAfterMatchArm { diff --git a/compiler/rustc_parse/src/parser/expr.rs b/compiler/rustc_parse/src/parser/expr.rs index 473a5bb8cb8..c37808f8c3d 100644 --- a/compiler/rustc_parse/src/parser/expr.rs +++ b/compiler/rustc_parse/src/parser/expr.rs @@ -2471,6 +2471,21 @@ fn parse_for_expr(&mut self, opt_label: Option