File tree Expand file tree Collapse file tree 5 files changed +20
-6
lines changed
Expand file tree Collapse file tree 5 files changed +20
-6
lines changed Original file line number Diff line number Diff line change @@ -407,6 +407,9 @@ pub(crate) fn run_global_ctxt(
407407 crate :: lint:: MISSING_CRATE_LEVEL_DOCS ,
408408 DocContext :: as_local_hir_id ( tcx, krate. module . item_id ) . unwrap ( ) ,
409409 |lint| {
410+ if let Some ( local_def_id) = krate. module . item_id . as_local_def_id ( ) {
411+ lint. span ( tcx. def_span ( local_def_id) ) ;
412+ }
410413 lint. primary_message ( "no documentation found for this crate's top-level module" ) ;
411414 lint. help ( help) ;
412415 } ,
Original file line number Diff line number Diff line change 22//@ compile-flags: -Z unstable-options --check
33//@ normalize-stderr: "nightly|beta|1\.[0-9][0-9]\.[0-9]" -> "$$CHANNEL"
44
5- #![ feature( rustdoc_missing_doc_code_examples) ]
5+ #![ feature( rustdoc_missing_doc_code_examples) ] //~ WARN no documentation found for this crate's top-level module
66//~^ WARN
77
88#![ warn( missing_docs) ]
1212pub fn foo ( ) { }
1313//~^ WARN
1414//~^^ WARN
15-
16- //~? WARN no documentation found for this crate's top-level module
Original file line number Diff line number Diff line change @@ -22,6 +22,15 @@ LL | pub fn foo() {}
2222 | ^^^^^^^^^^^^
2323
2424warning: no documentation found for this crate's top-level module
25+ --> $DIR/check.rs:5:1
26+ |
27+ LL | / #![feature(rustdoc_missing_doc_code_examples)]
28+ LL | |
29+ LL | |
30+ LL | | #![warn(missing_docs)]
31+ ... |
32+ LL | | pub fn foo() {}
33+ | |_______________^
2534 |
2635 = help: The following guide may be of use:
2736 https://doc.rust-lang.org/$CHANNEL/rustdoc/how-to-write-documentation.html
Original file line number Diff line number Diff line change 11//@ normalize-stderr: "nightly|beta|1\.[0-9][0-9]\.[0-9]" -> "$$CHANNEL"
2- #![ deny( rustdoc:: missing_crate_level_docs) ]
2+ #![ deny( rustdoc:: missing_crate_level_docs) ] //~ ERROR no documentation found for this crate's top-level module
33//^~ NOTE defined here
44
55pub fn foo ( ) { }
6-
7- //~? ERROR no documentation found for this crate's top-level module
Original file line number Diff line number Diff line change 11error: no documentation found for this crate's top-level module
2+ --> $DIR/no-crate-level-doc-lint.rs:2:1
3+ |
4+ LL | / #![deny(rustdoc::missing_crate_level_docs)]
5+ ... |
6+ LL | | pub fn foo() {}
7+ | |_______________^
28 |
39 = help: The following guide may be of use:
410 https://doc.rust-lang.org/$CHANNEL/rustdoc/how-to-write-documentation.html
You can’t perform that action at this time.
0 commit comments