Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
Enselic opened this issue Jun 29, 2022 · 3 comments · Fixed by #98681
Closed

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

Enselic opened this issue Jun 29, 2022 · 3 comments · Fixed by #98681
Labels
A-rustdoc-json Area: Rustdoc JSON backend C-bug Category: This is a bug. requires-nightly This issue requires a nightly compiler in some way. T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue.

Comments

@Enselic
Copy link
Member

Enselic commented Jun 29, 2022

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

@rustbot rustbot added A-rustdoc-json Area: Rustdoc JSON backend C-bug Category: This is a bug. requires-nightly This issue requires a nightly compiler in some way. T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue. labels Jun 29, 2022
@GuillaumeGomez
Copy link
Member

It seems like you already suggested a fix. Want to open a PR for it?

@Enselic
Copy link
Member Author

Enselic commented Jun 29, 2022

Yep I will do that as soon as I get time. Probably today.

@GuillaumeGomez
Copy link
Member

It's not in a hurry. Don't hesitate to ask if you need help.

matthiaskrgr added a commit to matthiaskrgr/rust that referenced this issue Jun 29, 2022
…type-blanket-impl, r=GuillaumeGomez

rustdoc-json: Make default value of blanket impl assoc types work

Closes rust-lang#98658

r? `@GuillaumeGomez`

`@rustbot` labels +A-rustdoc-json
@bors bors closed this as completed in 6d6b30c Jun 30, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-rustdoc-json Area: Rustdoc JSON backend C-bug Category: This is a bug. requires-nightly This issue requires a nightly compiler in some way. T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants