Skip to content

Funky rustdoc behavior when pub use path_to::Trait as _; for public-in-private item #92379

Description

@steffahn

Something like

mod m {
    pub trait Hello {
        fn hello() {}
    }
    pub trait World {
        fn world() {}
    }
}

pub use m::Hello as _;
pub use m::World as _;

creates documentation listing two traits called "_"

Screenshot_325

both of which link to the same URL .../target/doc/crate_name/trait._.html and which contains documentation for one of the two traits, chosen seemingly at random.

When I add a few implementations, sometimes (not very reproducably) I've even gotten a weirdly broken page. E.g. I sometimes get

mod m {
    pub trait Hello {
        fn hello() {}
    }

    pub trait World {
        fn world() {}
    }

    impl World for u8 {
        fn world() {}
    }

    impl World for u16 {
        fn world() {}
    }

    impl World for u32 {
        fn world() {}
    }
}

pub use m::Hello as _;
pub use m::World as _;

to generate a page that looks like this

Screenshot_326

@rustbot label T-rustdoc, A-rustdoc-ui

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-rustdoc-uiArea: Rustdoc UI (generated HTML)C-bugCategory: This is a bug.T-rustdocRelevant to the rustdoc team, which will review and decide on the PR/issue.

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions