Skip to content

rustdoc-json: Path::name docs say it only has the item name, but it has the full name. #134853

Closed
@aDotInTheVoid

Description

@aDotInTheVoid

With this code:

pub mod foo {
    pub struct Bar;
}

pub fn get_bar() -> foo::Bar {
    foo::Bar
}

Running rustdoc +nightly ./demo.rs -wjson -Zunstable-options gives:

    {
      "inner": {
        "function": {
          "sig": {
            "inputs": [],
            "is_c_variadic": false,
            "output": {
              "resolved_path": {
                "args": {"angle_bracketed": {"args": [], "constraints": []}},
                "id": 0,
                "name": "foo::Bar"
              }
            }
          }
        }
      },
      "name": "get_bar",
    }

Where we have "name": "foo::Bar"

However the docs for Path::name say:

The name of the type as declared, e.g. in

mod foo {
    struct Bar;
}

for foo::Bar, this field will be Bar.

Either we need to change the docs, or the how the field is generated. I'm not certain which is better.

version: rustdoc 1.85.0-nightly (dd84b7d 2024-12-27)

Originally reported by @AS1100K as rust-lang/rustdoc-types#45

Metadata

Metadata

Assignees

Labels

A-docsArea: Documentation for any part of the project, including the compiler, standard library, and toolsA-rustdoc-jsonArea: Rustdoc JSON backendT-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