@@ -86,10 +86,10 @@ impl AttributeExt for Attribute {
8686 /// Returns `true` if it is a sugared doc comment (`///` or `//!` for example).
8787 /// So `#[doc = "doc"]` (which is a doc comment) and `#[doc(...)]` (which is not
8888 /// a doc comment) will return `false`.
89- fn is_doc_comment ( & self ) -> bool {
89+ fn is_doc_comment ( & self ) -> Option < Span > {
9090 match self . kind {
91- AttrKind :: Normal ( ..) => false ,
92- AttrKind :: DocComment ( ..) => true ,
91+ AttrKind :: Normal ( ..) => None ,
92+ AttrKind :: DocComment ( ..) => Some ( self . span ) ,
9393 }
9494 }
9595
@@ -776,7 +776,7 @@ pub trait AttributeExt: Debug {
776776 /// Returns `true` if it is a sugared doc comment (`///` or `//!` for example).
777777 /// So `#[doc = "doc"]` (which is a doc comment) and `#[doc(...)]` (which is not
778778 /// a doc comment) will return `false`.
779- fn is_doc_comment ( & self ) -> bool ;
779+ fn is_doc_comment ( & self ) -> Option < Span > ;
780780
781781 #[ inline]
782782 fn has_name ( & self , name : Symbol ) -> bool {
@@ -863,8 +863,9 @@ impl Attribute {
863863 AttributeExt :: path_matches ( self , name)
864864 }
865865
866+ // on ast attributes we return a bool since that's what most code already expects
866867 pub fn is_doc_comment ( & self ) -> bool {
867- AttributeExt :: is_doc_comment ( self )
868+ AttributeExt :: is_doc_comment ( self ) . is_some ( )
868869 }
869870
870871 #[ inline]
0 commit comments