s/Clause/ClauseKind

This commit is contained in:
Michael Goulet 2023-06-16 05:59:42 +00:00
parent 18a6d911ca
commit fca56a8d2c
101 changed files with 592 additions and 544 deletions

View file

@ -321,10 +321,10 @@ where
let bound_predicate = pred.kind();
let tcx = self.cx.tcx;
let regions = match bound_predicate.skip_binder() {
ty::PredicateKind::Clause(ty::Clause::Trait(poly_trait_pred)) => {
ty::PredicateKind::Clause(ty::ClauseKind::Trait(poly_trait_pred)) => {
tcx.collect_referenced_late_bound_regions(&bound_predicate.rebind(poly_trait_pred))
}
ty::PredicateKind::Clause(ty::Clause::Projection(poly_proj_pred)) => {
ty::PredicateKind::Clause(ty::ClauseKind::Projection(poly_proj_pred)) => {
tcx.collect_referenced_late_bound_regions(&bound_predicate.rebind(poly_proj_pred))
}
_ => return FxHashSet::default(),
@ -449,7 +449,7 @@ where
.filter(|p| {
!orig_bounds.contains(p)
|| match p.kind().skip_binder() {
ty::PredicateKind::Clause(ty::Clause::Trait(pred)) => {
ty::PredicateKind::Clause(ty::ClauseKind::Trait(pred)) => {
pred.def_id() == sized_trait
}
_ => false,

View file

@ -331,22 +331,22 @@ pub(crate) fn clean_predicate<'tcx>(
) -> Option<WherePredicate> {
let bound_predicate = predicate.kind();
match bound_predicate.skip_binder() {
ty::PredicateKind::Clause(ty::Clause::Trait(pred)) => {
ty::PredicateKind::Clause(ty::ClauseKind::Trait(pred)) => {
clean_poly_trait_predicate(bound_predicate.rebind(pred), cx)
}
ty::PredicateKind::Clause(ty::Clause::RegionOutlives(pred)) => {
ty::PredicateKind::Clause(ty::ClauseKind::RegionOutlives(pred)) => {
clean_region_outlives_predicate(pred)
}
ty::PredicateKind::Clause(ty::Clause::TypeOutlives(pred)) => {
ty::PredicateKind::Clause(ty::ClauseKind::TypeOutlives(pred)) => {
clean_type_outlives_predicate(bound_predicate.rebind(pred), cx)
}
ty::PredicateKind::Clause(ty::Clause::Projection(pred)) => {
ty::PredicateKind::Clause(ty::ClauseKind::Projection(pred)) => {
Some(clean_projection_predicate(bound_predicate.rebind(pred), cx))
}
// FIXME(generic_const_exprs): should this do something?
ty::PredicateKind::Clause(ty::Clause::ConstEvaluatable(..)) => None,
ty::PredicateKind::Clause(ty::Clause::WellFormed(..)) => None,
ty::PredicateKind::Clause(ty::Clause::ConstArgHasType(..)) => None,
ty::PredicateKind::Clause(ty::ClauseKind::ConstEvaluatable(..)) => None,
ty::PredicateKind::Clause(ty::ClauseKind::WellFormed(..)) => None,
ty::PredicateKind::Clause(ty::ClauseKind::ConstArgHasType(..)) => None,
ty::PredicateKind::Subtype(..)
| ty::PredicateKind::AliasRelate(..)
@ -805,20 +805,19 @@ fn clean_ty_generics<'tcx>(
let param_idx = (|| {
let bound_p = p.kind();
match bound_p.skip_binder() {
ty::PredicateKind::Clause(ty::Clause::Trait(pred)) => {
ty::PredicateKind::Clause(ty::ClauseKind::Trait(pred)) => {
if let ty::Param(param) = pred.self_ty().kind() {
return Some(param.index);
}
}
ty::PredicateKind::Clause(ty::Clause::TypeOutlives(ty::OutlivesPredicate(
ty,
_reg,
))) => {
ty::PredicateKind::Clause(ty::ClauseKind::TypeOutlives(
ty::OutlivesPredicate(ty, _reg),
)) => {
if let ty::Param(param) = ty.kind() {
return Some(param.index);
}
}
ty::PredicateKind::Clause(ty::Clause::Projection(p)) => {
ty::PredicateKind::Clause(ty::ClauseKind::Projection(p)) => {
if let ty::Param(param) = p.projection_ty.self_ty().kind() {
projection = Some(bound_p.rebind(p));
return Some(param.index);
@ -2114,10 +2113,10 @@ fn clean_middle_opaque_bounds<'tcx>(
.filter_map(|bound| {
let bound_predicate = bound.kind();
let trait_ref = match bound_predicate.skip_binder() {
ty::PredicateKind::Clause(ty::Clause::Trait(tr)) => {
ty::PredicateKind::Clause(ty::ClauseKind::Trait(tr)) => {
bound_predicate.rebind(tr.trait_ref)
}
ty::PredicateKind::Clause(ty::Clause::TypeOutlives(ty::OutlivesPredicate(
ty::PredicateKind::Clause(ty::ClauseKind::TypeOutlives(ty::OutlivesPredicate(
_ty,
reg,
))) => {
@ -2137,7 +2136,7 @@ fn clean_middle_opaque_bounds<'tcx>(
let bindings: ThinVec<_> = bounds
.iter()
.filter_map(|bound| {
if let ty::PredicateKind::Clause(ty::Clause::Projection(proj)) =
if let ty::PredicateKind::Clause(ty::ClauseKind::Projection(proj)) =
bound.kind().skip_binder()
{
if proj.projection_ty.trait_ref(cx.tcx) == trait_ref.skip_binder() {

View file

@ -128,7 +128,9 @@ fn trait_is_same_or_supertrait(cx: &DocContext<'_>, child: DefId, trait_: DefId)
.predicates
.iter()
.filter_map(|(pred, _)| {
if let ty::PredicateKind::Clause(ty::Clause::Trait(pred)) = pred.kind().skip_binder() {
if let ty::PredicateKind::Clause(ty::ClauseKind::Trait(pred)) =
pred.kind().skip_binder()
{
if pred.trait_ref.self_ty() == self_ty { Some(pred.def_id()) } else { None }
} else {
None