Skip to content

Commit 1f15ce5

Browse files
committed
rustdoc-json: Fix HRTBs for WherePredicate::BoundPredicate
1 parent b712135 commit 1f15ce5

File tree

2 files changed

+17
-3
lines changed

2 files changed

+17
-3
lines changed

src/librustdoc/json/conversions.rs

+8-2
Original file line numberDiff line numberDiff line change
@@ -350,10 +350,16 @@ impl FromWithTcx<clean::WherePredicate> for WherePredicate {
350350
fn from_tcx(predicate: clean::WherePredicate, tcx: TyCtxt<'_>) -> Self {
351351
use clean::WherePredicate::*;
352352
match predicate {
353-
BoundPredicate { ty, bounds, .. } => WherePredicate::BoundPredicate {
353+
BoundPredicate { ty, bounds, bound_params } => WherePredicate::BoundPredicate {
354354
type_: ty.into_tcx(tcx),
355355
bounds: bounds.into_iter().map(|x| x.into_tcx(tcx)).collect(),
356-
// FIXME: add `bound_params` to rustdoc-json-params?
356+
generic_params: bound_params
357+
.into_iter()
358+
.map(|x| GenericParamDef {
359+
name: x.0.to_string(),
360+
kind: GenericParamDefKind::Lifetime { outlives: vec![] },
361+
})
362+
.collect(),
357363
},
358364
RegionPredicate { lifetime, bounds } => WherePredicate::RegionPredicate {
359365
lifetime: lifetime.0.to_string(),

src/rustdoc-json-types/lib.rs

+9-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ use std::path::PathBuf;
99
use serde::{Deserialize, Serialize};
1010

1111
/// rustdoc format-version.
12-
pub const FORMAT_VERSION: u32 = 14;
12+
pub const FORMAT_VERSION: u32 = 15;
1313

1414
/// A `Crate` is the root of the emitted JSON blob. It contains all type/documentation information
1515
/// about the language items in the local crate, as well as info about external items to allow
@@ -391,6 +391,14 @@ pub enum WherePredicate {
391391
#[serde(rename = "type")]
392392
type_: Type,
393393
bounds: Vec<GenericBound>,
394+
/// Used for Higher-Rank Trait Bounds (HRTBs)
395+
/// ```plain
396+
/// where for<'a> &'a T: Iterator,"
397+
/// ^^^^^^^
398+
/// |
399+
/// this part
400+
/// ```
401+
generic_params: Vec<GenericParamDef>,
394402
},
395403
RegionPredicate {
396404
lifetime: String,

0 commit comments

Comments
 (0)