Skip to content

Commit 8284046

Browse files
committed
AST/HIR: Replace Path with Type in WhereEqPredicate
1 parent 47410b2 commit 8284046

File tree

11 files changed

+38
-36
lines changed

11 files changed

+38
-36
lines changed

src/librustc/hir/intravisit.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -740,12 +740,12 @@ pub fn walk_where_predicate<'v, V: Visitor<'v>>(
740740
walk_list!(visitor, visit_lifetime, bounds);
741741
}
742742
&WherePredicate::EqPredicate(WhereEqPredicate{id,
743-
ref path,
744-
ref ty,
743+
ref lhs_ty,
744+
ref rhs_ty,
745745
..}) => {
746746
visitor.visit_id(id);
747-
visitor.visit_path(path, id);
748-
visitor.visit_ty(ty);
747+
visitor.visit_ty(lhs_ty);
748+
visitor.visit_ty(rhs_ty);
749749
}
750750
}
751751
}

src/librustc/hir/lowering.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -719,13 +719,13 @@ impl<'a> LoweringContext<'a> {
719719
})
720720
}
721721
WherePredicate::EqPredicate(WhereEqPredicate{ id,
722-
ref path,
723-
ref ty,
722+
ref lhs_ty,
723+
ref rhs_ty,
724724
span}) => {
725725
hir::WherePredicate::EqPredicate(hir::WhereEqPredicate {
726726
id: id,
727-
path: self.lower_path(id, path, ParamMode::Explicit, false),
728-
ty: self.lower_ty(ty),
727+
lhs_ty: self.lower_ty(lhs_ty),
728+
rhs_ty: self.lower_ty(rhs_ty),
729729
span: span,
730730
})
731731
}

src/librustc/hir/mod.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -403,8 +403,8 @@ pub struct WhereRegionPredicate {
403403
pub struct WhereEqPredicate {
404404
pub id: NodeId,
405405
pub span: Span,
406-
pub path: Path,
407-
pub ty: P<Ty>,
406+
pub lhs_ty: P<Ty>,
407+
pub rhs_ty: P<Ty>,
408408
}
409409

410410
pub type CrateConfig = HirVec<P<MetaItem>>;

src/librustc/hir/print.rs

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2023,11 +2023,13 @@ impl<'a> State<'a> {
20232023
}
20242024
}
20252025
}
2026-
&hir::WherePredicate::EqPredicate(hir::WhereEqPredicate{ref path, ref ty, ..}) => {
2027-
self.print_path(path, false)?;
2026+
&hir::WherePredicate::EqPredicate(hir::WhereEqPredicate{ref lhs_ty,
2027+
ref rhs_ty,
2028+
..}) => {
2029+
self.print_type(lhs_ty)?;
20282030
space(&mut self.s)?;
20292031
self.word_space("=")?;
2030-
self.print_type(&ty)?;
2032+
self.print_type(rhs_ty)?;
20312033
}
20322034
}
20332035
}

src/librustc/middle/resolve_lifetime.rs

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -323,12 +323,11 @@ impl<'a, 'tcx> Visitor<'tcx> for LifetimeContext<'a, 'tcx> {
323323
self.visit_lifetime(bound);
324324
}
325325
}
326-
&hir::WherePredicate::EqPredicate(hir::WhereEqPredicate{ id,
327-
ref path,
328-
ref ty,
329-
.. }) => {
330-
self.visit_path(path, id);
331-
self.visit_ty(&ty);
326+
&hir::WherePredicate::EqPredicate(hir::WhereEqPredicate{ref lhs_ty,
327+
ref rhs_ty,
328+
.. }) => {
329+
self.visit_ty(lhs_ty);
330+
self.visit_ty(rhs_ty);
332331
}
333332
}
334333
}

src/librustc_privacy/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -853,7 +853,7 @@ impl<'a, 'tcx> Visitor<'tcx> for ObsoleteVisiblePrivateTypesVisitor<'a, 'tcx> {
853853
}
854854
&hir::WherePredicate::RegionPredicate(_) => {}
855855
&hir::WherePredicate::EqPredicate(ref eq_pred) => {
856-
self.visit_ty(&eq_pred.ty);
856+
self.visit_ty(&eq_pred.rhs_ty);
857857
}
858858
}
859859
}

src/libsyntax/ast.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -403,8 +403,8 @@ pub struct WhereRegionPredicate {
403403
pub struct WhereEqPredicate {
404404
pub id: NodeId,
405405
pub span: Span,
406-
pub path: Path,
407-
pub ty: P<Ty>,
406+
pub lhs_ty: P<Ty>,
407+
pub rhs_ty: P<Ty>,
408408
}
409409

410410
/// The set of MetaItems that define the compilation environment of the crate,

src/libsyntax/fold.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -766,13 +766,13 @@ pub fn noop_fold_where_predicate<T: Folder>(
766766
})
767767
}
768768
ast::WherePredicate::EqPredicate(ast::WhereEqPredicate{id,
769-
path,
770-
ty,
769+
lhs_ty,
770+
rhs_ty,
771771
span}) => {
772772
ast::WherePredicate::EqPredicate(ast::WhereEqPredicate{
773773
id: fld.new_id(id),
774-
path: fld.fold_path(path),
775-
ty:fld.fold_ty(ty),
774+
lhs_ty: fld.fold_ty(lhs_ty),
775+
rhs_ty: fld.fold_ty(rhs_ty),
776776
span: fld.new_span(span)
777777
})
778778
}

src/libsyntax/print/pprust.rs

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2849,11 +2849,13 @@ impl<'a> State<'a> {
28492849
..}) => {
28502850
self.print_lifetime_bounds(lifetime, bounds)?;
28512851
}
2852-
ast::WherePredicate::EqPredicate(ast::WhereEqPredicate{ref path, ref ty, ..}) => {
2853-
self.print_path(path, false, 0, false)?;
2852+
ast::WherePredicate::EqPredicate(ast::WhereEqPredicate{ref lhs_ty,
2853+
ref rhs_ty,
2854+
..}) => {
2855+
self.print_type(lhs_ty)?;
28542856
space(&mut self.s)?;
28552857
self.word_space("=")?;
2856-
self.print_type(&ty)?;
2858+
self.print_type(rhs_ty)?;
28572859
}
28582860
}
28592861
}

src/libsyntax/visit.rs

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -508,12 +508,11 @@ pub fn walk_generics<'a, V: Visitor<'a>>(visitor: &mut V, generics: &'a Generics
508508
visitor.visit_lifetime(lifetime);
509509
walk_list!(visitor, visit_lifetime, bounds);
510510
}
511-
WherePredicate::EqPredicate(WhereEqPredicate{id,
512-
ref path,
513-
ref ty,
511+
WherePredicate::EqPredicate(WhereEqPredicate{ref lhs_ty,
512+
ref rhs_ty,
514513
..}) => {
515-
visitor.visit_path(path, id);
516-
visitor.visit_ty(ty);
514+
visitor.visit_ty(lhs_ty);
515+
visitor.visit_ty(rhs_ty);
517516
}
518517
}
519518
}

src/libsyntax_ext/deriving/generic/mod.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -558,8 +558,8 @@ impl<'a> TraitDef<'a> {
558558
ast::WherePredicate::EqPredicate(ast::WhereEqPredicate {
559559
id: ast::DUMMY_NODE_ID,
560560
span: self.span,
561-
path: we.path.clone(),
562-
ty: we.ty.clone(),
561+
lhs_ty: we.lhs_ty.clone(),
562+
rhs_ty: we.rhs_ty.clone(),
563563
})
564564
}
565565
}

0 commit comments

Comments
 (0)