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

missing_docs lint does not take into account the implementing type being #[doc(hidden)] #85526

Closed
Nemo157 opened this issue May 20, 2021 · 2 comments · Fixed by #89987
Closed
Assignees
Labels
A-lint Area: Lints (warnings about flaws in source code) such as unused_mut. C-bug Category: This is a bug. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue.

Comments

@Nemo157
Copy link
Member

Nemo157 commented May 20, 2021

I tried this code:

#![warn(missing_docs)]

//! Crate docs

#[doc(hidden)]
pub struct Foo;

impl Foo {
    pub fn bar() {}
}

I expected to see this happen: no warnings, Foo and its method are not publicly documented.

Instead, this happened:

warning: missing documentation for an associated function
 --> src/lib.rs:9:5
  |
9 |     pub fn bar() {}
  |     ^^^^^^^^^^^^
  |
note: the lint level is defined here
 --> src/lib.rs:1:9
  |
1 | #![warn(missing_docs)]
  |         ^^^^^^^^^^^^

warning: 1 warning emitted
@Nemo157 Nemo157 added A-lint Area: Lints (warnings about flaws in source code) such as unused_mut. C-bug Category: This is a bug. labels May 20, 2021
@JohnTitor JohnTitor changed the title missing_docs lint does not take into account the implementing type being `#[doc(hidden)] missing_docs lint does not take into account the implementing type being #[doc(hidden)] Jun 25, 2021
@JohnTitor JohnTitor added the T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. label Jun 25, 2021
@pierwill
Copy link
Member

@rustbot claim

@pierwill
Copy link
Member

pierwill commented Oct 16, 2021

Looks like the context here

https://github.com/rust-lang/rust/blob/45c00481f3adbda69bd6f4e5816c74e2e2017f98/compiler/rustc_lint/src/builtin.rs#L528-L535

could give us the information needed to determine

  1. if the item is an associated function definition, and
  2. if the type on which it is implemented itself has the #[doc(hidden)] attribute.

@camelid camelid added the T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue. label Oct 17, 2021
matthiaskrgr added a commit to matthiaskrgr/rust that referenced this issue Oct 17, 2021
…c, r=GuillaumeGomez

Check implementing type for `#[doc(hidden)]`

Closes rust-lang#85526.
matthiaskrgr added a commit to matthiaskrgr/rust that referenced this issue Oct 17, 2021
…c, r=GuillaumeGomez

Check implementing type for `#[doc(hidden)]`

Closes rust-lang#85526.
matthiaskrgr added a commit to matthiaskrgr/rust that referenced this issue Oct 18, 2021
…c, r=GuillaumeGomez

Check implementing type for `#[doc(hidden)]`

Closes rust-lang#85526.
@bors bors closed this as completed in d39a1be Oct 18, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-lint Area: Lints (warnings about flaws in source code) such as unused_mut. C-bug Category: This is a bug. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. 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.

4 participants