@@ -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)
@@ -350,7 +350,13 @@ impl<'tcx> CheckAttrVisitor<'tcx> {
350
350
}
351
351
352
352
/// Checks if `#[diagnostic::do_not_recommend]` is applied on a trait impl.
353
- fn check_do_not_recommend ( & self , attr_span : Span , hir_id : HirId , target : Target ) {
353
+ fn check_do_not_recommend (
354
+ & self ,
355
+ attr_span : Span ,
356
+ hir_id : HirId ,
357
+ target : Target ,
358
+ attr : & Attribute ,
359
+ ) {
354
360
if !matches ! ( target, Target :: Impl ) {
355
361
self . tcx . emit_node_span_lint (
356
362
UNKNOWN_OR_MALFORMED_DIAGNOSTIC_ATTRIBUTES ,
@@ -359,6 +365,14 @@ impl<'tcx> CheckAttrVisitor<'tcx> {
359
365
errors:: IncorrectDoNotRecommendLocation ,
360
366
) ;
361
367
}
368
+ if !matches ! ( attr. meta_kind( ) , Some ( MetaItemKind :: Word ) ) {
369
+ self . tcx . emit_node_span_lint (
370
+ UNKNOWN_OR_MALFORMED_DIAGNOSTIC_ATTRIBUTES ,
371
+ hir_id,
372
+ attr_span,
373
+ errors:: DoNotRecommendDoesNotExpectArgs ,
374
+ ) ;
375
+ }
362
376
}
363
377
364
378
/// Checks if `#[diagnostic::on_unimplemented]` is applied to a trait definition
0 commit comments