diff --git a/src/librustc/hir/intravisit.rs b/src/librustc/hir/intravisit.rs index dc2008fdd97..a7a8673d49e 100644 --- a/src/librustc/hir/intravisit.rs +++ b/src/librustc/hir/intravisit.rs @@ -1043,9 +1043,9 @@ pub fn walk_expr<'v, V: Visitor<'v>>(visitor: &mut V, expression: &'v Expr) { walk_list!(visitor, visit_label, opt_label); visitor.visit_block(block); } - ExprKind::Assign(ref left_hand_expression, ref right_hand_expression) => { - visitor.visit_expr(right_hand_expression); - visitor.visit_expr(left_hand_expression) + ExprKind::Assign(ref lhs, ref rhs, _) => { + visitor.visit_expr(rhs); + visitor.visit_expr(lhs) } ExprKind::AssignOp(_, ref left_expression, ref right_expression) => { visitor.visit_expr(right_expression); diff --git a/src/librustc/hir/lowering/expr.rs b/src/librustc/hir/lowering/expr.rs index 8939b5eef26..8311b9168e4 100644 --- a/src/librustc/hir/lowering/expr.rs +++ b/src/librustc/hir/lowering/expr.rs @@ -122,8 +122,8 @@ impl LoweringContext<'_, '_> { self.lower_block(blk, opt_label.is_some()), self.lower_label(opt_label), ), - ExprKind::Assign(ref el, ref er) => { - hir::ExprKind::Assign(P(self.lower_expr(el)), P(self.lower_expr(er))) + ExprKind::Assign(ref el, ref er, span) => { + hir::ExprKind::Assign(P(self.lower_expr(el)), P(self.lower_expr(er)), span) } ExprKind::AssignOp(op, ref el, ref er) => hir::ExprKind::AssignOp( self.lower_binop(op), @@ -994,8 +994,11 @@ impl LoweringContext<'_, '_> { let (val_pat, val_pat_hid) = self.pat_ident(pat.span, val_ident); let val_expr = P(self.expr_ident(pat.span, val_ident, val_pat_hid)); let next_expr = P(self.expr_ident(pat.span, next_ident, next_pat_hid)); - let assign = - P(self.expr(pat.span, hir::ExprKind::Assign(next_expr, val_expr), ThinVec::new())); + let assign = P(self.expr( + pat.span, + hir::ExprKind::Assign(next_expr, val_expr, pat.span), + ThinVec::new(), + )); let some_pat = self.pat_some(pat.span, val_pat); self.arm(some_pat, assign) }; diff --git a/src/librustc/hir/mod.rs b/src/librustc/hir/mod.rs index 915b0afc48f..bf95324d776 100644 --- a/src/librustc/hir/mod.rs +++ b/src/librustc/hir/mod.rs @@ -1690,7 +1690,8 @@ pub enum ExprKind { Block(P, Option