about summary refs log tree commit diff
diff options
context:
space:
mode:
authorvarkor <github@varkor.com>2019-12-22 21:08:53 +0000
committervarkor <github@varkor.com>2019-12-23 11:20:13 +0000
commit35979a92bf6dba402885a1488ecfd84046e4bd71 (patch)
tree7d58702befa5cd9f8ffffa0222f3615978503520
parent5ab4735559aeeece0b5811dad95fdf515b1bcfbd (diff)
downloadrust-35979a92bf6dba402885a1488ecfd84046e4bd71.tar.gz
rust-35979a92bf6dba402885a1488ecfd84046e4bd71.zip
Add span information to `ExprKind::Assign`
-rw-r--r--src/librustc/hir/intravisit.rs6
-rw-r--r--src/librustc/hir/lowering/expr.rs11
-rw-r--r--src/librustc/hir/mod.rs2
-rw-r--r--src/librustc/hir/print.rs4
-rw-r--r--src/librustc_lint/unused.rs2
-rw-r--r--src/librustc_mir/hair/cx/expr.rs2
-rw-r--r--src/librustc_parse/parser/expr.rs4
-rw-r--r--src/librustc_passes/liveness.rs4
-rw-r--r--src/librustc_privacy/lib.rs2
-rw-r--r--src/librustc_typeck/check/demand.rs2
-rw-r--r--src/librustc_typeck/check/expr.rs8
-rw-r--r--src/librustc_typeck/expr_use_visitor.rs2
-rw-r--r--src/libsyntax/ast.rs2
-rw-r--r--src/libsyntax/mut_visit.rs2
-rw-r--r--src/libsyntax/print/pprust.rs2
-rw-r--r--src/libsyntax/util/parser.rs2
-rw-r--r--src/libsyntax/visit.rs6
-rw-r--r--src/test/ui-fulldeps/pprust-expr-roundtrip.rs4
-rw-r--r--src/test/ui/bad/bad-expr-lhs.stderr16
-rw-r--r--src/test/ui/bad/destructuring-assignment.stderr20
-rw-r--r--src/test/ui/error-codes/E0070.stderr12
-rw-r--r--src/test/ui/issues/issue-13407.stderr4
-rw-r--r--src/test/ui/issues/issue-26093.stderr4
-rw-r--r--src/test/ui/issues/issue-34334.stderr4
-rw-r--r--src/test/ui/type/type-check/assignment-expected-bool.stderr4
25 files changed, 69 insertions, 62 deletions
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 4aa8c12a219..457851bd7ec 100644
--- a/src/librustc/hir/mod.rs
+++ b/src/librustc/hir/mod.rs
@@ -1628,7 +1628,7 @@ pub enum ExprKind {
     Block(P<Block>, Option<Label>),
 
     /// An assignment (e.g., `a = foo()`).
-    Assign(P<Expr>, P<Expr>),
+    Assign(P<Expr>, P<Expr>, Span),
     /// An assignment with an operator.
     ///
     /// E.g., `a += 1`.
diff --git a/src/librustc/hir/print.rs b/src/librustc/hir/print.rs
index 767e53f9519..2f3b6f82ee5 100644
--- a/src/librustc/hir/print.rs
+++ b/src/librustc/hir/print.rs
@@ -1289,7 +1289,7 @@ impl<'a> State<'a> {
                 self.ibox(0);
                 self.print_block(&blk);
             }
-            hir::ExprKind::Assign(ref lhs, ref rhs) => {
+            hir::ExprKind::Assign(ref lhs, ref rhs, _) => {
                 let prec = AssocOp::Assign.precedence() as i8;
                 self.print_expr_maybe_paren(&lhs, prec + 1);
                 self.s.space();
@@ -2265,7 +2265,7 @@ fn contains_exterior_struct_lit(value: &hir::Expr) -> bool {
     match value.kind {
         hir::ExprKind::Struct(..) => true,
 
-        hir::ExprKind::Assign(ref lhs, ref rhs)
+        hir::ExprKind::Assign(ref lhs, ref rhs, _)
         | hir::ExprKind::AssignOp(_, ref lhs, ref rhs)
         | hir::ExprKind::Binary(_, ref lhs, ref rhs) => {
             // `X { y: 1 } + X { y: 2 }`
diff --git a/src/librustc_lint/unused.rs b/src/librustc_lint/unused.rs
index 6bdb77bb804..5f57aabe8d4 100644
--- a/src/librustc_lint/unused.rs
+++ b/src/librustc_lint/unused.rs
@@ -490,7 +490,7 @@ impl EarlyLintPass for UnusedParens {
                 (value, "`return` value", false, Some(left), None)
             }
 
-            Assign(_, ref value) => (value, "assigned value", false, None, None),
+            Assign(_, ref value, _) => (value, "assigned value", false, None, None),
             AssignOp(.., ref value) => (value, "assigned value", false, None, None),
             // either function/method call, or something this lint doesn't care about
             ref call_or_other => {
diff --git a/src/librustc_mir/hair/cx/expr.rs b/src/librustc_mir/hair/cx/expr.rs
index bfeb3c40e28..b5cd24bebc3 100644
--- a/src/librustc_mir/hair/cx/expr.rs
+++ b/src/librustc_mir/hair/cx/expr.rs
@@ -227,7 +227,7 @@ fn make_mirror_unadjusted<'a, 'tcx>(cx: &mut Cx<'a, 'tcx>, expr: &'tcx hir::Expr
 
         hir::ExprKind::Block(ref blk, _) => ExprKind::Block { body: &blk },
 
-        hir::ExprKind::Assign(ref lhs, ref rhs) => {
+        hir::ExprKind::Assign(ref lhs, ref rhs, _) => {
             ExprKind::Assign { lhs: lhs.to_ref(), rhs: rhs.to_ref() }
         }
 
diff --git a/src/librustc_parse/parser/expr.rs b/src/librustc_parse/parser/expr.rs
index fa68ddf272a..e0eb841f2c0 100644
--- a/src/librustc_parse/parser/expr.rs
+++ b/src/librustc_parse/parser/expr.rs
@@ -281,7 +281,9 @@ impl<'a> Parser<'a> {
                     let binary = self.mk_binary(source_map::respan(cur_op_span, ast_op), lhs, rhs);
                     self.mk_expr(span, binary, AttrVec::new())
                 }
-                AssocOp::Assign => self.mk_expr(span, ExprKind::Assign(lhs, rhs), AttrVec::new()),
+                AssocOp::Assign => {
+                    self.mk_expr(span, ExprKind::Assign(lhs, rhs, cur_op_span), AttrVec::new())
+                }
                 AssocOp::AssignOp(k) => {
                     let aop = match k {
                         token::Plus => BinOpKind::Add,
diff --git a/src/librustc_passes/liveness.rs b/src/librustc_passes/liveness.rs
index de532421bfb..1a8abeb7abc 100644
--- a/src/librustc_passes/liveness.rs
+++ b/src/librustc_passes/liveness.rs
@@ -1079,7 +1079,7 @@ impl<'a, 'tcx> Liveness<'a, 'tcx> {
                     .unwrap_or_else(|| span_bug!(expr.span, "continue to unknown label"))
             }
 
-            hir::ExprKind::Assign(ref l, ref r) => {
+            hir::ExprKind::Assign(ref l, ref r, _) => {
                 // see comment on places in
                 // propagate_through_place_components()
                 let succ = self.write_place(&l, succ, ACC_WRITE);
@@ -1373,7 +1373,7 @@ impl<'a, 'tcx> Visitor<'tcx> for Liveness<'a, 'tcx> {
 
 fn check_expr<'tcx>(this: &mut Liveness<'_, 'tcx>, expr: &'tcx Expr) {
     match expr.kind {
-        hir::ExprKind::Assign(ref l, _) => {
+        hir::ExprKind::Assign(ref l, ..) => {
             this.check_place(&l);
         }
 
diff --git a/src/librustc_privacy/lib.rs b/src/librustc_privacy/lib.rs
index f7e48907e01..cdfcb8090e6 100644
--- a/src/librustc_privacy/lib.rs
+++ b/src/librustc_privacy/lib.rs
@@ -1251,7 +1251,7 @@ impl<'a, 'tcx> Visitor<'tcx> for TypePrivacyVisitor<'a, 'tcx> {
             return;
         }
         match expr.kind {
-            hir::ExprKind::Assign(.., ref rhs) | hir::ExprKind::Match(ref rhs, ..) => {
+            hir::ExprKind::Assign(_, ref rhs, _) | hir::ExprKind::Match(ref rhs, ..) => {
                 // Do not report duplicate errors for `x = y` and `match x { ... }`.
                 if self.check_expr_pat_type(rhs.hir_id, rhs.span) {
                     return;
diff --git a/src/librustc_typeck/check/demand.rs b/src/librustc_typeck/check/demand.rs
index 944b4f8fe56..d63d30b7b8d 100644
--- a/src/librustc_typeck/check/demand.rs
+++ b/src/librustc_typeck/check/demand.rs
@@ -492,7 +492,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
                             String::new()
                         };
                         if let Some(hir::Node::Expr(hir::Expr {
-                            kind: hir::ExprKind::Assign(left_expr, _),
+                            kind: hir::ExprKind::Assign(left_expr, ..),
                             ..
                         })) = self.tcx.hir().find(self.tcx.hir().get_parent_node(expr.hir_id))
                         {
diff --git a/src/librustc_typeck/check/expr.rs b/src/librustc_typeck/check/expr.rs
index 13046d8002a..1ff2ea19b7c 100644
--- a/src/librustc_typeck/check/expr.rs
+++ b/src/librustc_typeck/check/expr.rs
@@ -219,7 +219,9 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
             ExprKind::Box(ref subexpr) => self.check_expr_box(subexpr, expected),
             ExprKind::Lit(ref lit) => self.check_lit(&lit, expected),
             ExprKind::Binary(op, ref lhs, ref rhs) => self.check_binop(expr, op, lhs, rhs),
-            ExprKind::AssignOp(op, ref lhs, ref rhs) => self.check_binop_assign(expr, op, lhs, rhs),
+            ExprKind::Assign(ref lhs, ref rhs, ref span) => {
+                self.check_binop_assign(expr, op, lhs, rhs)
+            }
             ExprKind::Unary(unop, ref oprnd) => {
                 self.check_expr_unary(unop, oprnd, expected, needs, expr)
             }
@@ -245,7 +247,6 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
                 }
             }
             ExprKind::Ret(ref expr_opt) => self.check_expr_return(expr_opt.as_deref(), expr),
-            ExprKind::Assign(ref lhs, ref rhs) => self.check_expr_assign(expr, expected, lhs, rhs),
             ExprKind::Loop(ref body, _, source) => {
                 self.check_expr_loop(body, source, expected, expr)
             }
@@ -767,6 +768,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
         expected: Expectation<'tcx>,
         lhs: &'tcx hir::Expr,
         rhs: &'tcx hir::Expr,
+        span: &Span,
     ) -> Ty<'tcx> {
         let lhs_ty = self.check_expr_with_needs(&lhs, Needs::MutPlace);
         let rhs_ty = self.check_expr_coercable_to_type(&rhs, lhs_ty);
@@ -789,7 +791,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
             }
             err.emit();
         } else {
-            self.check_lhs_assignable(lhs, "E0070", &expr.span);
+            self.check_lhs_assignable(lhs, "E0070", span);
         }
 
         self.require_type_is_sized(lhs_ty, lhs.span, traits::AssignmentLhsSized);
diff --git a/src/librustc_typeck/expr_use_visitor.rs b/src/librustc_typeck/expr_use_visitor.rs
index 58baf24438b..6c7e3658365 100644
--- a/src/librustc_typeck/expr_use_visitor.rs
+++ b/src/librustc_typeck/expr_use_visitor.rs
@@ -286,7 +286,7 @@ impl<'a, 'tcx> ExprUseVisitor<'a, 'tcx> {
                 }
             }
 
-            hir::ExprKind::Assign(ref lhs, ref rhs) => {
+            hir::ExprKind::Assign(ref lhs, ref rhs, _) => {
                 self.mutate_expr(lhs);
                 self.consume_expr(rhs);
             }
diff --git a/src/libsyntax/ast.rs b/src/libsyntax/ast.rs
index 9009faa5440..c00fc761a6a 100644
--- a/src/libsyntax/ast.rs
+++ b/src/libsyntax/ast.rs
@@ -1216,7 +1216,7 @@ pub enum ExprKind {
     TryBlock(P<Block>),
 
     /// An assignment (`a = foo()`).
-    Assign(P<Expr>, P<Expr>),
+    Assign(P<Expr>, P<Expr>, Span),
     /// An assignment with an operator.
     ///
     /// E.g., `a += 1`.
diff --git a/src/libsyntax/mut_visit.rs b/src/libsyntax/mut_visit.rs
index 780323d114e..f6817c713a4 100644
--- a/src/libsyntax/mut_visit.rs
+++ b/src/libsyntax/mut_visit.rs
@@ -1168,7 +1168,7 @@ pub fn noop_visit_expr<T: MutVisitor>(Expr { kind, id, span, attrs }: &mut Expr,
             vis.visit_block(body);
         }
         ExprKind::Await(expr) => vis.visit_expr(expr),
-        ExprKind::Assign(el, er) => {
+        ExprKind::Assign(el, er, _) => {
             vis.visit_expr(el);
             vis.visit_expr(er);
         }
diff --git a/src/libsyntax/print/pprust.rs b/src/libsyntax/print/pprust.rs
index dc01f2472b7..b1b667f03be 100644
--- a/src/libsyntax/print/pprust.rs
+++ b/src/libsyntax/print/pprust.rs
@@ -2041,7 +2041,7 @@ impl<'a> State<'a> {
                 self.print_expr_maybe_paren(expr, parser::PREC_POSTFIX);
                 self.s.word(".await");
             }
-            ast::ExprKind::Assign(ref lhs, ref rhs) => {
+            ast::ExprKind::Assign(ref lhs, ref rhs, _) => {
                 let prec = AssocOp::Assign.precedence() as i8;
                 self.print_expr_maybe_paren(lhs, prec + 1);
                 self.s.space();
diff --git a/src/libsyntax/util/parser.rs b/src/libsyntax/util/parser.rs
index 88e3d8daf70..98af382efb0 100644
--- a/src/libsyntax/util/parser.rs
+++ b/src/libsyntax/util/parser.rs
@@ -378,7 +378,7 @@ pub fn contains_exterior_struct_lit(value: &ast::Expr) -> bool {
     match value.kind {
         ast::ExprKind::Struct(..) => true,
 
-        ast::ExprKind::Assign(ref lhs, ref rhs)
+        ast::ExprKind::Assign(ref lhs, ref rhs, _)
         | ast::ExprKind::AssignOp(_, ref lhs, ref rhs)
         | ast::ExprKind::Binary(_, ref lhs, ref rhs) => {
             // X { y: 1 } + X { y: 2 }
diff --git a/src/libsyntax/visit.rs b/src/libsyntax/visit.rs
index d6573a06647..fbc5d133249 100644
--- a/src/libsyntax/visit.rs
+++ b/src/libsyntax/visit.rs
@@ -766,9 +766,9 @@ pub fn walk_expr<'a, V: Visitor<'a>>(visitor: &mut V, expression: &'a Expr) {
             visitor.visit_block(body);
         }
         ExprKind::Await(ref expr) => visitor.visit_expr(expr),
-        ExprKind::Assign(ref left_hand_expression, ref right_hand_expression) => {
-            visitor.visit_expr(left_hand_expression);
-            visitor.visit_expr(right_hand_expression);
+        ExprKind::Assign(ref lhs, ref rhs, _) => {
+            visitor.visit_expr(lhs);
+            visitor.visit_expr(rhs);
         }
         ExprKind::AssignOp(_, ref left_expression, ref right_expression) => {
             visitor.visit_expr(left_expression);
diff --git a/src/test/ui-fulldeps/pprust-expr-roundtrip.rs b/src/test/ui-fulldeps/pprust-expr-roundtrip.rs
index 0c050e31413..36d47cea13b 100644
--- a/src/test/ui-fulldeps/pprust-expr-roundtrip.rs
+++ b/src/test/ui-fulldeps/pprust-expr-roundtrip.rs
@@ -126,8 +126,8 @@ fn iter_exprs(depth: usize, f: &mut dyn FnMut(P<Expr>)) {
                                           DUMMY_SP)));
             },
             12 => {
-                iter_exprs(depth - 1, &mut |e| g(ExprKind::Assign(e, make_x())));
-                iter_exprs(depth - 1, &mut |e| g(ExprKind::Assign(make_x(), e)));
+                iter_exprs(depth - 1, &mut |e| g(ExprKind::Assign(e, make_x(), DUMMY_SP)));
+                iter_exprs(depth - 1, &mut |e| g(ExprKind::Assign(make_x(), e, DUMMY_SP)));
             },
             13 => {
                 iter_exprs(depth - 1, &mut |e| g(ExprKind::Field(e, Ident::from_str("f"))));
diff --git a/src/test/ui/bad/bad-expr-lhs.stderr b/src/test/ui/bad/bad-expr-lhs.stderr
index 61c25bb471c..ce793d8910b 100644
--- a/src/test/ui/bad/bad-expr-lhs.stderr
+++ b/src/test/ui/bad/bad-expr-lhs.stderr
@@ -1,8 +1,8 @@
 error[E0070]: invalid left-hand side of assignment
-  --> $DIR/bad-expr-lhs.rs:2:5
+  --> $DIR/bad-expr-lhs.rs:2:7
    |
 LL |     1 = 2;
-   |     -^^^^
+   |     - ^
    |     |
    |     cannot assign to this expression
 
@@ -15,18 +15,18 @@ LL |     1 += 2;
    |     cannot assign to this expression
 
 error[E0070]: invalid left-hand side of assignment
-  --> $DIR/bad-expr-lhs.rs:4:5
+  --> $DIR/bad-expr-lhs.rs:4:12
    |
 LL |     (1, 2) = (3, 4);
-   |     ------^^^^^^^^^
+   |     ------ ^
    |     |
    |     cannot assign to this expression
 
 error[E0070]: invalid left-hand side of assignment
-  --> $DIR/bad-expr-lhs.rs:7:5
+  --> $DIR/bad-expr-lhs.rs:7:12
    |
 LL |     (a, b) = (3, 4);
-   |     ------^^^^^^^^^
+   |     ------ ^
    |     |
    |     cannot assign to this expression
    |
@@ -34,10 +34,10 @@ LL |     (a, b) = (3, 4);
    = note: for more information, see https://github.com/rust-lang/rfcs/issues/372
 
 error[E0070]: invalid left-hand side of assignment
-  --> $DIR/bad-expr-lhs.rs:9:5
+  --> $DIR/bad-expr-lhs.rs:9:10
    |
 LL |     None = Some(3);
-   |     ----^^^^^^^^^^
+   |     ---- ^
    |     |
    |     cannot assign to this expression
 
diff --git a/src/test/ui/bad/destructuring-assignment.stderr b/src/test/ui/bad/destructuring-assignment.stderr
index 845008b0693..3e0925b5658 100644
--- a/src/test/ui/bad/destructuring-assignment.stderr
+++ b/src/test/ui/bad/destructuring-assignment.stderr
@@ -1,8 +1,8 @@
 error[E0070]: invalid left-hand side of assignment
-  --> $DIR/destructuring-assignment.rs:6:5
+  --> $DIR/destructuring-assignment.rs:6:12
    |
 LL |     (a, b) = (3, 4);
-   |     ------^^^^^^^^^
+   |     ------ ^
    |     |
    |     cannot assign to this expression
    |
@@ -31,10 +31,10 @@ LL |     (a, b) += (3, 4);
    = note: for more information, see https://github.com/rust-lang/rfcs/issues/372
 
 error[E0070]: invalid left-hand side of assignment
-  --> $DIR/destructuring-assignment.rs:10:5
+  --> $DIR/destructuring-assignment.rs:10:12
    |
 LL |     [a, b] = [3, 4];
-   |     ------^^^^^^^^^
+   |     ------ ^
    |     |
    |     cannot assign to this expression
    |
@@ -63,10 +63,10 @@ LL |     [a, b] += [3, 4];
    = note: for more information, see https://github.com/rust-lang/rfcs/issues/372
 
 error[E0070]: invalid left-hand side of assignment
-  --> $DIR/destructuring-assignment.rs:16:5
+  --> $DIR/destructuring-assignment.rs:16:22
    |
 LL |     S { x: a, y: b } = s;
-   |     ----------------^^^^
+   |     ---------------- ^
    |     |
    |     cannot assign to this expression
    |
@@ -95,10 +95,10 @@ LL |     S { x: a, y: b } += s;
    = note: for more information, see https://github.com/rust-lang/rfcs/issues/372
 
 error[E0070]: invalid left-hand side of assignment
-  --> $DIR/destructuring-assignment.rs:20:5
+  --> $DIR/destructuring-assignment.rs:20:21
    |
 LL |     S { x: a, ..s } = S { x: 3, y: 4 };
-   |     ---------------^^^^^^^^^^^^^^^^^^^
+   |     --------------- ^
    |     |
    |     cannot assign to this expression
    |
@@ -106,10 +106,10 @@ LL |     S { x: a, ..s } = S { x: 3, y: 4 };
    = note: for more information, see https://github.com/rust-lang/rfcs/issues/372
 
 error[E0070]: invalid left-hand side of assignment
-  --> $DIR/destructuring-assignment.rs:24:5
+  --> $DIR/destructuring-assignment.rs:24:17
    |
 LL |     ((a, b), c) = ((3, 4), 5);
-   |     -----------^^^^^^^^^^^^^^
+   |     ----------- ^
    |     |
    |     cannot assign to this expression
    |
diff --git a/src/test/ui/error-codes/E0070.stderr b/src/test/ui/error-codes/E0070.stderr
index 1fb812d9467..d809bb18dee 100644
--- a/src/test/ui/error-codes/E0070.stderr
+++ b/src/test/ui/error-codes/E0070.stderr
@@ -1,16 +1,16 @@
 error[E0070]: invalid left-hand side of assignment
-  --> $DIR/E0070.rs:6:5
+  --> $DIR/E0070.rs:6:16
    |
 LL |     SOME_CONST = 14;
-   |     ----------^^^^^
+   |     ---------- ^
    |     |
    |     cannot assign to this expression
 
 error[E0070]: invalid left-hand side of assignment
-  --> $DIR/E0070.rs:7:5
+  --> $DIR/E0070.rs:7:7
    |
 LL |     1 = 3;
-   |     -^^^^
+   |     - ^
    |     |
    |     cannot assign to this expression
 
@@ -21,10 +21,10 @@ LL |     some_other_func() = 4;
    |                         ^ expected `()`, found integer
 
 error[E0070]: invalid left-hand side of assignment
-  --> $DIR/E0070.rs:8:5
+  --> $DIR/E0070.rs:8:23
    |
 LL |     some_other_func() = 4;
-   |     -----------------^^^^
+   |     ----------------- ^
    |     |
    |     cannot assign to this expression
 
diff --git a/src/test/ui/issues/issue-13407.stderr b/src/test/ui/issues/issue-13407.stderr
index 05fd97b025f..b280de3158f 100644
--- a/src/test/ui/issues/issue-13407.stderr
+++ b/src/test/ui/issues/issue-13407.stderr
@@ -11,10 +11,10 @@ LL |     A::C = 1;
    |            ^ expected struct `A::C`, found integer
 
 error[E0070]: invalid left-hand side of assignment
-  --> $DIR/issue-13407.rs:6:5
+  --> $DIR/issue-13407.rs:6:10
    |
 LL |     A::C = 1;
-   |     ----^^^^
+   |     ---- ^
    |     |
    |     cannot assign to this expression
 
diff --git a/src/test/ui/issues/issue-26093.stderr b/src/test/ui/issues/issue-26093.stderr
index 48f72cef0a8..c96228b518a 100644
--- a/src/test/ui/issues/issue-26093.stderr
+++ b/src/test/ui/issues/issue-26093.stderr
@@ -1,8 +1,8 @@
 error[E0070]: invalid left-hand side of assignment
-  --> $DIR/issue-26093.rs:3:9
+  --> $DIR/issue-26093.rs:3:16
    |
 LL |         $thing = 42;
-   |         ^^^^^^^^^^^
+   |                ^
 ...
 LL |     not_a_place!(99);
    |     -----------------
diff --git a/src/test/ui/issues/issue-34334.stderr b/src/test/ui/issues/issue-34334.stderr
index e54f0c77cd9..3055e316a08 100644
--- a/src/test/ui/issues/issue-34334.stderr
+++ b/src/test/ui/issues/issue-34334.stderr
@@ -36,10 +36,10 @@ LL |     let sr: Vec<(u32, _, _) = vec![];
    = note: this error originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info)
 
 error[E0070]: invalid left-hand side of assignment
-  --> $DIR/issue-34334.rs:2:13
+  --> $DIR/issue-34334.rs:2:29
    |
 LL |     let sr: Vec<(u32, _, _) = vec![];
-   |             ---------------^^^^^^^^^
+   |             --------------- ^
    |             |
    |             cannot assign to this expression
 
diff --git a/src/test/ui/type/type-check/assignment-expected-bool.stderr b/src/test/ui/type/type-check/assignment-expected-bool.stderr
index bbd961f8450..3f1caddf728 100644
--- a/src/test/ui/type/type-check/assignment-expected-bool.stderr
+++ b/src/test/ui/type/type-check/assignment-expected-bool.stderr
@@ -98,10 +98,10 @@ LL |         || (0 = 0);
    |            help: try comparing for equality: `0 == 0`
 
 error[E0070]: invalid left-hand side of assignment
-  --> $DIR/assignment-expected-bool.rs:31:20
+  --> $DIR/assignment-expected-bool.rs:31:22
    |
 LL |     let _: usize = 0 = 0;
-   |                    -^^^^
+   |                    - ^
    |                    |
    |                    cannot assign to this expression