X-Git-Url: https://git.lizzy.rs/?a=blobdiff_plain;f=src%2Frustdoc-json-types%2Flib.rs;h=17b3859a77b645a0053f77263f12484df818418f;hb=416d600a9ad31d7f790b1f0b1ef969faa1bf2b4f;hp=40b0de448293ac5fada8edd894b74104a65cf5c9;hpb=f58d51b3c00b1e30acd75aead202eb2248bb33f9;p=rust.git diff --git a/src/rustdoc-json-types/lib.rs b/src/rustdoc-json-types/lib.rs index 40b0de44829..17b3859a77b 100644 --- a/src/rustdoc-json-types/lib.rs +++ b/src/rustdoc-json-types/lib.rs @@ -9,7 +9,7 @@ use serde::{Deserialize, Serialize}; /// rustdoc format-version. -pub const FORMAT_VERSION: u32 = 12; +pub const FORMAT_VERSION: u32 = 14; /// A `Crate` is the root of the emitted JSON blob. It contains all type/documentation information /// about the language items in the local crate, as well as info about external items to allow @@ -346,17 +346,60 @@ pub struct GenericParamDef { #[derive(Clone, Debug, Serialize, Deserialize, PartialEq)] #[serde(rename_all = "snake_case")] pub enum GenericParamDefKind { - Lifetime { outlives: Vec }, - Type { bounds: Vec, default: Option }, - Const { ty: Type, default: Option }, + Lifetime { + outlives: Vec, + }, + Type { + bounds: Vec, + default: Option, + /// This is normally `false`, which means that this generic parameter is + /// declared in the Rust source text. + /// + /// If it is `true`, this generic parameter has been introduced by the + /// compiler behind the scenes. + /// + /// # Example + /// + /// Consider + /// + /// ```ignore (pseudo-rust) + /// pub fn f(_: impl Trait) {} + /// ``` + /// + /// The compiler will transform this behind the scenes to + /// + /// ```ignore (pseudo-rust) + /// pub fn f(_: impl Trait) {} + /// ``` + /// + /// In this example, the generic parameter named `impl Trait` (and which + /// is bound by `Trait`) is synthetic, because it was not originally in + /// the Rust source text. + synthetic: bool, + }, + Const { + #[serde(rename = "type")] + type_: Type, + default: Option, + }, } #[derive(Clone, Debug, Serialize, Deserialize, PartialEq)] #[serde(rename_all = "snake_case")] pub enum WherePredicate { - BoundPredicate { ty: Type, bounds: Vec }, - RegionPredicate { lifetime: String, bounds: Vec }, - EqPredicate { lhs: Type, rhs: Term }, + BoundPredicate { + #[serde(rename = "type")] + type_: Type, + bounds: Vec, + }, + RegionPredicate { + lifetime: String, + bounds: Vec, + }, + EqPredicate { + lhs: Type, + rhs: Term, + }, } #[derive(Clone, Debug, Serialize, Deserialize, PartialEq)] @@ -462,7 +505,7 @@ pub struct Trait { pub items: Vec, pub generics: Generics, pub bounds: Vec, - pub implementors: Vec, + pub implementations: Vec, } #[derive(Clone, Debug, Serialize, Deserialize, PartialEq)]