rustdoc: Record crate name instead of using None

This commit is contained in:
Camelid 2021-03-22 18:18:57 -07:00
parent 2287a8823d
commit 72a180e134
3 changed files with 18 additions and 1 deletions

View File

@ -76,7 +76,7 @@ impl<'a, 'tcx> RustdocVisitor<'a, 'tcx> {
&Spanned { span: rustc_span::DUMMY_SP, node: hir::VisibilityKind::Public },
hir::CRATE_HIR_ID,
&krate.item.module,
None,
Some(self.cx.tcx.crate_name),
);
top_level_module.is_crate = true;
// Attach the crate's exported macros to the top-level module.

View File

@ -0,0 +1,6 @@
// check-pass
//! [my_module]
//~^ WARN public documentation for `private_from_crate_level` links to private item `my_module`
mod my_module {}

View File

@ -0,0 +1,11 @@
warning: public documentation for `private_from_crate_level` links to private item `my_module`
--> $DIR/private-from-crate-level.rs:3:6
|
LL | //! [my_module]
| ^^^^^^^^^ this item is private
|
= note: `#[warn(rustdoc::private_intra_doc_links)]` on by default
= note: this link will resolve properly if you pass `--document-private-items`
warning: 1 warning emitted