@@ -6,8 +6,8 @@ use crate::diagnostics::error::{
66} ;
77use crate :: diagnostics:: utils:: {
88 build_field_mapping, is_doc_comment, report_error_if_not_applied_to_span, report_type_error,
9- should_generate_set_arg, type_is_unit, type_matches_path, FieldInfo , FieldInnerTy , FieldMap ,
10- HasFieldMap , SetOnce , SpannedOption , SubdiagnosticKind ,
9+ should_generate_set_arg, type_is_bool , type_is_unit, type_matches_path, FieldInfo ,
10+ FieldInnerTy , FieldMap , HasFieldMap , SetOnce , SpannedOption , SubdiagnosticKind ,
1111} ;
1212use proc_macro2:: { Ident , Span , TokenStream } ;
1313use quote:: { format_ident, quote} ;
@@ -414,12 +414,15 @@ impl<'a> DiagnosticDeriveVariantBuilder<'a> {
414414 Ok ( self . add_spanned_subdiagnostic ( binding, & fn_ident, slug) )
415415 }
416416 SubdiagnosticKind :: Note | SubdiagnosticKind :: Help | SubdiagnosticKind :: Warn => {
417- if type_matches_path ( info. ty . inner_type ( ) , & [ "rustc_span" , "Span" ] ) {
417+ let inner = info. ty . inner_type ( ) ;
418+ if type_matches_path ( inner, & [ "rustc_span" , "Span" ] ) {
418419 Ok ( self . add_spanned_subdiagnostic ( binding, & fn_ident, slug) )
419- } else if type_is_unit ( info. ty . inner_type ( ) ) {
420+ } else if type_is_unit ( inner)
421+ || ( matches ! ( info. ty, FieldInnerTy :: Plain ( _) ) && type_is_bool ( inner) )
422+ {
420423 Ok ( self . add_subdiagnostic ( & fn_ident, slug) )
421424 } else {
422- report_type_error ( attr, "`Span` or `()`" ) ?
425+ report_type_error ( attr, "`Span`, `bool` or `()`" ) ?
423426 }
424427 }
425428 SubdiagnosticKind :: Suggestion {
0 commit comments