Skip to content

Commit 72a180e

Browse files
committed
rustdoc: Record crate name instead of using None
1 parent 2287a88 commit 72a180e

File tree

3 files changed

+18
-1
lines changed

3 files changed

+18
-1
lines changed

src/librustdoc/visit_ast.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ impl<'a, 'tcx> RustdocVisitor<'a, 'tcx> {
7676
&Spanned { span: rustc_span::DUMMY_SP, node: hir::VisibilityKind::Public },
7777
hir::CRATE_HIR_ID,
7878
&krate.item.module,
79-
None,
79+
Some(self.cx.tcx.crate_name),
8080
);
8181
top_level_module.is_crate = true;
8282
// Attach the crate's exported macros to the top-level module.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
// check-pass
2+
3+
//! [my_module]
4+
//~^ WARN public documentation for `private_from_crate_level` links to private item `my_module`
5+
6+
mod my_module {}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
warning: public documentation for `private_from_crate_level` links to private item `my_module`
2+
--> $DIR/private-from-crate-level.rs:3:6
3+
|
4+
LL | //! [my_module]
5+
| ^^^^^^^^^ this item is private
6+
|
7+
= note: `#[warn(rustdoc::private_intra_doc_links)]` on by default
8+
= note: this link will resolve properly if you pass `--document-private-items`
9+
10+
warning: 1 warning emitted
11+

0 commit comments

Comments
 (0)