From 1ee9ad2c587adca8513abfbf486c9ef5cbe96c44 Mon Sep 17 00:00:00 2001 From: Vincenzo Palazzo Date: Tue, 9 Jul 2024 15:30:53 +0000 Subject: [PATCH] fixup! Adds expr_2024 migration lit Signed-off-by: Vincenzo Palazzo --- ...acro_expr_fragment_specifier_2024_migration.rs | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/compiler/rustc_lint/src/macro_expr_fragment_specifier_2024_migration.rs b/compiler/rustc_lint/src/macro_expr_fragment_specifier_2024_migration.rs index fa473cf827fee..ea3aad0dd2baa 100644 --- a/compiler/rustc_lint/src/macro_expr_fragment_specifier_2024_migration.rs +++ b/compiler/rustc_lint/src/macro_expr_fragment_specifier_2024_migration.rs @@ -41,12 +41,14 @@ declare_lint! { /// /// ### Explanation /// - /// Rust [editions] allow the language to evolve without breaking - /// backwards compatibility. This lint catches code that uses new keywords - /// that are added to the language that are used as identifiers (such as a - /// variable name, function name, etc.). If you switch the compiler to a - /// new edition without updating the code, then it will fail to compile if - /// you are using a new keyword as an identifier. + /// Rust [editions] allow the language to evolve without breaking backwards compatibility. + /// This lint catches code that uses [macro matcher fragment specifiers] that have changes + /// the syntax in the edition 2024. If you switch the compiler to a + /// new edition without updating the code, your macros may behave differently. + /// + /// In the edition 2024, the `expr` fragment specifier `expr` + /// will also match `const { ... }` blocks. To keep the old behavior, you should use the + /// `expr_2021`. /// /// This lint solves the problem automatically. It is "allow" by default /// because the code is perfectly valid in older editions. The [`cargo @@ -56,6 +58,7 @@ declare_lint! { /// a new edition. /// /// [editions]: https://doc.rust-lang.org/edition-guide/ + /// [macro matcher fragment specifiers]: https://doc.rust-lang.org/nightly/edition-guide/rust-2024/macro-fragment-specifiers.html /// [`cargo fix`]: https://doc.rust-lang.org/cargo/commands/cargo-fix.html pub EDITION_2024_EXPR_FRAGMENT_SPECIFIER, Allow,