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: Fake span given for auto trait impls #100283

Closed
aDotInTheVoid opened this issue Aug 8, 2022 · 0 comments · Fixed by #100299
Closed

Rustdoc-Json: Fake span given for auto trait impls #100283

aDotInTheVoid opened this issue Aug 8, 2022 · 0 comments · Fixed by #100299
Labels
A-rustdoc-json Area: Rustdoc JSON backend T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue.

Comments

@aDotInTheVoid
Copy link
Member

// Signifigant whitespace


pub struct Foo;

gives

    "a:2:9232:1965-0:3:1539": {
      "attrs": [],
      "crate_id": 0,
      "deprecation": null,
      "docs": null,
      "id": "a:2:9232:1965-0:3:1539",
      "inner": {
        "blanket_impl": null,
        "for": {
          "inner": {
            "args": {
              "angle_bracketed": {"args": [], "bindings": []}
            },
            "id": "0:3:1539",
            "name": "Foo",
            "param_names": []
          },
          "kind": "resolved_path"
        },
        "generics": {"params": [], "where_predicates": []},
        "is_unsafe": false,
        "items": [],
        "negative": false,
        "provided_trait_methods": [],
        "synthetic": true,
        "trait": {
          "inner": {
            "args": {
              "angle_bracketed": {"args": [], "bindings": []}
            },
            "id": "2:9232:1965",
            "name": "RefUnwindSafe",
            "param_names": []
          },
          "kind": "resolved_path"
        }
      },
      "kind": "impl",
      "links": {},
      "name": null,
      "span": {
        "begin": [1, 0],
        "end": [1, 0],
        "filename": "bad.rs"
      },
      "visibility": "default"
    }

with a given span of {"begin": [1, 0], "end": [1, 0], "filename": "bad.rs" }, which is not correct.

I think the span should probably be None/null in this case, which is suported without changing the schema (span: Option<Span> in rustdoc_json_types::Item

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

@rustbot rustbot added A-rustdoc-json Area: Rustdoc JSON backend T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue. labels Aug 8, 2022
Dylan-DPC added a commit to Dylan-DPC/rust that referenced this issue Aug 12, 2022
…triddle

make `clean::Item::span` return `Option` instead of dummy span

Fixes rust-lang#100283
Dylan-DPC added a commit to Dylan-DPC/rust that referenced this issue Aug 12, 2022
…triddle

make `clean::Item::span` return `Option` instead of dummy span

Fixes rust-lang#100283
@bors bors closed this as completed in d496c4e Aug 14, 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 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.

2 participants