Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/librustdoc/passes/collect_intra_doc_links.rs
Original file line number Diff line number Diff line change
Expand Up @@ -796,6 +796,7 @@ impl<'a, 'tcx> DocFolder for LinkCollector<'a, 'tcx> {

let hir_id = self.cx.tcx.hir().as_local_hir_id(local);
if !self.cx.tcx.privacy_access_levels(LOCAL_CRATE).is_exported(hir_id)
&& (item.visibility == Visibility::Public)
&& !self.cx.render_options.document_private
{
let item_name = item.name.as_deref().unwrap_or("<unknown>");
Expand Down
10 changes: 10 additions & 0 deletions src/test/rustdoc/issue-74134-1.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#![deny(intra_doc_link_resolution_failure)]

// Linking from a private item to a private type is fine without --document-private-items.

struct Private;

pub struct Public {
/// [`Private`]
private: Private,
}
11 changes: 11 additions & 0 deletions src/test/rustdoc/issue-74134-2.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
// compile-flags: --document-private-items
#![deny(intra_doc_link_resolution_failure)]

// Linking from a private item to a private type is fine with --document-private-items.

struct Private;

pub struct Public {
/// [`Private`]
private: Private,
}
11 changes: 11 additions & 0 deletions src/test/rustdoc/issue-74134-3.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
// should-fail
#![deny(intra_doc_link_resolution_failure)]

// Linking from a public item to a private type fails without --document-private-items.

struct Private;

pub struct Public {
/// [`Private`]
pub public: u32,
}
11 changes: 11 additions & 0 deletions src/test/rustdoc/issue-74134-4.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
// compile-flags: --document-private-items
#![deny(intra_doc_link_resolution_failure)]

// Linking from a public item to a private type is fine with --document-private-items.

struct Private;

pub struct Public {
/// [`Private`]
pub public: u32,
}