Skip to content

rustdoc-json: Default value of assoc type in blanket impls missing #98658

Closed
@Enselic

Description

@Enselic

Step-by-step

Run cargo +nightly-2022-06-29 rustdoc -- -Z unstable-options --output-format json with this in src/lib.rs:

pub struct S;

and inspect target/doc/repro.json.

Expected result

There is an item for the Error of the blanket impl impl<T, U> const TryFrom<U> for T where U: ~const Into<T> and it's default value is Infallible.

Actual

There is an item but the default value is missing. It looks like this:

"2:3121:123": {
    "id": "2:3121:123",
    "crate_id": 2,
    "name": "Error",
    "span": null,
    "visibility": "default",
    "docs": null,
    "links": {},
    "attrs": [],
    "deprecation": null,
    "kind": "assoc_type",
    "inner": {
        "generics": {
            "params": [],
            "where_predicates": []
        },
        "bounds": [],
        "default": null
    }
},

When using nightly-2022-06-28 instead of nightly-2022-06-29 the information about the default value is present. It looks like this:

"2:3126:123": {
    "id": "2:3126:123",
    "crate_id": 2,
    "name": "Error",
    "span": null,
    "visibility": "default",
    "docs": null,
    "links": {},
    "attrs": [],
    "deprecation": null,
    "kind": "typedef",
    "inner": {
        "type": {
            "kind": "resolved_path",
            "inner": {
                "name": "Infallible",
                "id": "2:31923:1960",
                "args": {
                    "angle_bracketed": {
                        "args": [],
                        "bindings": []
                    }
                },
                "param_names": []
            }
        },
        "generics": {
            "params": [],
            "where_predicates": []
        }
    }
},

This change, which in practice is a regression, is caused by #98577. But we can't revert it of course because that will result in ICEs which is even worse. So we need some kind of follow-up fix.

@rustbot labels +A-rustdoc-json +T-rustdoc +C-bug +requires-nightly

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-rustdoc-jsonArea: Rustdoc JSON backendC-bugCategory: This is a bug.T-rustdocRelevant to the rustdoc team, which will review and decide on the PR/issue.requires-nightlyThis issue requires a nightly compiler in some way.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions