From e846a863ac5c9ea35ca2439b1f76ac20d4cfca5a Mon Sep 17 00:00:00 2001 From: Mark Rousskov Date: Fri, 2 Oct 2020 11:43:28 -0400 Subject: [PATCH] Revert "Remove missing_fragment_specifier lint" This reverts commit 5ba961018c482e050af908de60e4f8bd1a00f0ae. --- src/doc/rustc/src/lints/listing/deny-by-default.md | 9 +++++++++ src/librustc_session/lint/builtin.rs | 11 +++++++++++ 2 files changed, 20 insertions(+) diff --git a/src/doc/rustc/src/lints/listing/deny-by-default.md b/src/doc/rustc/src/lints/listing/deny-by-default.md index 55714f8f4548b..dc5a9e44acfa2 100644 --- a/src/doc/rustc/src/lints/listing/deny-by-default.md +++ b/src/doc/rustc/src/lints/listing/deny-by-default.md @@ -45,6 +45,15 @@ error: defaults for type parameters are only allowed in `struct`, `enum`, `type` = note: for more information, see issue #36887 ``` +## missing-fragment-specifier + +The missing_fragment_specifier warning 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. + ## mutable-transmutes This lint catches transmuting from `&T` to `&mut T` because it is undefined diff --git a/src/librustc_session/lint/builtin.rs b/src/librustc_session/lint/builtin.rs index 2db4d2a7f51d9..144a06a4916bd 100644 --- a/src/librustc_session/lint/builtin.rs +++ b/src/librustc_session/lint/builtin.rs @@ -252,6 +252,16 @@ declare_lint! { }; } +declare_lint! { + pub MISSING_FRAGMENT_SPECIFIER, + Deny, + "detects missing fragment specifiers in unused `macro_rules!` patterns", + @future_incompatible = FutureIncompatibleInfo { + reference: "issue #40107 ", + edition: None, + }; +} + declare_lint! { pub LATE_BOUND_LIFETIME_ARGUMENTS, Warn, @@ -574,6 +584,7 @@ declare_lint_pass! { UNALIGNED_REFERENCES, SAFE_PACKED_BORROWS, PATTERNS_IN_FNS_WITHOUT_BODY, + MISSING_FRAGMENT_SPECIFIER, LATE_BOUND_LIFETIME_ARGUMENTS, ORDER_DEPENDENT_TRAIT_OBJECTS, COHERENCE_LEAK_CHECK,