Stop resolving doc links on mod items twice

This commit is contained in:
Vadim Petrochenkov
2023-02-05 15:10:02 +04:00
parent b62b82aef4
commit 3b0866272a
3 changed files with 19 additions and 15 deletions

View File

@@ -326,6 +326,14 @@ pub fn strip_generics_from_path(path_str: &str) -> Result<String, MalformedGener
if !stripped_path.is_empty() { Ok(stripped_path) } else { Err(MalformedGenerics::MissingType) }
}
/// Returns whether the first doc-comment is an inner attribute.
///
//// 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: &[ast::Attribute]) -> bool {
attrs.iter().find(|a| a.doc_str().is_some()).map_or(true, |a| a.style == ast::AttrStyle::Inner)
}
/// Simplified version of the corresponding function in rustdoc.
/// If the rustdoc version returns a successful result, this function must return the same result.
/// Otherwise this function may return anything.