Skip to content

Commit fdf495c

Browse files
Add MISSING_CRATE_LEVEL_DOCS lint to the rustdoc group
1 parent 2acf6ee commit fdf495c

File tree

2 files changed

+14
-2
lines changed

2 files changed

+14
-2
lines changed

compiler/rustc_lint/src/lib.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ use rustc_middle::ty::TyCtxt;
7070
use rustc_session::lint::builtin::{
7171
BARE_TRAIT_OBJECTS, BROKEN_INTRA_DOC_LINKS, ELIDED_LIFETIMES_IN_PATHS,
7272
EXPLICIT_OUTLIVES_REQUIREMENTS, INVALID_CODEBLOCK_ATTRIBUTES, INVALID_HTML_TAGS,
73-
MISSING_DOC_CODE_EXAMPLES, NON_AUTOLINKS, PRIVATE_DOC_TESTS,
73+
MISSING_CRATE_LEVEL_DOCS, MISSING_DOC_CODE_EXAMPLES, NON_AUTOLINKS, PRIVATE_DOC_TESTS,
7474
};
7575
use rustc_span::symbol::{Ident, Symbol};
7676
use rustc_span::Span;
@@ -321,6 +321,7 @@ fn register_builtins(store: &mut LintStore, no_interleave_lints: bool) {
321321
INVALID_CODEBLOCK_ATTRIBUTES,
322322
MISSING_DOC_CODE_EXAMPLES,
323323
PRIVATE_DOC_TESTS,
324+
MISSING_CRATE_LEVEL_DOCS,
324325
INVALID_HTML_TAGS
325326
);
326327

src/test/rustdoc-ui/check.stderr

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,17 @@ warning: missing documentation for a function
2121
LL | pub fn foo() {}
2222
| ^^^^^^^^^^^^
2323

24+
warning: no documentation found for this crate's top-level module
25+
|
26+
note: the lint level is defined here
27+
--> $DIR/check.rs:7:9
28+
|
29+
LL | #![warn(rustdoc)]
30+
| ^^^^^^^
31+
= note: `#[warn(missing_crate_level_docs)]` implied by `#[warn(rustdoc)]`
32+
= help: The following guide may be of use:
33+
https://doc.rust-lang.org/nightly/rustdoc/how-to-write-documentation.html
34+
2435
warning: missing code example in this documentation
2536
--> $DIR/check.rs:4:1
2637
|
@@ -45,5 +56,5 @@ warning: missing code example in this documentation
4556
LL | pub fn foo() {}
4657
| ^^^^^^^^^^^^^^^
4758

48-
warning: 4 warnings emitted
59+
warning: 5 warnings emitted
4960

0 commit comments

Comments
 (0)