1
Fork 0

Update term for use in more places

Replace use of `ty()` on term and use it in more places. This will allow more flexibility in the
future, but slightly worried it allows items which are consts which only accept types.
This commit is contained in:
kadmin 2022-01-10 23:39:21 +00:00
parent 67f56671d0
commit e7529d6a38
31 changed files with 284 additions and 128 deletions

View file

@ -128,8 +128,10 @@ where
polarity: _,
}) => self.visit_trait(trait_ref),
ty::PredicateKind::Projection(ty::ProjectionPredicate { projection_ty, term }) => {
let ty = term.ty();
ty.visit_with(self)?;
match term {
ty::Term::Ty(ty) => ty.visit_with(self)?,
ty::Term::Const(ct) => ct.visit_with(self)?,
}
self.visit_projection_ty(projection_ty)
}
ty::PredicateKind::TypeOutlives(ty::OutlivesPredicate(ty, _region)) => {
@ -1186,10 +1188,13 @@ impl<'tcx> Visitor<'tcx> for TypePrivacyVisitor<'tcx> {
}
for (poly_predicate, _) in bounds.projection_bounds {
if self.visit(poly_predicate.skip_binder().term.ty()).is_break()
|| self
.visit_projection_ty(poly_predicate.skip_binder().projection_ty)
.is_break()
let pred = poly_predicate.skip_binder();
let poly_pred_term = match pred.term {
ty::Term::Ty(ty) => self.visit(ty),
ty::Term::Const(ct) => self.visit(ct),
};
if poly_pred_term.is_break()
|| self.visit_projection_ty(pred.projection_ty).is_break()
{
return;
}