about summary refs log tree commit diff
diff options
context:
space:
mode:
authorvarkor <github@varkor.com>2019-12-22 23:09:54 +0000
committervarkor <github@varkor.com>2019-12-23 11:20:13 +0000
commit9a602243c422f183f574ff53e5d3e9e85fcc1210 (patch)
treeb01c52309fd74cf74ca91d0940f3366aa9648415
parent35979a92bf6dba402885a1488ecfd84046e4bd71 (diff)
downloadrust-9a602243c422f183f574ff53e5d3e9e85fcc1210.tar.gz
rust-9a602243c422f183f574ff53e5d3e9e85fcc1210.zip
Add new folder for destructuring assignment tests
-rw-r--r--src/librustc/hir/mod.rs1
-rw-r--r--src/librustc_typeck/check/expr.rs2
-rw-r--r--src/libsyntax/ast.rs1
-rw-r--r--src/test/ui/bad/bad-expr-lhs.stderr2
-rw-r--r--src/test/ui/destructuring-assignment/note-unsupported.rs (renamed from src/test/ui/bad/destructuring-assignment.rs)0
-rw-r--r--src/test/ui/destructuring-assignment/note-unsupported.stderr (renamed from src/test/ui/bad/destructuring-assignment.stderr)38
6 files changed, 23 insertions, 21 deletions
diff --git a/src/librustc/hir/mod.rs b/src/librustc/hir/mod.rs
index 457851bd7ec..3c7860ae02f 100644
--- a/src/librustc/hir/mod.rs
+++ b/src/librustc/hir/mod.rs
@@ -1628,6 +1628,7 @@ pub enum ExprKind {
     Block(P<Block>, Option<Label>),
 
     /// An assignment (e.g., `a = foo()`).
+    /// The `Span` argument is the span of the `=` token.
     Assign(P<Expr>, P<Expr>, Span),
     /// An assignment with an operator.
     ///
diff --git a/src/librustc_typeck/check/expr.rs b/src/librustc_typeck/check/expr.rs
index 1ff2ea19b7c..542c2b16c60 100644
--- a/src/librustc_typeck/check/expr.rs
+++ b/src/librustc_typeck/check/expr.rs
@@ -751,7 +751,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
             );
             err.span_label(lhs.span, "cannot assign to this expression");
             if self.is_destructuring_place_expr(lhs) {
-                err.note("destructuring assignments are not yet supported");
+                err.note("destructuring assignments are not currently supported");
                 err.note(
                     "for more information, see https://github.com/rust-lang/rfcs/issues/372",
                 );
diff --git a/src/libsyntax/ast.rs b/src/libsyntax/ast.rs
index c00fc761a6a..c98942abaf3 100644
--- a/src/libsyntax/ast.rs
+++ b/src/libsyntax/ast.rs
@@ -1216,6 +1216,7 @@ pub enum ExprKind {
     TryBlock(P<Block>),
 
     /// An assignment (`a = foo()`).
+    /// The `Span` argument is the span of the `=` token.
     Assign(P<Expr>, P<Expr>, Span),
     /// An assignment with an operator.
     ///
diff --git a/src/test/ui/bad/bad-expr-lhs.stderr b/src/test/ui/bad/bad-expr-lhs.stderr
index ce793d8910b..a195e1054d0 100644
--- a/src/test/ui/bad/bad-expr-lhs.stderr
+++ b/src/test/ui/bad/bad-expr-lhs.stderr
@@ -30,7 +30,7 @@ LL |     (a, b) = (3, 4);
    |     |
    |     cannot assign to this expression
    |
-   = note: destructuring assignments are not yet supported
+   = note: destructuring assignments are not currently supported
    = note: for more information, see https://github.com/rust-lang/rfcs/issues/372
 
 error[E0070]: invalid left-hand side of assignment
diff --git a/src/test/ui/bad/destructuring-assignment.rs b/src/test/ui/destructuring-assignment/note-unsupported.rs
index 876c9efea26..876c9efea26 100644
--- a/src/test/ui/bad/destructuring-assignment.rs
+++ b/src/test/ui/destructuring-assignment/note-unsupported.rs
diff --git a/src/test/ui/bad/destructuring-assignment.stderr b/src/test/ui/destructuring-assignment/note-unsupported.stderr
index 3e0925b5658..a6805c32a6e 100644
--- a/src/test/ui/bad/destructuring-assignment.stderr
+++ b/src/test/ui/destructuring-assignment/note-unsupported.stderr
@@ -1,16 +1,16 @@
 error[E0070]: invalid left-hand side of assignment
-  --> $DIR/destructuring-assignment.rs:6:12
+  --> $DIR/note-unsupported.rs:6:12
    |
 LL |     (a, b) = (3, 4);
    |     ------ ^
    |     |
    |     cannot assign to this expression
    |
-   = note: destructuring assignments are not yet supported
+   = note: destructuring assignments are not currently supported
    = note: for more information, see https://github.com/rust-lang/rfcs/issues/372
 
 error[E0368]: binary assignment operation `+=` cannot be applied to type `({integer}, {integer})`
-  --> $DIR/destructuring-assignment.rs:7:5
+  --> $DIR/note-unsupported.rs:7:5
    |
 LL |     (a, b) += (3, 4);
    |     ------^^^^^^^^^^
@@ -20,29 +20,29 @@ LL |     (a, b) += (3, 4);
    = note: an implementation of `std::ops::AddAssign` might be missing for `({integer}, {integer})`
 
 error[E0067]: invalid left-hand side of assignment
-  --> $DIR/destructuring-assignment.rs:7:12
+  --> $DIR/note-unsupported.rs:7:12
    |
 LL |     (a, b) += (3, 4);
    |     ------ ^^
    |     |
    |     cannot assign to this expression
    |
-   = note: destructuring assignments are not yet supported
+   = note: destructuring assignments are not currently supported
    = 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:12
+  --> $DIR/note-unsupported.rs:10:12
    |
 LL |     [a, b] = [3, 4];
    |     ------ ^
    |     |
    |     cannot assign to this expression
    |
-   = note: destructuring assignments are not yet supported
+   = note: destructuring assignments are not currently supported
    = note: for more information, see https://github.com/rust-lang/rfcs/issues/372
 
 error[E0368]: binary assignment operation `+=` cannot be applied to type `[{integer}; 2]`
-  --> $DIR/destructuring-assignment.rs:11:5
+  --> $DIR/note-unsupported.rs:11:5
    |
 LL |     [a, b] += [3, 4];
    |     ------^^^^^^^^^^
@@ -52,29 +52,29 @@ LL |     [a, b] += [3, 4];
    = note: an implementation of `std::ops::AddAssign` might be missing for `[{integer}; 2]`
 
 error[E0067]: invalid left-hand side of assignment
-  --> $DIR/destructuring-assignment.rs:11:12
+  --> $DIR/note-unsupported.rs:11:12
    |
 LL |     [a, b] += [3, 4];
    |     ------ ^^
    |     |
    |     cannot assign to this expression
    |
-   = note: destructuring assignments are not yet supported
+   = note: destructuring assignments are not currently supported
    = 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:22
+  --> $DIR/note-unsupported.rs:16:22
    |
 LL |     S { x: a, y: b } = s;
    |     ---------------- ^
    |     |
    |     cannot assign to this expression
    |
-   = note: destructuring assignments are not yet supported
+   = note: destructuring assignments are not currently supported
    = note: for more information, see https://github.com/rust-lang/rfcs/issues/372
 
 error[E0368]: binary assignment operation `+=` cannot be applied to type `S`
-  --> $DIR/destructuring-assignment.rs:17:5
+  --> $DIR/note-unsupported.rs:17:5
    |
 LL |     S { x: a, y: b } += s;
    |     ----------------^^^^^
@@ -84,36 +84,36 @@ LL |     S { x: a, y: b } += s;
    = note: an implementation of `std::ops::AddAssign` might be missing for `S`
 
 error[E0067]: invalid left-hand side of assignment
-  --> $DIR/destructuring-assignment.rs:17:22
+  --> $DIR/note-unsupported.rs:17:22
    |
 LL |     S { x: a, y: b } += s;
    |     ---------------- ^^
    |     |
    |     cannot assign to this expression
    |
-   = note: destructuring assignments are not yet supported
+   = note: destructuring assignments are not currently supported
    = 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:21
+  --> $DIR/note-unsupported.rs:20:21
    |
 LL |     S { x: a, ..s } = S { x: 3, y: 4 };
    |     --------------- ^
    |     |
    |     cannot assign to this expression
    |
-   = note: destructuring assignments are not yet supported
+   = note: destructuring assignments are not currently supported
    = 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:17
+  --> $DIR/note-unsupported.rs:24:17
    |
 LL |     ((a, b), c) = ((3, 4), 5);
    |     ----------- ^
    |     |
    |     cannot assign to this expression
    |
-   = note: destructuring assignments are not yet supported
+   = note: destructuring assignments are not currently supported
    = note: for more information, see https://github.com/rust-lang/rfcs/issues/372
 
 error: aborting due to 11 previous errors