@@ -118,7 +118,7 @@ impl<'tcx> CheckAttrVisitor<'tcx> {
118
118
for attr in attrs {
119
119
match attr. path ( ) . as_slice ( ) {
120
120
[ sym:: diagnostic, sym:: do_not_recommend, ..] => {
121
- self . check_do_not_recommend ( attr. span , hir_id, target)
121
+ self . check_do_not_recommend ( attr. span , hir_id, target, attr )
122
122
}
123
123
[ sym:: diagnostic, sym:: on_unimplemented, ..] => {
124
124
self . check_diagnostic_on_unimplemented ( attr. span , hir_id, target)
@@ -353,7 +353,13 @@ impl<'tcx> CheckAttrVisitor<'tcx> {
353
353
}
354
354
355
355
/// Checks if `#[diagnostic::do_not_recommend]` is applied on a trait impl.
356
- fn check_do_not_recommend ( & self , attr_span : Span , hir_id : HirId , target : Target ) {
356
+ fn check_do_not_recommend (
357
+ & self ,
358
+ attr_span : Span ,
359
+ hir_id : HirId ,
360
+ target : Target ,
361
+ attr : & Attribute ,
362
+ ) {
357
363
if !matches ! ( target, Target :: Impl ) {
358
364
self . tcx . emit_node_span_lint (
359
365
UNKNOWN_OR_MALFORMED_DIAGNOSTIC_ATTRIBUTES ,
@@ -362,6 +368,14 @@ impl<'tcx> CheckAttrVisitor<'tcx> {
362
368
errors:: IncorrectDoNotRecommendLocation ,
363
369
) ;
364
370
}
371
+ if !matches ! ( attr. meta_kind( ) , Some ( MetaItemKind :: Word ) ) {
372
+ self . tcx . emit_node_span_lint (
373
+ UNKNOWN_OR_MALFORMED_DIAGNOSTIC_ATTRIBUTES ,
374
+ hir_id,
375
+ attr_span,
376
+ errors:: DoNotRecommendDoesNotExpectArgs ,
377
+ ) ;
378
+ }
365
379
}
366
380
367
381
/// Checks if `#[diagnostic::on_unimplemented]` is applied to a trait definition
0 commit comments