Skip to content
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

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

Closed
nagisa opened this issue May 3, 2019 · 1 comment · Fixed by #110760
Closed

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

nagisa opened this issue May 3, 2019 · 1 comment · Fixed by #110760
Labels
C-bug Category: This is a bug. E-needs-test Call for participation: An issue has been fixed and does not reproduce, but no test has been added. T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue.

Comments

@nagisa
Copy link
Member

nagisa commented May 3, 2019

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

@kadiwa4
Copy link
Contributor

kadiwa4 commented Jan 17, 2023

This has been fixed.
image

@rustbot label: +E-needs-test

@rustbot rustbot added the E-needs-test Call for participation: An issue has been fixed and does not reproduce, but no test has been added. label Jan 17, 2023
GuillaumeGomez added a commit to GuillaumeGomez/rust that referenced this issue Apr 24, 2023
bors added a commit to rust-lang-ci/rust that referenced this issue Apr 24, 2023
Rollup of 10 pull requests

Successful merges:

 - rust-lang#110480 (Add `known-bug` tests for 11 unsound issues)
 - rust-lang#110539 (Move around `{Idx, IndexVec, IndexSlice}` adjacent code)
 - rust-lang#110590 (Add some tests around (lack of) object safety of associated types and consts)
 - rust-lang#110602 (Ignore src/bootstrap formatting commit in .git-blame-ignore-revs)
 - rust-lang#110667 (pointer-auth-link-with-c: Fix cross compilation.)
 - rust-lang#110681 (drop few unused crates, gate libc under unix for rustc_codegen_ssa)
 - rust-lang#110685 (Some cleanups to DataflowConstProp)
 - rust-lang#110744 (bootstrap: update paths cargo-credential crate)
 - rust-lang#110750 (Add size asserts for MIR `SourceScopeData` & `VarDebugInfo`)
 - rust-lang#110760 (rustdoc: Add regression test for rust-lang#60522)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
@bors bors closed this as completed in 513c0cc Apr 24, 2023
RalfJung pushed a commit to RalfJung/miri that referenced this issue Apr 26, 2023
rustdoc: Add regression test for #60522

Fixes rust-lang/rust#60522.

r? `@notriddle`
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-bug Category: This is a bug. E-needs-test Call for participation: An issue has been fixed and does not reproduce, but no test has been added. T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants