From 653c9eea072761a4353f90cf35f03aa9beb606eb Mon Sep 17 00:00:00 2001 From: Mark Rousskov Date: Tue, 20 Oct 2020 10:41:00 -0400 Subject: [PATCH] Revert "Remove missing_fragment_specifier lint" This reverts commit 5ba961018c482e050af908de60e4f8bd1a00f0ae. --- compiler/rustc_session/src/lint/builtin.rs | 33 ++++++++++++++++++++++ 1 file changed, 33 insertions(+) diff --git a/compiler/rustc_session/src/lint/builtin.rs b/compiler/rustc_session/src/lint/builtin.rs index 0cc97fb4541d1..6133f4d94aad4 100644 --- a/compiler/rustc_session/src/lint/builtin.rs +++ b/compiler/rustc_session/src/lint/builtin.rs @@ -1229,6 +1229,38 @@ declare_lint! { }; } +declare_lint! { + /// The `missing_fragment_specifier` lint is issued when an unused pattern + /// in a `macro_rules!` macro definition has a meta-variable (e.g. `$e`) + /// that is not followed by a fragment specifier (e.g. `:expr`). + /// + /// This warning can always be fixed by removing the unused pattern in the + /// `macro_rules!` macro definition. + /// + /// ### Example + /// + /// ```rust,compile_fail + /// macro_rules! foo { + /// ($e) => {} + /// } + /// ``` + /// + /// {{produces}} + /// + /// + /// ### Explanation + /// + /// The meta-variable (`$e` above) lacks a fragment specifier, which is a + /// malformed input. It can be fixed by adding a fragment specifier. + pub MISSING_FRAGMENT_SPECIFIER, + Deny, + "detects missing fragment specifiers in unused `macro_rules!` patterns", + @future_incompatible = FutureIncompatibleInfo { + reference: "issue #40107 ", + edition: None, + }; +} + declare_lint! { /// The `late_bound_lifetime_arguments` lint detects generic lifetime /// arguments in path segments with late bound lifetime parameters. @@ -2721,6 +2753,7 @@ declare_lint_pass! { CENUM_IMPL_DROP_CAST, CONST_EVALUATABLE_UNCHECKED, INEFFECTIVE_UNSTABLE_TRAIT_IMPL, + MISSING_FRAGMENT_SPECIFIER, ] }