File tree 1 file changed +33
-0
lines changed
compiler/rustc_session/src/lint
1 file changed +33
-0
lines changed Original file line number Diff line number Diff line change @@ -1229,6 +1229,38 @@ declare_lint! {
1229
1229
} ;
1230
1230
}
1231
1231
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
+
1232
1264
declare_lint ! {
1233
1265
/// The `late_bound_lifetime_arguments` lint detects generic lifetime
1234
1266
/// arguments in path segments with late bound lifetime parameters.
@@ -2721,6 +2753,7 @@ declare_lint_pass! {
2721
2753
CENUM_IMPL_DROP_CAST ,
2722
2754
CONST_EVALUATABLE_UNCHECKED ,
2723
2755
INEFFECTIVE_UNSTABLE_TRAIT_IMPL ,
2756
+ MISSING_FRAGMENT_SPECIFIER ,
2724
2757
]
2725
2758
}
2726
2759
You can’t perform that action at this time.
0 commit comments