Skip to content

Rustdoc shouldn't list modules only alphabetically #8552

Closed
@orenbenkiki

Description

@orenbenkiki

Instead it should use the order that pub mod foo appear in the crate file. Even better, it should allow adding section headers (with a description) between them. Hypothetically:

/// Modules for foo-ing.
pub mod foo;

/// Modules for ba-ing. Ba-ing has several variants, all distinct from foo-ing.
pub mod bar;
pub mod baz;

And get something like this:

Modules

Modules for foo-ing

foo - Description of foo.

Modules for ba-ing

Ba-ing is distinct from foo-ing.

bar - Description for bar.
baz - Description for baz.

This would make both the source code and the documentation more accessible as the modules would be presented in a comprehensible order, with some description of each related group of modules.

Edit: Rename issue to reflect that this isn't an either-or. Alphabetical order is useful, but so is programmer-specified order (to make the code accessible for newcomers) and Rustdoc should support both - see the thread below.

Metadata

Metadata

Assignees

No one assigned

    Labels

    C-enhancementCategory: An issue proposing an enhancement or a PR with one.T-dev-toolsRelevant to the dev-tools subteam, which will review and decide on the PR/issue.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