Skip to content
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

doc attributes on reexport of type are copied to inherent impls #102909

Closed
rodrimati1992 opened this issue Oct 11, 2022 · 0 comments · Fixed by #103523
Closed

doc attributes on reexport of type are copied to inherent impls #102909

rodrimati1992 opened this issue Oct 11, 2022 · 0 comments · Fixed by #103523
Labels
C-bug Category: This is a bug. T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue.

Comments

@rodrimati1992
Copy link
Contributor

rodrimati1992 commented Oct 11, 2022

With a foo_lib dependency, I tried documenting the bar_lib crate with this code:

/// These are the docs for Foo.
pub use foo_lib::Foo;

I expected to see this happen: the documentation appears only for the type.

Instead, this happened: the documentation appears on the type's inherent impl block as well as the type.

image

Meta

rustc --version --verbose:

rustc 1.64.0 (a55dd71d5 2022-09-19)
binary: rustc
commit-hash: a55dd71d5fb0ec5a6a3a9e8c27b2127ba491ce52
commit-date: 2022-09-19
host: x86_64-unknown-linux-gnu
release: 1.64.0
LLVM version: 14.0.6

I provide an example repository for replicating this bug:
https://github.com/rodrimati1992/duplicated_docs_issue

@rodrimati1992 rodrimati1992 added the C-bug Category: This is a bug. label Oct 11, 2022
@rodrimati1992 rodrimati1992 changed the title doc attributes on reexport of type copies docs to inherent impls doc attributes on reexport of type copies those docs to inherent impls Oct 11, 2022
@rodrimati1992 rodrimati1992 changed the title doc attributes on reexport of type copies those docs to inherent impls doc attributes on reexport of type are copied to inherent impls Oct 11, 2022
@GuillaumeGomez GuillaumeGomez added the T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue. label Oct 19, 2022
matthiaskrgr added a commit to matthiaskrgr/rust that referenced this issue Oct 28, 2022
…impl-block, r=notriddle

Fix unwanted merge of inline doc comments for impl blocks

Fixes rust-lang#102909.

We need this merge mechanism for inlined items but it's completely unwanted for impl blocks (at least the doc comments are, not the other attributes) since we want to keep what `cfg()` is put on the `pub use` or other attributes.

r? `@notriddle`
@bors bors closed this as completed in 2f02cf8 Oct 28, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-bug Category: This is a bug. T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants