about summary refs log tree commit diff
path: root/src/librustc_parse/parser
diff options
context:
space:
mode:
authorMazdak Farrokhzad <twingoow@gmail.com>2019-12-23 15:16:29 +0100
committerGitHub <noreply@github.com>2019-12-23 15:16:29 +0100
commit41647613b1a69e7df7490d23fee2823da249cda4 (patch)
tree3cbd0c9868d8e99dc6a3af9134e70523fb49d2a5 /src/librustc_parse/parser
parent3a07f3ba75d2f0a180be44915df2c929966d39cd (diff)
parent9e5081394cac4429de287e6c10b350f698a97f65 (diff)
downloadrust-41647613b1a69e7df7490d23fee2823da249cda4.tar.gz
rust-41647613b1a69e7df7490d23fee2823da249cda4.zip
Rollup merge of #67538 - varkor:lhs-assign-diagnostics, r=Centril
Improve diagnostics for invalid assignment

- Improve wording and span information for invalid assignment diagnostics.
- Link to https://github.com/rust-lang/rfcs/issues/372 when it appears the user is trying a destructuring assignment.
- Make the equality constraint in `where` clauses error consistent with the invalid assignment error.
Diffstat (limited to 'src/librustc_parse/parser')
-rw-r--r--src/librustc_parse/parser/expr.rs4
1 files changed, 3 insertions, 1 deletions
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,