Open
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.