Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 10 additions & 1 deletion tools/src/bin/docgen/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,16 @@ fn comment_and_requirement(
node: Node,
src: &[u8],
) -> Result<(Option<Comment>, Option<Feature>), Box<dyn Error>> {
let maybe_comment = Comment::new(node, src).ok();
let mut maybe_comment = Comment::new(node, src).ok();

// If node wasn't a comment, see if it was an expression_statement
// that itself was preceded by a comment. This skips over
// expression-like preprocessor attributes on function decls.
if let (None, "expression_statement", Some(prev)) =
(&maybe_comment, node.kind(), node.prev_sibling())
{
maybe_comment = Comment::new(prev, src).ok();
}

// If prev wasn't a comment, see if it was a feature requirement.
if maybe_comment.is_none() {
Expand Down
Loading