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