Skip to content

rustdoc generates repeated documentation for doc comment outside module #13826

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
alxgnon opened this issue Apr 28, 2014 · 3 comments
Closed
Labels
T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue.

Comments

@alxgnon
Copy link
Contributor

alxgnon commented Apr 28, 2014

rustdoc unusually repeats a doc comment twice when it is outside an external module. Check out alxgnon/docrepeat for an example of the bug in action.

I previously fixed this issue for Rust's documentation with #13812, by simply moving the problematic doc comments.

However, #13812 does not fix the issue with rustdoc itself. I am therefore opening this as a separate issue.

@alxgnon
Copy link
Contributor Author

alxgnon commented Apr 29, 2014

I did some more testing.

rustdoc --no-defaults lib.rs                          # The bug does not occur
rustdoc --no-defaults --passes collapse-docs lib.rs   # The bug occurs

So the problematic behaviour is probably somewhere within rustdoc::passes::collapse_docs.

@lifthrasiir
Copy link
Contributor

It is not a fault of rustdoc: you can verify that by rustc -Z ast-json lib.rs. It duplicates AttrInner variants twice.

Edit: Ugh, unlike other Parser::parse_item_* methods, Parser::parse_item_mod returns a list of extra attrs plus original attrs, something unexpected for parse_item_or_view_item.

@alxgnon
Copy link
Contributor Author

alxgnon commented Apr 29, 2014

Yeah, it seems the reason disabling the collapse-docs pass fixes the bug is it doesn't concatenate the duplicate element. Thank you for noticing that :-)

flip1995 pushed a commit to flip1995/rust that referenced this issue Dec 26, 2024
…ray (rust-lang#13826)

fix rust-lang#12653

changelog: [`filter_map_identity`]: don't lint for creating an iterator
from an empty array
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue.
Projects
None yet
Development

No branches or pull requests

3 participants