Skip to content

Attribute representation change in rustdoc JSON without version bump #140689

Description

@obi1kenobi

Rustdoc JSON is a public but unstable API, whose contract is that behavior changes are signaled by incrementing its embedded version number.

Unfortunately, rustdoc JSON format v45 appears to have suffered a behavior change without a corresponding version bump. This was caught by the test suites of cargo-semver-checks and its components, which used to pass on the initial nightly version where format v45 was released but no longer pass:
https://github.com/obi1kenobi/trustfall-rustdoc-adapter/actions/runs/14585442486/job/41627682245

Output {
         instantiated_name: "Clone",
         attrs: [
-            "#[automatically_derived]",
+            "#[automatically_derived]\n",
         ],
         canonical_path: [
             "core",
             "clone",

in rustc 1.88.0-nightly (13e879094 2025-05-04)

At a glance, this may have been due to #140606. It may be sufficient to strip the trailing whitespace at the time rustdoc JSON is created to recover the original behavior.

Activity

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

Metadata

Metadata

Assignees

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.

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions