Skip to content

Commit 9dcf1d9

Browse files
committed
rustdoc: remove Clean trait impl for ty::PolyTraitPredicate
1 parent e94ef5c commit 9dcf1d9

File tree

1 file changed

+19
-16
lines changed

1 file changed

+19
-16
lines changed

Diff for: src/librustdoc/clean/mod.rs

+19-16
Original file line numberDiff line numberDiff line change
@@ -327,7 +327,9 @@ impl<'tcx> Clean<'tcx, Option<WherePredicate>> for ty::Predicate<'tcx> {
327327
fn clean(&self, cx: &mut DocContext<'tcx>) -> Option<WherePredicate> {
328328
let bound_predicate = self.kind();
329329
match bound_predicate.skip_binder() {
330-
ty::PredicateKind::Trait(pred) => bound_predicate.rebind(pred).clean(cx),
330+
ty::PredicateKind::Trait(pred) => {
331+
clean_poly_trait_predicate(bound_predicate.rebind(pred), cx)
332+
}
331333
ty::PredicateKind::RegionOutlives(pred) => clean_region_outlives_predicate(pred, cx),
332334
ty::PredicateKind::TypeOutlives(pred) => clean_type_outlives_predicate(pred, cx),
333335
ty::PredicateKind::Projection(pred) => Some(clean_projection_predicate(pred, cx)),
@@ -344,22 +346,23 @@ impl<'tcx> Clean<'tcx, Option<WherePredicate>> for ty::Predicate<'tcx> {
344346
}
345347
}
346348

347-
impl<'tcx> Clean<'tcx, Option<WherePredicate>> for ty::PolyTraitPredicate<'tcx> {
348-
fn clean(&self, cx: &mut DocContext<'tcx>) -> Option<WherePredicate> {
349-
// `T: ~const Destruct` is hidden because `T: Destruct` is a no-op.
350-
if self.skip_binder().constness == ty::BoundConstness::ConstIfConst
351-
&& Some(self.skip_binder().def_id()) == cx.tcx.lang_items().destruct_trait()
352-
{
353-
return None;
354-
}
355-
356-
let poly_trait_ref = self.map_bound(|pred| pred.trait_ref);
357-
Some(WherePredicate::BoundPredicate {
358-
ty: clean_middle_ty(poly_trait_ref.skip_binder().self_ty(), cx, None),
359-
bounds: vec![poly_trait_ref.clean(cx)],
360-
bound_params: Vec::new(),
361-
})
349+
fn clean_poly_trait_predicate<'tcx>(
350+
pred: ty::PolyTraitPredicate<'tcx>,
351+
cx: &mut DocContext<'tcx>,
352+
) -> Option<WherePredicate> {
353+
// `T: ~const Destruct` is hidden because `T: Destruct` is a no-op.
354+
if pred.skip_binder().constness == ty::BoundConstness::ConstIfConst
355+
&& Some(pred.skip_binder().def_id()) == cx.tcx.lang_items().destruct_trait()
356+
{
357+
return None;
362358
}
359+
360+
let poly_trait_ref = pred.map_bound(|pred| pred.trait_ref);
361+
Some(WherePredicate::BoundPredicate {
362+
ty: clean_middle_ty(poly_trait_ref.skip_binder().self_ty(), cx, None),
363+
bounds: vec![poly_trait_ref.clean(cx)],
364+
bound_params: Vec::new(),
365+
})
363366
}
364367

365368
fn clean_region_outlives_predicate<'tcx>(

0 commit comments

Comments
 (0)