mirror of
https://github.com/rust-lang/rust.git
synced 2025-12-30 04:15:30 +00:00
[rustdoc-json] Make `header` a vec of modifiers, and FunctionPointer consistent Bumps version number and adds tests, this is a breaking change. I can split this into two (`is_unsafe` -> `header` and `header: Vec<Modifiers>`) if desired. Rationale: Modifiers are individual notes on a function, it makes more sense for them to be a list of an independent enum over a String which is inconsistently exposing the HIR representation (prefix_str vs custom literals). Function pointers currently only support `unsafe`, but there has been talk on and off about allowing them to also support `const`, and this makes handling their modifiers consistent with handling those of a function, allowing better shared code. `@rustbot` modify labels: +A-rustdoc-json +T-rustdoc CC: `@HeroicKatora` r? `@jyn514`
Rustdoc JSON Types
This crate exposes the Rustdoc JSON API as a set of types with serde implementations. These types are part of the public interface of the rustdoc JSON output, and making them their own crate allows them to be versioned and distributed without having to depend on any rustc/rustdoc internals. This way, consumers can rely on this crate for both documentation of the output, and as a way to read the output easily, and its versioning is intended to follow semver guarantees about the version of the format. JSON format X will always be compatible with rustdoc-json-types version N.
Currently, this crate is only used by rustdoc itself. Upon the stabilization of rustdoc-json, it may be distributed separately for consumers of the API.