Attribute representation change in rustdoc JSON without version bump · Issue #140689 · rust-lang/rust (original) (raw)

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: [

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.