Skip to content

rustdoc: types used in exported type definitions are not documented. #39437

@olson-sean-k

Description

@olson-sean-k

When I generate docs via cargo doc, types used in type definitions are not documented. This is a problem when a module exports a type definition but not the types on which it is based, because even though the type definition is documented, it is entirely opaque.

For example:

pub mod foo {
    mod bar {
        pub struct Foo<T> { ... }
        impl<T> Foo<T> { ... }
    }
    pub type Foo = bar::Foo<i32>;
}

None of the methods on foo::bar::Foo<T> will be documented, and the documentation for foo::Foo will be nothing more than its type definition (and any documentation on the type definition itself).

I've tried removing the skip-private pass using the following command, and that still does not document the types used in the type definitions:

cargo rustdoc -- --passes=strip-hidden --passes=collapse-docs --passes=unindent-comments

Is this the expected behavior? Is there some way to document these types without exporting them?

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-reachable-privIssues involving private types that are indirectly reachable or effect the public apiC-bugCategory: This is a bug.T-rustdocRelevant to the rustdoc team, which will review and decide on the PR/issue.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions