Skip to content

Commit

Permalink
Add new folder for destructuring assignment tests
Browse files Browse the repository at this point in the history
  • Loading branch information
varkor committed Dec 22, 2019
1 parent ddd4500 commit 770725c
Show file tree
Hide file tree
Showing 6 changed files with 12 additions and 10 deletions.
1 change: 1 addition & 0 deletions src/librustc/hir/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1659,6 +1659,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.
///
Expand Down
2 changes: 1 addition & 1 deletion src/librustc_typeck/check/expr.rs
Original file line number Diff line number Diff line change
Expand Up @@ -788,7 +788,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",
);
Expand Down
1 change: 1 addition & 0 deletions src/libsyntax/ast.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1228,6 +1228,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.
///
Expand Down
2 changes: 1 addition & 1 deletion src/test/ui/bad/bad-expr-lhs.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,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[E0368]: binary assignment operation `+=` cannot be applied to type `({integer}, {integer})`
Expand All @@ -27,7 +27,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
Expand All @@ -38,7 +38,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[E0368]: binary assignment operation `+=` cannot be applied to type `[{integer}; 2]`
Expand All @@ -59,7 +59,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
Expand All @@ -70,7 +70,7 @@ 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`
Expand All @@ -91,7 +91,7 @@ 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
Expand All @@ -102,7 +102,7 @@ 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
Expand All @@ -113,7 +113,7 @@ 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
Expand Down

0 comments on commit 770725c

Please sign in to comment.