Aster and visit
diff --git a/src/aster/ty.rs b/src/aster/ty.rs
index 96b6554..127b164 100644
--- a/src/aster/ty.rs
+++ b/src/aster/ty.rs
@@ -158,10 +158,6 @@
TyBuilder::with_callback(TyIteratorBuilder(self))
}
- pub fn object_sum(self) -> TyBuilder<TyObjectSumBuilder<F>> {
- TyBuilder::with_callback(TyObjectSumBuilder { builder: self })
- }
-
pub fn impl_trait(self) -> TyImplTraitTyBuilder<F> {
TyImplTraitTyBuilder {
builder: self,
@@ -389,90 +385,6 @@
// ////////////////////////////////////////////////////////////////////////////
-pub struct TyObjectSumBuilder<F> {
- builder: TyBuilder<F>,
-}
-
-impl<F> Invoke<Ty> for TyObjectSumBuilder<F>
- where F: Invoke<Ty>
-{
- type Result = TyObjectSumTyBuilder<F>;
-
- fn invoke(self, ty: Ty) -> Self::Result {
- TyObjectSumTyBuilder {
- builder: self.builder,
- ty: ty,
- bounds: Vec::new(),
- }
- }
-}
-
-pub struct TyObjectSumTyBuilder<F> {
- builder: TyBuilder<F>,
- ty: Ty,
- bounds: Vec<TyParamBound>,
-}
-
-impl<F> TyObjectSumTyBuilder<F>
- where F: Invoke<Ty>
-{
- pub fn with_bounds<I>(mut self, iter: I) -> Self
- where I: Iterator<Item = TyParamBound>
- {
- self.bounds.extend(iter);
- self
- }
-
- pub fn with_bound(mut self, bound: TyParamBound) -> Self {
- self.bounds.push(bound);
- self
- }
-
- pub fn bound(self) -> TyParamBoundBuilder<Self> {
- TyParamBoundBuilder::with_callback(self)
- }
-
- pub fn with_generics(self, generics: Generics) -> Self {
- self.with_lifetimes(generics.lifetimes
- .into_iter()
- .map(|def| def.lifetime))
- }
-
- pub fn with_lifetimes<I, L>(mut self, lifetimes: I) -> Self
- where I: Iterator<Item = L>,
- L: IntoLifetime
- {
- for lifetime in lifetimes {
- self = self.lifetime(lifetime);
- }
-
- self
- }
-
- pub fn lifetime<L>(self, lifetime: L) -> Self
- where L: IntoLifetime
- {
- self.bound().lifetime(lifetime)
- }
-
- pub fn build(self) -> F::Result {
- let bounds = self.bounds;
- self.builder.build(Ty::ObjectSum(Box::new(self.ty), bounds))
- }
-}
-
-impl<F> Invoke<TyParamBound> for TyObjectSumTyBuilder<F>
- where F: Invoke<Ty>
-{
- type Result = Self;
-
- fn invoke(self, bound: TyParamBound) -> Self {
- self.with_bound(bound)
- }
-}
-
-// ////////////////////////////////////////////////////////////////////////////
-
pub struct TyImplTraitTyBuilder<F> {
builder: TyBuilder<F>,
bounds: Vec<TyParamBound>,
diff --git a/src/lib.rs b/src/lib.rs
index 0264bb2..896e999 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -42,7 +42,8 @@
mod generics;
pub use generics::{Generics, Lifetime, LifetimeDef, TraitBoundModifier, TyParam, TyParamBound,
- WhereBoundPredicate, WhereClause, WherePredicate, WhereRegionPredicate};
+ WhereBoundPredicate, WhereClause, WhereEqPredicate, WherePredicate,
+ WhereRegionPredicate};
#[cfg(feature = "printing")]
pub use generics::{ImplGenerics, TyGenerics};
diff --git a/src/visit.rs b/src/visit.rs
index 27817bf..0364f51 100644
--- a/src/visit.rs
+++ b/src/visit.rs
@@ -213,15 +213,11 @@
}
visitor.visit_path(path);
}
- Ty::ObjectSum(ref inner, ref bounds) => {
- visitor.visit_ty(inner);
- walk_list!(visitor, visit_ty_param_bound, bounds);
- }
Ty::Array(ref inner, ref len) => {
visitor.visit_ty(inner);
visitor.visit_const_expr(len);
}
- Ty::PolyTraitRef(ref bounds) |
+ Ty::TraitObject(ref bounds) |
Ty::ImplTrait(ref bounds) => {
walk_list!(visitor, visit_ty_param_bound, bounds);
}
@@ -303,6 +299,12 @@
visitor.visit_lifetime(lifetime);
walk_list!(visitor, visit_lifetime, bounds);
}
+ WherePredicate::EqPredicate(WhereEqPredicate { ref lhs_ty,
+ ref rhs_ty,
+ .. }) => {
+ visitor.visit_ty(lhs_ty);
+ visitor.visit_ty(rhs_ty);
+ }
}
}
}
@@ -454,7 +456,7 @@
visitor.visit_expr(place);
visitor.visit_expr(value);
}
- ExprKind::Vec(ref exprs) => {
+ ExprKind::Array(ref exprs) => {
walk_list!(visitor, visit_expr, exprs);
}
ExprKind::Call(ref callee, ref args) => {