Skip to content

Duplicate Impl/Traits with rustdoc when using "pub use foo::bar::*" #21474

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
NewbiZ opened this issue Jan 21, 2015 · 4 comments
Closed

Duplicate Impl/Traits with rustdoc when using "pub use foo::bar::*" #21474

NewbiZ opened this issue Jan 21, 2015 · 4 comments
Assignees
Labels
T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue.

Comments

@NewbiZ
Copy link

NewbiZ commented Jan 21, 2015

It seems like using glob on use statements ends up generating twice the documentation for Impl and Traits of this Struct.

If I use:

pub use foo::bar::*;

All Impl and Traits of each Struct in foo::bar::* will be duplicated in the doc.
If symbols are listed one by one it works well:

pub use foo::bar::baz;
pub use foo::bar::boz;

Issue can be seen when generating the doc from https://github.com/NewbiZ/rgb/tree/2d3d077120d51bdef42f2e6a83595d2b26a6e04c

If you change in src/lib.rs:

pub use self::cpu::*;

by

pub use self::cpu::Cpu;
pub use self::cpu::Flag;

it will work.

@Gankra
Copy link
Contributor

Gankra commented Jan 21, 2015

I can't seem to find a pre-existing issue for this, even though it's been around for months...

@tomjakubowski are you aware of an issue for this?

@Gankra Gankra added the T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue. label Jan 21, 2015
@steveklabnik
Copy link
Member

I wonder if globs or rustdoc itself are at fault.

@Gankra
Copy link
Contributor

Gankra commented Jan 21, 2015

Almost certainly Rustdoc.

It's always rustdoc's fault.

@tomjakubowski
Copy link
Contributor

@gankro I don't remember seeing an issue for this in the tracker. I also wasn't aware this was an issue, what a bizarre quirk!

Here's a minimal reproduction. Note that only the impl needs to be in the mod, and the globbed pub use is required.

pub use inner::*;

mod inner {
    impl super::Blah for super::What { }
}

pub trait Blah { }

pub struct What;

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue.
Projects
None yet
Development

No branches or pull requests

5 participants