From e51c37c34c3f576a2e1b7b3d5f0bd5d993c87d24 Mon Sep 17 00:00:00 2001 From: David Tolnay Date: Fri, 20 Jun 2025 11:49:32 -0700 Subject: Add AttributeExt::doc_resolution_scope --- compiler/rustc_resolve/src/rustdoc.rs | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'compiler/rustc_resolve/src/rustdoc.rs') diff --git a/compiler/rustc_resolve/src/rustdoc.rs b/compiler/rustc_resolve/src/rustdoc.rs index fa839d2748d..931c6241bf2 100644 --- a/compiler/rustc_resolve/src/rustdoc.rs +++ b/compiler/rustc_resolve/src/rustdoc.rs @@ -356,7 +356,12 @@ pub fn strip_generics_from_path(path_str: &str) -> Result, MalformedGen /// If there are no doc-comments, return true. /// FIXME(#78591): Support both inner and outer attributes on the same item. pub fn inner_docs(attrs: &[impl AttributeExt]) -> bool { - attrs.iter().find(|a| a.doc_str().is_some()).is_none_or(|a| a.style() == ast::AttrStyle::Inner) + for attr in attrs { + if let Some(attr_style) = attr.doc_resolution_scope() { + return attr_style == ast::AttrStyle::Inner; + } + } + true } /// Has `#[rustc_doc_primitive]` or `#[doc(keyword)]`. -- cgit 1.4.1-3-g733a5