Skip to content

rustdoc-json: Invalid output for function returning public item from private module #96161

Description

@aDotInTheVoid
#![feature(no_core)]
#![no_core]
mod secret {
    pub struct Secret;
}

pub fn get_secret() -> secret::Secret {
    secret::Secret
}

Produces (redacted for clairty, full here)

{
    "includes_private": false,
    "index": {
        "0:0": {
            "id": "0:0",
            "inner": {
                "is_crate": true,
                "items": [
                    "0:4"
                ]
            },
            "kind": "module",
            "name": "hashbrown",
            "visibility": "public"
        },
        "0:4": {
            "id": "0:4",
            "inner": {
                "decl": {
                    "inputs": [],
                    "output": {
                        "inner": {
                            "id": "0:2",
                            "name": "secret::Secret"
                        },
                        "kind": "resolved_path"
                    }
                }
            },
            "kind": "function",
            "name": "get_secret",
            "visibility": "public"
        }
    },
    "root": "0:0"
}

Where 0:2 is a dangling Id.

This fails check_missing_items.py with output Type contained an invalid ID: 0:2

IMO the best way would be to include these "Hidden" items, as the items they have can still be called, even if their is no publicly visable way to write their type.
(eg)

This would also improve the HTML, which currently doesnt give links to such items. However it's unclear how to document such an item that doesn't appear in a path.

cc @CraftSpider

@rustbot modify labels: +T-rustdoc +A-rustdoc-json

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-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