Skip to content

Commit 51cbcca

Browse files
committed
fix rustdoc
1 parent 072cc45 commit 51cbcca

File tree

1 file changed

+14
-24
lines changed

1 file changed

+14
-24
lines changed

src/librustdoc/clean/mod.rs

+14-24
Original file line numberDiff line numberDiff line change
@@ -482,12 +482,12 @@ impl<'a> Clean<Option<WherePredicate>> for ty::Predicate<'a> {
482482
fn clean(&self, cx: &DocContext<'_>) -> Option<WherePredicate> {
483483
match self.skip_binders() {
484484
ty::PredicateAtom::Trait(pred, _) => Some(ty::Binder::bind(pred).clean(cx)),
485-
ty::PredicateAtom::Subtype(pred) => Some(ty::Binder::bind(pred).clean(cx)),
486-
ty::PredicateAtom::RegionOutlives(pred) => ty::Binder::bind(pred).clean(cx),
487-
ty::PredicateAtom::TypeOutlives(pred) => ty::Binder::bind(pred).clean(cx),
488-
ty::PredicateAtom::Projection(pred) => Some(ty::Binder::bind(pred).clean(cx)),
485+
ty::PredicateAtom::RegionOutlives(pred) => pred.clean(cx),
486+
ty::PredicateAtom::TypeOutlives(pred) => pred.clean(cx),
487+
ty::PredicateAtom::Projection(pred) => Some(pred.clean(cx)),
489488

490-
ty::PredicateAtom::WellFormed(..)
489+
ty::PredicateAtom::Subtype(..)
490+
| ty::PredicateAtom::WellFormed(..)
491491
| ty::PredicateAtom::ObjectSafe(..)
492492
| ty::PredicateAtom::ClosureKind(..)
493493
| ty::PredicateAtom::ConstEvaluatable(..)
@@ -506,20 +506,11 @@ impl<'a> Clean<WherePredicate> for ty::PolyTraitPredicate<'a> {
506506
}
507507
}
508508

509-
impl<'tcx> Clean<WherePredicate> for ty::PolySubtypePredicate<'tcx> {
510-
fn clean(&self, _cx: &DocContext<'_>) -> WherePredicate {
511-
panic!(
512-
"subtype predicates are an internal rustc artifact \
513-
and should not be seen by rustdoc"
514-
)
515-
}
516-
}
517-
518509
impl<'tcx> Clean<Option<WherePredicate>>
519-
for ty::PolyOutlivesPredicate<ty::Region<'tcx>, ty::Region<'tcx>>
510+
for ty::OutlivesPredicate<ty::Region<'tcx>, ty::Region<'tcx>>
520511
{
521512
fn clean(&self, cx: &DocContext<'_>) -> Option<WherePredicate> {
522-
let ty::OutlivesPredicate(a, b) = self.skip_binder();
513+
let ty::OutlivesPredicate(a, b) = self;
523514

524515
if let (ty::ReEmpty(_), ty::ReEmpty(_)) = (a, b) {
525516
return None;
@@ -532,9 +523,9 @@ impl<'tcx> Clean<Option<WherePredicate>>
532523
}
533524
}
534525

535-
impl<'tcx> Clean<Option<WherePredicate>> for ty::PolyOutlivesPredicate<Ty<'tcx>, ty::Region<'tcx>> {
526+
impl<'tcx> Clean<Option<WherePredicate>> for ty::OutlivesPredicate<Ty<'tcx>, ty::Region<'tcx>> {
536527
fn clean(&self, cx: &DocContext<'_>) -> Option<WherePredicate> {
537-
let ty::OutlivesPredicate(ty, lt) = self.skip_binder();
528+
let ty::OutlivesPredicate(ty, lt) = self;
538529

539530
if let ty::ReEmpty(_) = lt {
540531
return None;
@@ -547,9 +538,9 @@ impl<'tcx> Clean<Option<WherePredicate>> for ty::PolyOutlivesPredicate<Ty<'tcx>,
547538
}
548539
}
549540

550-
impl<'tcx> Clean<WherePredicate> for ty::PolyProjectionPredicate<'tcx> {
541+
impl<'tcx> Clean<WherePredicate> for ty::ProjectionPredicate<'tcx> {
551542
fn clean(&self, cx: &DocContext<'_>) -> WherePredicate {
552-
let ty::ProjectionPredicate { projection_ty, ty } = self.skip_binder();
543+
let ty::ProjectionPredicate { projection_ty, ty } = self;
553544
WherePredicate::EqPredicate { lhs: projection_ty.clean(cx), rhs: ty.clean(cx) }
554545
}
555546
}
@@ -1666,8 +1657,8 @@ impl<'tcx> Clean<Type> for Ty<'tcx> {
16661657
ty::PredicateAtom::Trait(tr, _constness) => {
16671658
ty::Binder::bind(tr.trait_ref)
16681659
}
1669-
ty::PredicateAtom::TypeOutlives(pred) => {
1670-
if let Some(r) = pred.1.clean(cx) {
1660+
ty::PredicateAtom::TypeOutlives(ty::OutlivesPredicate(_ty, reg)) => {
1661+
if let Some(r) = reg.clean(cx) {
16711662
regions.push(GenericBound::Outlives(r));
16721663
}
16731664
return None;
@@ -1686,9 +1677,8 @@ impl<'tcx> Clean<Type> for Ty<'tcx> {
16861677
.predicates
16871678
.iter()
16881679
.filter_map(|pred| {
1689-
// We never rebind `proj`, so `skip_binders_unchecked` is safe here.
16901680
if let ty::PredicateAtom::Projection(proj) =
1691-
pred.skip_binders_unchecked()
1681+
pred.bound_atom(cx.tcx).skip_binder()
16921682
{
16931683
if proj.projection_ty.trait_ref(cx.tcx)
16941684
== trait_ref.skip_binder()

0 commit comments

Comments
 (0)