@@ -206,12 +206,24 @@ impl AttributeExt for Attribute {
206
206
}
207
207
}
208
208
209
- fn style ( & self ) -> AttrStyle {
210
- self . style
209
+ fn doc_resolution_scope ( & self ) -> Option < AttrStyle > {
210
+ match & self . kind {
211
+ AttrKind :: DocComment ( ..) => Some ( self . style ) ,
212
+ AttrKind :: Normal ( normal)
213
+ if normal. item . path == sym:: doc && normal. item . value_str ( ) . is_some ( ) =>
214
+ {
215
+ Some ( self . style )
216
+ }
217
+ _ => None ,
218
+ }
211
219
}
212
220
}
213
221
214
222
impl Attribute {
223
+ pub fn style ( & self ) -> AttrStyle {
224
+ self . style
225
+ }
226
+
215
227
pub fn may_have_doc_links ( & self ) -> bool {
216
228
self . doc_str ( ) . is_some_and ( |s| comments:: may_have_doc_links ( s. as_str ( ) ) )
217
229
}
@@ -806,7 +818,14 @@ pub trait AttributeExt: Debug {
806
818
/// * `#[doc(...)]` returns `None`.
807
819
fn doc_str_and_comment_kind ( & self ) -> Option < ( Symbol , CommentKind ) > ;
808
820
809
- fn style ( & self ) -> AttrStyle ;
821
+ /// Returns outer or inner if this is a doc attribute or a sugared doc
822
+ /// comment, otherwise None.
823
+ ///
824
+ /// This is used in the case of doc comments on modules, to decide whether
825
+ /// to resolve intra-doc links against the symbols in scope within the
826
+ /// commented module (for inner doc) vs within its parent module (for outer
827
+ /// doc).
828
+ fn doc_resolution_scope ( & self ) -> Option < AttrStyle > ;
810
829
}
811
830
812
831
// FIXME(fn_delegation): use function delegation instead of manually forwarding
@@ -881,8 +900,4 @@ impl Attribute {
881
900
pub fn doc_str_and_comment_kind ( & self ) -> Option < ( Symbol , CommentKind ) > {
882
901
AttributeExt :: doc_str_and_comment_kind ( self )
883
902
}
884
-
885
- pub fn style ( & self ) -> AttrStyle {
886
- AttributeExt :: style ( self )
887
- }
888
903
}
0 commit comments