1
Fork 0

rename Predicate to PredicateKind, introduce alias

This commit is contained in:
Bastian Kauschke 2020-05-11 21:09:57 +02:00
parent f182c4af8a
commit cad8fe90fd
53 changed files with 406 additions and 383 deletions

View file

@ -481,20 +481,18 @@ impl Clean<WherePredicate> for hir::WherePredicate<'_> {
impl<'a> Clean<Option<WherePredicate>> for ty::Predicate<'a> {
fn clean(&self, cx: &DocContext<'_>) -> Option<WherePredicate> {
use rustc_middle::ty::Predicate;
match *self {
Predicate::Trait(ref pred, _) => Some(pred.clean(cx)),
Predicate::Subtype(ref pred) => Some(pred.clean(cx)),
Predicate::RegionOutlives(ref pred) => pred.clean(cx),
Predicate::TypeOutlives(ref pred) => pred.clean(cx),
Predicate::Projection(ref pred) => Some(pred.clean(cx)),
ty::PredicateKind::Trait(ref pred, _) => Some(pred.clean(cx)),
ty::PredicateKind::Subtype(ref pred) => Some(pred.clean(cx)),
ty::PredicateKind::RegionOutlives(ref pred) => pred.clean(cx),
ty::PredicateKind::TypeOutlives(ref pred) => pred.clean(cx),
ty::PredicateKind::Projection(ref pred) => Some(pred.clean(cx)),
Predicate::WellFormed(..)
| Predicate::ObjectSafe(..)
| Predicate::ClosureKind(..)
| Predicate::ConstEvaluatable(..)
| Predicate::ConstEquate(..) => panic!("not user writable"),
ty::PredicateKind::WellFormed(..)
| ty::PredicateKind::ObjectSafe(..)
| ty::PredicateKind::ClosureKind(..)
| ty::PredicateKind::ConstEvaluatable(..)
| ty::PredicateKind::ConstEquate(..) => panic!("not user writable"),
}
}
}
@ -765,7 +763,7 @@ impl<'a, 'tcx> Clean<Generics> for (&'a ty::Generics, ty::GenericPredicates<'tcx
if let ty::Param(param) = outlives.skip_binder().0.kind {
return Some(param.index);
}
} else if let ty::Predicate::Projection(p) = p {
} else if let ty::PredicateKind::Projection(p) = p {
if let ty::Param(param) = p.skip_binder().projection_ty.self_ty().kind {
projection = Some(p);
return Some(param.index);
@ -1663,7 +1661,7 @@ impl<'tcx> Clean<Type> for Ty<'tcx> {
.filter_map(|predicate| {
let trait_ref = if let Some(tr) = predicate.to_opt_poly_trait_ref() {
tr
} else if let ty::Predicate::TypeOutlives(pred) = *predicate {
} else if let ty::PredicateKind::TypeOutlives(pred) = *predicate {
// these should turn up at the end
if let Some(r) = pred.skip_binder().1.clean(cx) {
regions.push(GenericBound::Outlives(r));
@ -1684,7 +1682,7 @@ impl<'tcx> Clean<Type> for Ty<'tcx> {
.predicates
.iter()
.filter_map(|pred| {
if let ty::Predicate::Projection(proj) = *pred {
if let ty::PredicateKind::Projection(proj) = *pred {
let proj = proj.skip_binder();
if proj.projection_ty.trait_ref(cx.tcx)
== *trait_ref.skip_binder()