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

Add missing_docs lint to the rustdoc lint group #77364

Closed
Show file tree
Hide file tree
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
1 change: 1 addition & 0 deletions compiler/rustc_lint/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -306,6 +306,7 @@ fn register_builtins(store: &mut LintStore, no_interleave_lints: bool) {
"rustdoc",
BROKEN_INTRA_DOC_LINKS,
INVALID_CODEBLOCK_ATTRIBUTES,
MISSING_DOCS,
MISSING_DOC_CODE_EXAMPLES,
PRIVATE_DOC_TESTS
);
Expand Down
4 changes: 4 additions & 0 deletions src/test/rustdoc-ui/lint-group.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,3 +22,7 @@ pub fn no_doctest() {} //~^ ERROR missing code example in this documentation
/// println!("sup");
/// ```
fn private_doctest() {} //~^^^^^ ERROR documentation test in private item

pub fn no_doc() {}
//~^ ERROR missing documentation for a function
//~^^ ERROR missing code example in this documentation
21 changes: 20 additions & 1 deletion src/test/rustdoc-ui/lint-group.stderr
Original file line number Diff line number Diff line change
@@ -1,3 +1,16 @@
error: missing documentation for a function
--> $DIR/lint-group.rs:26:1
|
LL | pub fn no_doc() {}
| ^^^^^^^^^^^^^^^
|
note: the lint level is defined here
--> $DIR/lint-group.rs:7:9
|
LL | #![deny(rustdoc)]
| ^^^^^^^
= note: `#[deny(missing_docs)]` implied by `#[deny(rustdoc)]`

error: missing code example in this documentation
--> $DIR/lint-group.rs:16:1
|
Expand Down Expand Up @@ -28,6 +41,12 @@ LL | #![deny(rustdoc)]
| ^^^^^^^
= note: `#[deny(private_doc_tests)]` implied by `#[deny(rustdoc)]`

error: missing code example in this documentation
--> $DIR/lint-group.rs:26:1
|
LL | pub fn no_doc() {}
| ^^^^^^^^^^^^^^^^^^

error: unresolved link to `error`
--> $DIR/lint-group.rs:9:29
|
Expand All @@ -42,5 +61,5 @@ LL | #![deny(rustdoc)]
= note: `#[deny(broken_intra_doc_links)]` implied by `#[deny(rustdoc)]`
= help: to escape `[` and `]` characters, add '\' before them like `\[` or `\]`

error: aborting due to 3 previous errors
error: aborting due to 5 previous errors