Skip to content

Commit 653c9ee

Browse files
Revert "Remove missing_fragment_specifier lint"
This reverts commit 5ba9610.
1 parent 2edfe12 commit 653c9ee

File tree

1 file changed

+33
-0
lines changed

1 file changed

+33
-0
lines changed

compiler/rustc_session/src/lint/builtin.rs

+33
Original file line numberDiff line numberDiff line change
@@ -1229,6 +1229,38 @@ declare_lint! {
12291229
};
12301230
}
12311231

1232+
declare_lint! {
1233+
/// The `missing_fragment_specifier` lint is issued when an unused pattern
1234+
/// in a `macro_rules!` macro definition has a meta-variable (e.g. `$e`)
1235+
/// that is not followed by a fragment specifier (e.g. `:expr`).
1236+
///
1237+
/// This warning can always be fixed by removing the unused pattern in the
1238+
/// `macro_rules!` macro definition.
1239+
///
1240+
/// ### Example
1241+
///
1242+
/// ```rust,compile_fail
1243+
/// macro_rules! foo {
1244+
/// ($e) => {}
1245+
/// }
1246+
/// ```
1247+
///
1248+
/// {{produces}}
1249+
///
1250+
///
1251+
/// ### Explanation
1252+
///
1253+
/// The meta-variable (`$e` above) lacks a fragment specifier, which is a
1254+
/// malformed input. It can be fixed by adding a fragment specifier.
1255+
pub MISSING_FRAGMENT_SPECIFIER,
1256+
Deny,
1257+
"detects missing fragment specifiers in unused `macro_rules!` patterns",
1258+
@future_incompatible = FutureIncompatibleInfo {
1259+
reference: "issue #40107 <https://github.com/rust-lang/rust/issues/40107>",
1260+
edition: None,
1261+
};
1262+
}
1263+
12321264
declare_lint! {
12331265
/// The `late_bound_lifetime_arguments` lint detects generic lifetime
12341266
/// arguments in path segments with late bound lifetime parameters.
@@ -2721,6 +2753,7 @@ declare_lint_pass! {
27212753
CENUM_IMPL_DROP_CAST,
27222754
CONST_EVALUATABLE_UNCHECKED,
27232755
INEFFECTIVE_UNSTABLE_TRAIT_IMPL,
2756+
MISSING_FRAGMENT_SPECIFIER,
27242757
]
27252758
}
27262759

0 commit comments

Comments
 (0)