rustdoc-json: Fix HRTBs for WherePredicate::BoundPredicate
This commit is contained in:
parent
b712135575
commit
1f15ce5f97
2 changed files with 17 additions and 3 deletions
|
@ -350,10 +350,16 @@ impl FromWithTcx<clean::WherePredicate> for WherePredicate {
|
||||||
fn from_tcx(predicate: clean::WherePredicate, tcx: TyCtxt<'_>) -> Self {
|
fn from_tcx(predicate: clean::WherePredicate, tcx: TyCtxt<'_>) -> Self {
|
||||||
use clean::WherePredicate::*;
|
use clean::WherePredicate::*;
|
||||||
match predicate {
|
match predicate {
|
||||||
BoundPredicate { ty, bounds, .. } => WherePredicate::BoundPredicate {
|
BoundPredicate { ty, bounds, bound_params } => WherePredicate::BoundPredicate {
|
||||||
type_: ty.into_tcx(tcx),
|
type_: ty.into_tcx(tcx),
|
||||||
bounds: bounds.into_iter().map(|x| x.into_tcx(tcx)).collect(),
|
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 {
|
RegionPredicate { lifetime, bounds } => WherePredicate::RegionPredicate {
|
||||||
lifetime: lifetime.0.to_string(),
|
lifetime: lifetime.0.to_string(),
|
||||||
|
|
|
@ -9,7 +9,7 @@ use std::path::PathBuf;
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
|
|
||||||
/// rustdoc format-version.
|
/// 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
|
/// 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
|
/// 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")]
|
#[serde(rename = "type")]
|
||||||
type_: Type,
|
type_: Type,
|
||||||
bounds: Vec<GenericBound>,
|
bounds: Vec<GenericBound>,
|
||||||
|
/// Used for Higher-Rank Trait Bounds (HRTBs)
|
||||||
|
/// ```plain
|
||||||
|
/// where for<'a> &'a T: Iterator,"
|
||||||
|
/// ^^^^^^^
|
||||||
|
/// |
|
||||||
|
/// this part
|
||||||
|
/// ```
|
||||||
|
generic_params: Vec<GenericParamDef>,
|
||||||
},
|
},
|
||||||
RegionPredicate {
|
RegionPredicate {
|
||||||
lifetime: String,
|
lifetime: String,
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue