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