Skip to content

Glob-duplicated item names produce duplicated entries in rustdoc #60522

Closed
@nagisa

Description

@nagisa

Consider such code:

mod my_crate {
    pub mod banana { // 1
        pub struct Yellow;
    }
    pub mod peach { // 1
        pub struct Pink;
    }
}

pub use crate::my_crate::*;

pub mod banana { // 2
    pub struct Brown;
}

pub mod peach { // 2
    pub struct Pungent;
}

Due to how glob-import conflict resolution works (please correct me if I’m wrong @petrochenkov), when referring to the names banana and peach, only the banana//2 and peach//2 can be referred to.

rustdoc will include both the modules into the output, repeated:

rustdoc output with repeated banana and peach modules

Moreover, both of the duplicated links actually refer to the same module index, so whether you end up seeing the correct module or the wrong one is a matter of luck(?). In my case all the modules render empty, suggesting the wrong module having been rendered.

The list of all items will (correctly) contain the Brown and Pungent structures, but not the unreachable Yellow or Pink ones:

list of all items in crate, with Brown and Pungent visible

Metadata

Metadata

Assignees

No one assigned

    Labels

    C-bugCategory: This is a bug.E-needs-testCall for participation: An issue has been fixed and does not reproduce, but no test has been added.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