Skip to content

Rustdoc: Resolve to wrong mod when use glob reexport and non-glob reexport together #83632

Closed
@longfangsong

Description

@longfangsong

I'm trying to work on #83375, but found a related but not same bug:

I run rustdoc on this code:

// resolve.rs
pub mod sub {
    pub struct Item;

    /// sub::prelude
    pub mod prelude {
        pub use super::Item;

        pub fn describe() -> &'static str {
            "sub::prelude"
        }
    }
}

pub mod sub2 {
    pub struct Item;

    /// sub2::prelude
    pub mod prelude {
        pub use super::Item;
        pub fn describe() -> &'static str {
            "sub2::prelude"
        }
    }
}

#[doc(inline)]
pub use sub::*;

#[doc(inline)]
pub use sub2::prelude;

I expected to see this happen:
Only one prelude link exists and it resolves to sub2::prelude (if you do println!("{}", resolve::prelude::describe());, you'll get the output sub2::prelude)

Instead, this happened:

  1. Similiar with Rustdoc: glob reexport may duplicate module #83375 described, there are two preludes here:

图片

  1. Moreover, if you visit either of the prelude links, it direct you to sub::prelude

截屏2021-03-29 下午3 48 43

Meta

rustdoc +local --version:

rustdoc 1.53.0-dev
Backtrace

NA

Metadata

Metadata

Assignees

No one assigned

    Labels

    C-bugCategory: This is a bug.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