File tree 1 file changed +29
-1
lines changed
compiler/rustc_lint_defs/src
1 file changed +29
-1
lines changed Original file line number Diff line number Diff line change @@ -1229,12 +1229,40 @@ declare_lint! {
1229
1229
}
1230
1230
1231
1231
declare_lint ! {
1232
- /// The missing_fragment_specifier warning is issued when an unused pattern in a
1232
+ /// The ` missing_fragment_specifier` lint is issued when an unused pattern in a
1233
1233
/// `macro_rules!` macro definition has a meta-variable (e.g. `$e`) that is not
1234
1234
/// followed by a fragment specifier (e.g. `:expr`).
1235
1235
///
1236
1236
/// This warning can always be fixed by removing the unused pattern in the
1237
1237
/// `macro_rules!` macro definition.
1238
+ ///
1239
+ /// ### Example
1240
+ ///
1241
+ /// ```rust,compile_fail
1242
+ /// macro_rules! foo {
1243
+ /// () => {};
1244
+ /// ($name) => { };
1245
+ /// }
1246
+ ///
1247
+ /// fn main() {
1248
+ /// foo!();
1249
+ /// }
1250
+ /// ```
1251
+ ///
1252
+ /// {{produces}}
1253
+ ///
1254
+ /// ### Explanation
1255
+ ///
1256
+ /// To fix this, remove the unused pattern from the `macro_rules!` macro definition:
1257
+ ///
1258
+ /// ```rust
1259
+ /// macro_rules! foo {
1260
+ /// () => {};
1261
+ /// }
1262
+ /// fn main() {
1263
+ /// foo!();
1264
+ /// }
1265
+ /// ```
1238
1266
pub MISSING_FRAGMENT_SPECIFIER ,
1239
1267
Deny ,
1240
1268
"detects missing fragment specifiers in unused `macro_rules!` patterns" ,
You can’t perform that action at this time.
0 commit comments