about summary refs log tree commit diff
path: root/compiler/rustc_resolve
diff options
context:
space:
mode:
authorJacob Pratt <jacob@jhpratt.dev>2025-06-22 08:49:05 +0200
committerGitHub <noreply@github.com>2025-06-22 08:49:05 +0200
commitbf63acfd3553fbd21e85e3eac3dd795d35fd0804 (patch)
treec752c7744aa84547803687c0deb9489bc641846e /compiler/rustc_resolve
parentb5b106ab91ef614c0e6629df8e5f42a283746346 (diff)
parent6729b667ce4b013a5ec6f50b096bde3edabc28e3 (diff)
downloadrust-bf63acfd3553fbd21e85e3eac3dd795d35fd0804.tar.gz
rust-bf63acfd3553fbd21e85e3eac3dd795d35fd0804.zip
Rollup merge of #142776 - dtolnay:hirattrstyle2, r=jdonszelmann
All HIR attributes are outer

Fixes https://github.com/rust-lang/rust/issues/142649. Closes https://github.com/rust-lang/rust/pull/142759.

All HIR attributes, including parsed and not yet parsed, will now be rendered as outer attributes by `rustc_hir_pretty`. The original style of the corresponding AST attribute(s) is not relevant for pretty printing, only for diagnostics.

r? ````@jdonszelmann````
Diffstat (limited to 'compiler/rustc_resolve')
-rw-r--r--compiler/rustc_resolve/src/rustdoc.rs7
1 files changed, 6 insertions, 1 deletions
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<Box<str>, 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)]`.