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