move visit_predicate into TypeVisitor

This commit is contained in:
Bastian Kauschke
2020-10-23 13:58:32 +02:00
parent a9cd294cf2
commit 972d9e886c
2 changed files with 5 additions and 16 deletions

View File

@@ -1040,16 +1040,6 @@ impl<'tcx> TypeFoldable<'tcx> for ty::Predicate<'tcx> {
}
}
pub(super) trait PredicateVisitor<'tcx>: TypeVisitor<'tcx> {
fn visit_predicate(&mut self, predicate: ty::Predicate<'tcx>) -> bool;
}
impl<T: TypeVisitor<'tcx>> PredicateVisitor<'tcx> for T {
default fn visit_predicate(&mut self, predicate: ty::Predicate<'tcx>) -> bool {
predicate.super_visit_with(self)
}
}
impl<'tcx> TypeFoldable<'tcx> for &'tcx ty::List<ty::Predicate<'tcx>> {
fn super_fold_with<F: TypeFolder<'tcx>>(&self, folder: &mut F) -> Self {
fold_list(*self, folder, |tcx, v| tcx.intern_predicates(v))