AST/HIR: Replace Path with Type in WhereEqPredicate

This commit is contained in:
Vadim Petrochenkov 2017-01-16 21:32:13 +03:00
parent 47410b23aa
commit 828404684b
11 changed files with 38 additions and 36 deletions

View file

@ -740,12 +740,12 @@ pub fn walk_where_predicate<'v, V: Visitor<'v>>(
walk_list!(visitor, visit_lifetime, bounds);
}
&WherePredicate::EqPredicate(WhereEqPredicate{id,
ref path,
ref ty,
ref lhs_ty,
ref rhs_ty,
..}) => {
visitor.visit_id(id);
visitor.visit_path(path, id);
visitor.visit_ty(ty);
visitor.visit_ty(lhs_ty);
visitor.visit_ty(rhs_ty);
}
}
}

View file

@ -719,13 +719,13 @@ impl<'a> LoweringContext<'a> {
})
}
WherePredicate::EqPredicate(WhereEqPredicate{ id,
ref path,
ref ty,
ref lhs_ty,
ref rhs_ty,
span}) => {
hir::WherePredicate::EqPredicate(hir::WhereEqPredicate {
id: id,
path: self.lower_path(id, path, ParamMode::Explicit, false),
ty: self.lower_ty(ty),
lhs_ty: self.lower_ty(lhs_ty),
rhs_ty: self.lower_ty(rhs_ty),
span: span,
})
}

View file

@ -403,8 +403,8 @@ pub struct WhereRegionPredicate {
pub struct WhereEqPredicate {
pub id: NodeId,
pub span: Span,
pub path: Path,
pub ty: P<Ty>,
pub lhs_ty: P<Ty>,
pub rhs_ty: P<Ty>,
}
pub type CrateConfig = HirVec<P<MetaItem>>;

View file

@ -2023,11 +2023,13 @@ impl<'a> State<'a> {
}
}
}
&hir::WherePredicate::EqPredicate(hir::WhereEqPredicate{ref path, ref ty, ..}) => {
self.print_path(path, false)?;
&hir::WherePredicate::EqPredicate(hir::WhereEqPredicate{ref lhs_ty,
ref rhs_ty,
..}) => {
self.print_type(lhs_ty)?;
space(&mut self.s)?;
self.word_space("=")?;
self.print_type(&ty)?;
self.print_type(rhs_ty)?;
}
}
}

View file

@ -323,12 +323,11 @@ impl<'a, 'tcx> Visitor<'tcx> for LifetimeContext<'a, 'tcx> {
self.visit_lifetime(bound);
}
}
&hir::WherePredicate::EqPredicate(hir::WhereEqPredicate{ id,
ref path,
ref ty,
.. }) => {
self.visit_path(path, id);
self.visit_ty(&ty);
&hir::WherePredicate::EqPredicate(hir::WhereEqPredicate{ref lhs_ty,
ref rhs_ty,
.. }) => {
self.visit_ty(lhs_ty);
self.visit_ty(rhs_ty);
}
}
}

View file

@ -853,7 +853,7 @@ impl<'a, 'tcx> Visitor<'tcx> for ObsoleteVisiblePrivateTypesVisitor<'a, 'tcx> {
}
&hir::WherePredicate::RegionPredicate(_) => {}
&hir::WherePredicate::EqPredicate(ref eq_pred) => {
self.visit_ty(&eq_pred.ty);
self.visit_ty(&eq_pred.rhs_ty);
}
}
}

View file

@ -403,8 +403,8 @@ pub struct WhereRegionPredicate {
pub struct WhereEqPredicate {
pub id: NodeId,
pub span: Span,
pub path: Path,
pub ty: P<Ty>,
pub lhs_ty: P<Ty>,
pub rhs_ty: P<Ty>,
}
/// The set of MetaItems that define the compilation environment of the crate,

View file

@ -766,13 +766,13 @@ pub fn noop_fold_where_predicate<T: Folder>(
})
}
ast::WherePredicate::EqPredicate(ast::WhereEqPredicate{id,
path,
ty,
lhs_ty,
rhs_ty,
span}) => {
ast::WherePredicate::EqPredicate(ast::WhereEqPredicate{
id: fld.new_id(id),
path: fld.fold_path(path),
ty:fld.fold_ty(ty),
lhs_ty: fld.fold_ty(lhs_ty),
rhs_ty: fld.fold_ty(rhs_ty),
span: fld.new_span(span)
})
}

View file

@ -2849,11 +2849,13 @@ impl<'a> State<'a> {
..}) => {
self.print_lifetime_bounds(lifetime, bounds)?;
}
ast::WherePredicate::EqPredicate(ast::WhereEqPredicate{ref path, ref ty, ..}) => {
self.print_path(path, false, 0, false)?;
ast::WherePredicate::EqPredicate(ast::WhereEqPredicate{ref lhs_ty,
ref rhs_ty,
..}) => {
self.print_type(lhs_ty)?;
space(&mut self.s)?;
self.word_space("=")?;
self.print_type(&ty)?;
self.print_type(rhs_ty)?;
}
}
}

View file

@ -508,12 +508,11 @@ pub fn walk_generics<'a, V: Visitor<'a>>(visitor: &mut V, generics: &'a Generics
visitor.visit_lifetime(lifetime);
walk_list!(visitor, visit_lifetime, bounds);
}
WherePredicate::EqPredicate(WhereEqPredicate{id,
ref path,
ref ty,
WherePredicate::EqPredicate(WhereEqPredicate{ref lhs_ty,
ref rhs_ty,
..}) => {
visitor.visit_path(path, id);
visitor.visit_ty(ty);
visitor.visit_ty(lhs_ty);
visitor.visit_ty(rhs_ty);
}
}
}

View file

@ -558,8 +558,8 @@ impl<'a> TraitDef<'a> {
ast::WherePredicate::EqPredicate(ast::WhereEqPredicate {
id: ast::DUMMY_NODE_ID,
span: self.span,
path: we.path.clone(),
ty: we.ty.clone(),
lhs_ty: we.lhs_ty.clone(),
rhs_ty: we.rhs_ty.clone(),
})
}
}