Skip to content

rustdoc erroneously recognises typedefs of cross-crate typedefs as enums #12288

Closed
@chris-morgan

Description

@chris-morgan

a.rs:

#[crate_id = "a"];
#[crate_type = "lib"];
pub type A = int;
pub type B = A;

b.rs:

#[crate_id = "b"];
#[crate_type = "lib"];
extern crate a;
pub type A = a::A;
pub type B = a::B;

Now run rustc a.rs, rustdoc a.rs, rustdoc -L . b.rs.

Now take a look at the hyperlinks that rustdoc has produced in doc/{a,b}/typedef.{A,B}.html.

  • a::A is handled reasonably: primitive type int, no link.
  • a::B is handled reasonably: correct link to ../a/typedef.A.html.
  • b::A is not handled correctly: it is a link to ../a/enum.A.html.
  • b::B is not handled correctly: it is a link to ../a/enum.B.html.

Yes, for some reason a typedef to a typedef in an external crate is handled incorrectly, with the link being generated as though it were an enum.

This can be seen occurring in practice with rustuv::uvll::uv_uid_t being a typedef to std::libc::types::os::arch::posix88::uid_t. The link is to it as an enum, and broken, while the correct link is to it as a typedef.

Metadata

Metadata

Assignees

No one assigned

    Labels

    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