@@ -249,6 +249,7 @@ pub fn run_core(options: RustdocOptions) -> (clean::Crate, RenderInfo, RenderOpt
249249 let missing_docs = rustc_lint:: builtin:: MISSING_DOCS . name ;
250250 let missing_doc_example = rustc_lint:: builtin:: MISSING_DOC_CODE_EXAMPLES . name ;
251251 let private_doc_tests = rustc_lint:: builtin:: PRIVATE_DOC_TESTS . name ;
252+ let no_crate_level_doc = rustc_lint:: builtin:: NO_CRATE_LEVEL_DOC . name ;
252253
253254 // In addition to those specific lints, we also need to whitelist those given through
254255 // command line, otherwise they'll get ignored and we don't want that.
@@ -258,6 +259,7 @@ pub fn run_core(options: RustdocOptions) -> (clean::Crate, RenderInfo, RenderOpt
258259 missing_docs. to_owned( ) ,
259260 missing_doc_example. to_owned( ) ,
260261 private_doc_tests. to_owned( ) ,
262+ no_crate_level_doc. to_owned( ) ,
261263 ] ;
262264
263265 whitelisted_lints. extend ( lint_opts. iter ( ) . map ( |( lint, _) | lint) . cloned ( ) ) ;
@@ -411,6 +413,23 @@ pub fn run_core(options: RustdocOptions) -> (clean::Crate, RenderInfo, RenderOpt
411413
412414 let mut krate = clean:: krate ( & mut ctxt) ;
413415
416+ if let Some ( ref m) = krate. module {
417+ match m. doc_value ( ) {
418+ None | Some ( "" ) => {
419+ let mut diag = tcx. struct_lint_node (
420+ rustc_lint:: builtin:: NO_CRATE_LEVEL_DOC ,
421+ ctxt. as_local_hir_id ( m. def_id ) . unwrap ( ) ,
422+ "No documentation found on this crate top module.\n \n \
423+ Maybe you could be interested into looking at this documentation:\n \
424+ https://doc.rust-lang.org/nightly/rustdoc/how-to-write-documentation\
425+ .html"
426+ ) ;
427+ diag. emit ( ) ;
428+ }
429+ _ => { }
430+ }
431+ }
432+
414433 fn report_deprecated_attr ( name : & str , diag : & rustc_errors:: Handler ) {
415434 let mut msg = diag. struct_warn ( & format ! (
416435 "the `#![doc({})]` attribute is \
0 commit comments