-
Notifications
You must be signed in to change notification settings - Fork 13.6k
Open
Labels
A-intra-doc-linksArea: Intra-doc links, the ability to link to items in docs by nameArea: Intra-doc links, the ability to link to items in docs by nameC-bugCategory: This is a bug.Category: This is a bug.T-rustdocRelevant to the rustdoc team, which will review and decide on the PR/issue.Relevant to the rustdoc team, which will review and decide on the PR/issue.
Description
pub struct WholeNumber(u32);
pub use bar::Integer;
mod foo {
// This is private
pub struct Signed<T>(pub T);
}
mod bar {
/// If you want to do things, try [`Integer::do_thing()`]
pub type Integer = crate::foo::Signed<crate::WholeNumber>;
impl Integer {
pub fn do_thing() {}
}
}
Shows
warning: public documentation for `Integer` links to private item `Integer::do_thing`
--> src/lib.rs:10:41
|
10 | /// If you want to do things, try [`Integer::do_thing()`]
| ^^^^^^^^^^^^^^^^^^^ this item is private
|
= note: this link will resolve properly if you pass `--document-private-items`
= note: `#[warn(rustdoc::private_intra_doc_links)]` on by default
under cargo doc
.
This is (a) incorrect: Integer::do_thing()
is public and accessible even if Signed
isn't and (b) misleading: the problem is not the publicness of do_thing()
but rather the fact that Signed
is inaccessible. The diagnostic is confusing and doesn't help fix the problem.
I think this should probably be considered a false positive, but either way, the diagnostic ought to be be clearer about what needs to be fixed here.
Metadata
Metadata
Assignees
Labels
A-intra-doc-linksArea: Intra-doc links, the ability to link to items in docs by nameArea: Intra-doc links, the ability to link to items in docs by nameC-bugCategory: This is a bug.Category: This is a bug.T-rustdocRelevant to the rustdoc team, which will review and decide on the PR/issue.Relevant to the rustdoc team, which will review and decide on the PR/issue.