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

rustdoc lint missing_doc_code_examples not working on stable #76194

Closed
JesHansen opened this issue Sep 1, 2020 · 3 comments · Fixed by #76212
Closed

rustdoc lint missing_doc_code_examples not working on stable #76194

JesHansen opened this issue Sep 1, 2020 · 3 comments · Fixed by #76212
Labels
A-docs Area: documentation for any part of the project, including the compiler, standard library, and tools C-bug Category: This is a bug. E-easy Call for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue. E-mentor Call for participation: This issue has a mentor. Use #t-compiler/help on Zulip for discussion. T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue.

Comments

@JesHansen
Copy link
Contributor

JesHansen commented Sep 1, 2020

I wanted to try out the missing_doc_code_examples rustdoc lint, but it seems to
be bugged.

I tried following the example given in the book.

Steps to reproduce:

Create a new crate:

cargo new testmissingdocs

Then edit the src/main.rs file:

#![deny(missing_doc_code_examples)]

//! Top level crate documentation

fn main() {
    println!("Hello, world!");
}

/// This function has no code examples.
pub fn add(i: i32, j: i32) -> i32 {
    i + j
}

I would now expect to get a linting error when building the crate, since the add
function is public, but does not have a code example. However, cargo build as
well as cargo doc and cargo test --doc completes without any errors.

@JesHansen JesHansen added the C-bug Category: This is a bug. label Sep 1, 2020
@jonas-schievink jonas-schievink added the T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue. label Sep 1, 2020
@ehuss
Copy link
Contributor

ehuss commented Sep 1, 2020

The lint only works on nightly, the docs should probably be updated.

@jyn514 jyn514 added the A-docs Area: documentation for any part of the project, including the compiler, standard library, and tools label Sep 1, 2020
@jyn514 jyn514 changed the title rustdoc lint missing_doc_code_examples not working rustdoc lint missing_doc_code_examples not working on stable Sep 1, 2020
@jyn514 jyn514 added the E-easy Call for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue. label Sep 1, 2020
@jyn514
Copy link
Member

jyn514 commented Sep 1, 2020

These docs live in https://github.com/rust-lang/rust/blob/master/src/doc/rustdoc/src/lints.md. To fix this, add 'and is nightly-only' to the first sentence.

@jyn514 jyn514 added the E-mentor Call for participation: This issue has a mentor. Use #t-compiler/help on Zulip for discussion. label Sep 1, 2020
@JesHansen
Copy link
Contributor Author

I created PR #76212 to update the documentation. Thanks for clarifying. :-)

tmandry added a commit to tmandry/rust that referenced this issue Sep 2, 2020
Document lint missing_doc_code_examples is nightly-only

Closes rust-lang#76194
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-docs Area: documentation for any part of the project, including the compiler, standard library, and tools C-bug Category: This is a bug. E-easy Call for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue. E-mentor Call for participation: This issue has a mentor. Use #t-compiler/help on Zulip for discussion. 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