diff --git a/src/librustdoc/json/conversions.rs b/src/librustdoc/json/conversions.rs index 56b02cd848041..412387313dc17 100644 --- a/src/librustdoc/json/conversions.rs +++ b/src/librustdoc/json/conversions.rs @@ -350,10 +350,16 @@ impl FromWithTcx for WherePredicate { fn from_tcx(predicate: clean::WherePredicate, tcx: TyCtxt<'_>) -> Self { use clean::WherePredicate::*; match predicate { - BoundPredicate { ty, bounds, .. } => WherePredicate::BoundPredicate { + BoundPredicate { ty, bounds, bound_params } => WherePredicate::BoundPredicate { type_: ty.into_tcx(tcx), bounds: bounds.into_iter().map(|x| x.into_tcx(tcx)).collect(), - // FIXME: add `bound_params` to rustdoc-json-params? + generic_params: bound_params + .into_iter() + .map(|x| GenericParamDef { + name: x.0.to_string(), + kind: GenericParamDefKind::Lifetime { outlives: vec![] }, + }) + .collect(), }, RegionPredicate { lifetime, bounds } => WherePredicate::RegionPredicate { lifetime: lifetime.0.to_string(), diff --git a/src/rustdoc-json-types/lib.rs b/src/rustdoc-json-types/lib.rs index c045db9b231f6..eb2c8e5bae1c4 100644 --- a/src/rustdoc-json-types/lib.rs +++ b/src/rustdoc-json-types/lib.rs @@ -9,7 +9,7 @@ use std::path::PathBuf; use serde::{Deserialize, Serialize}; /// rustdoc format-version. -pub const FORMAT_VERSION: u32 = 14; +pub const FORMAT_VERSION: u32 = 15; /// 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 @@ -391,6 +391,14 @@ pub enum WherePredicate { #[serde(rename = "type")] type_: Type, bounds: Vec, + /// Used for Higher-Rank Trait Bounds (HRTBs) + /// ```plain + /// where for<'a> &'a T: Iterator," + /// ^^^^^^^ + /// | + /// this part + /// ``` + generic_params: Vec, }, RegionPredicate { lifetime: String,