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