missing_docs does not trigger for types only used in exported fields of enumerations
IMO, this should be a compilation failure because although Foo is not explicitly exported, it is publicly visible via the Bar::A variant:
lib.rs:
#![deny(missing_docs)]
mod types;
pub use types::Bar;
types.rs:
pub struct Foo;
/// A bar.
pub enum Bar {
/// A `Bar` variant.
A(Foo),
}
Oddly enough, it seems to also be happy with the missing crate-level docs…
Using 1.14.0 (from Fedora's repository).
Hmm, even documenting it does not make it hyperlinked in the generated docs. What is the expected behavior here?
Ben Boeckel at 2017-01-18 20:25:35
You need to make the
typesmodule public.Alex Burka at 2017-01-18 22:06:14
Yeah, that makes the errors appear (as does re-exporting
Foofromlib.rs). I'm not in front of a compiler right now, but IIRC, removing thepubfromFoois a compiler error; why is it not also a doc error?Ben Boeckel at 2017-01-19 01:31:37
Yep, removing the
pubfromFoomakes it error out that it can't leak private types. So, should the same behavior apply formissing_docs(since this is "leaking an undocumented public type")?Ben Boeckel at 2017-01-19 14:25:16
Updated description to include
!in#![deny(missing_docs)], which made the lint error on the crate documentation, but still no errors aboutFooitself.Mark Rousskov at 2017-05-20 01:41:10
It was a bit of a surprise when I realized an important type that users are exposed to in one of my libraries was not properly documented, despite the crate specifying
#![deny(missing_docs)]. My use case looked a bit like this.Tyler Neely at 2018-01-07 21:35:46