Skip to content

Commit b526d8f

Browse files
committed
rustdoc-json-types: ty -> type_
Fixes rust-lang#94889
1 parent 21b0325 commit b526d8f

File tree

4 files changed

+25
-11
lines changed

4 files changed

+25
-11
lines changed

src/etc/check_missing_items.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ def check_generics(generics):
3131
for where_predicate in generics["where_predicates"]:
3232
if "bound_predicate" in where_predicate:
3333
pred = where_predicate["bound_predicate"]
34-
check_type(pred["ty"])
34+
check_type(pred["type"])
3535
for bound in pred["bounds"]:
3636
check_generic_bound(bound)
3737
elif "region_predicate" in where_predicate:

src/librustdoc/json/conversions.rs

+5-4
Original file line numberDiff line numberDiff line change
@@ -345,9 +345,10 @@ impl FromWithTcx<clean::GenericParamDefKind> for GenericParamDefKind {
345345
default: default.map(|x| (*x).into_tcx(tcx)),
346346
synthetic,
347347
},
348-
Const { did: _, ty, default } => {
349-
GenericParamDefKind::Const { ty: (*ty).into_tcx(tcx), default: default.map(|x| *x) }
350-
}
348+
Const { did: _, ty, default } => GenericParamDefKind::Const {
349+
type_: (*ty).into_tcx(tcx),
350+
default: default.map(|x| *x),
351+
},
351352
}
352353
}
353354
}
@@ -357,7 +358,7 @@ impl FromWithTcx<clean::WherePredicate> for WherePredicate {
357358
use clean::WherePredicate::*;
358359
match predicate {
359360
BoundPredicate { ty, bounds, .. } => WherePredicate::BoundPredicate {
360-
ty: ty.into_tcx(tcx),
361+
type_: ty.into_tcx(tcx),
361362
bounds: bounds.into_iter().map(|x| x.into_tcx(tcx)).collect(),
362363
// FIXME: add `bound_params` to rustdoc-json-params?
363364
},

src/rustdoc-json-types/lib.rs

+15-4
Original file line numberDiff line numberDiff line change
@@ -378,17 +378,28 @@ pub enum GenericParamDefKind {
378378
synthetic: bool,
379379
},
380380
Const {
381-
ty: Type,
381+
#[serde(rename = "type")]
382+
type_: Type,
382383
default: Option<String>,
383384
},
384385
}
385386

386387
#[derive(Clone, Debug, Serialize, Deserialize, PartialEq)]
387388
#[serde(rename_all = "snake_case")]
388389
pub enum WherePredicate {
389-
BoundPredicate { ty: Type, bounds: Vec<GenericBound> },
390-
RegionPredicate { lifetime: String, bounds: Vec<GenericBound> },
391-
EqPredicate { lhs: Type, rhs: Term },
390+
BoundPredicate {
391+
#[serde(rename = "type")]
392+
type_: Type,
393+
bounds: Vec<GenericBound>,
394+
},
395+
RegionPredicate {
396+
lifetime: String,
397+
bounds: Vec<GenericBound>,
398+
},
399+
EqPredicate {
400+
lhs: Type,
401+
rhs: Term,
402+
},
392403
}
393404

394405
#[derive(Clone, Debug, Serialize, Deserialize, PartialEq)]

src/test/rustdoc-json/generic-associated-types/gats.rs

+4-2
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,12 @@ pub trait LendingIterator {
1313
// @count - "$.index[*][?(@.name=='LendingItem')].inner.generics.params[*]" 1
1414
// @is - "$.index[*][?(@.name=='LendingItem')].inner.generics.params[*].name" \"\'a\"
1515
// @count - "$.index[*][?(@.name=='LendingItem')].inner.generics.where_predicates[*]" 1
16-
// @is - "$.index[*][?(@.name=='LendingItem')].inner.generics.where_predicates[*].bound_predicate.ty.inner" \"Self\"
16+
// @is - "$.index[*][?(@.name=='LendingItem')].inner.generics.where_predicates[*].bound_predicate.type.inner" \"Self\"
1717
// @is - "$.index[*][?(@.name=='LendingItem')].inner.generics.where_predicates[*].bound_predicate.bounds[*].outlives" \"\'a\"
1818
// @count - "$.index[*][?(@.name=='LendingItem')].inner.bounds[*]" 1
19-
type LendingItem<'a>: Display where Self: 'a;
19+
type LendingItem<'a>: Display
20+
where
21+
Self: 'a;
2022

2123
// @is - "$.index[*][?(@.name=='lending_next')].inner.decl.output.kind" \"qualified_path\"
2224
// @count - "$.index[*][?(@.name=='lending_next')].inner.decl.output.inner.args.angle_bracketed.args[*]" 1

0 commit comments

Comments
 (0)