Skip to content

Function is not linked in docs if is has the same name as a struct and is re-exported #37342

Closed
@nwin

Description

@nwin

While docs for fn Foo are generated in the following they are not linked anywhere and can’t be found by using the search. fn Bar is linked on the other hand.

mod internal {
    pub struct Foo {
        _val: ()
    }

    #[allow(non_snake_case)] 
    pub fn Foo() -> Foo {
        Foo { _val: () }
    }   
}

pub struct Bar {
    _val: ()
}

#[allow(non_snake_case)] 
pub fn Bar() -> Bar {
    Bar { _val: () }
}

pub use internal::Foo;

fn main() {
    let _ = Foo();
    let _ = Bar();
}

On the other hand, when using pub use internal::* it works like expected. This is inconsistent as the function is clearly accessible from fn main in both cases.

Metadata

Metadata

Assignees

No one assigned

    Labels

    C-bugCategory: This is a bug.T-dev-toolsRelevant to the dev-tools subteam, which will review and decide on the PR/issue.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