Skip to content

Commit 9a60224

Browse files
committed
Add new folder for destructuring assignment tests
1 parent 35979a9 commit 9a60224

File tree

6 files changed

+23
-21
lines changed

6 files changed

+23
-21
lines changed

src/librustc/hir/mod.rs

+1
Original file line numberDiff line numberDiff line change
@@ -1628,6 +1628,7 @@ pub enum ExprKind {
16281628
Block(P<Block>, Option<Label>),
16291629

16301630
/// An assignment (e.g., `a = foo()`).
1631+
/// The `Span` argument is the span of the `=` token.
16311632
Assign(P<Expr>, P<Expr>, Span),
16321633
/// An assignment with an operator.
16331634
///

src/librustc_typeck/check/expr.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -751,7 +751,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
751751
);
752752
err.span_label(lhs.span, "cannot assign to this expression");
753753
if self.is_destructuring_place_expr(lhs) {
754-
err.note("destructuring assignments are not yet supported");
754+
err.note("destructuring assignments are not currently supported");
755755
err.note(
756756
"for more information, see https://github.com/rust-lang/rfcs/issues/372",
757757
);

src/libsyntax/ast.rs

+1
Original file line numberDiff line numberDiff line change
@@ -1216,6 +1216,7 @@ pub enum ExprKind {
12161216
TryBlock(P<Block>),
12171217

12181218
/// An assignment (`a = foo()`).
1219+
/// The `Span` argument is the span of the `=` token.
12191220
Assign(P<Expr>, P<Expr>, Span),
12201221
/// An assignment with an operator.
12211222
///

src/test/ui/bad/bad-expr-lhs.stderr

+1-1
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ LL | (a, b) = (3, 4);
3030
| |
3131
| cannot assign to this expression
3232
|
33-
= note: destructuring assignments are not yet supported
33+
= note: destructuring assignments are not currently supported
3434
= note: for more information, see https://github.com/rust-lang/rfcs/issues/372
3535

3636
error[E0070]: invalid left-hand side of assignment

src/test/ui/bad/destructuring-assignment.stderr renamed to src/test/ui/destructuring-assignment/note-unsupported.stderr

+19-19
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,16 @@
11
error[E0070]: invalid left-hand side of assignment
2-
--> $DIR/destructuring-assignment.rs:6:12
2+
--> $DIR/note-unsupported.rs:6:12
33
|
44
LL | (a, b) = (3, 4);
55
| ------ ^
66
| |
77
| cannot assign to this expression
88
|
9-
= note: destructuring assignments are not yet supported
9+
= note: destructuring assignments are not currently supported
1010
= note: for more information, see https://github.com/rust-lang/rfcs/issues/372
1111

1212
error[E0368]: binary assignment operation `+=` cannot be applied to type `({integer}, {integer})`
13-
--> $DIR/destructuring-assignment.rs:7:5
13+
--> $DIR/note-unsupported.rs:7:5
1414
|
1515
LL | (a, b) += (3, 4);
1616
| ------^^^^^^^^^^
@@ -20,29 +20,29 @@ LL | (a, b) += (3, 4);
2020
= note: an implementation of `std::ops::AddAssign` might be missing for `({integer}, {integer})`
2121

2222
error[E0067]: invalid left-hand side of assignment
23-
--> $DIR/destructuring-assignment.rs:7:12
23+
--> $DIR/note-unsupported.rs:7:12
2424
|
2525
LL | (a, b) += (3, 4);
2626
| ------ ^^
2727
| |
2828
| cannot assign to this expression
2929
|
30-
= note: destructuring assignments are not yet supported
30+
= note: destructuring assignments are not currently supported
3131
= note: for more information, see https://github.com/rust-lang/rfcs/issues/372
3232

3333
error[E0070]: invalid left-hand side of assignment
34-
--> $DIR/destructuring-assignment.rs:10:12
34+
--> $DIR/note-unsupported.rs:10:12
3535
|
3636
LL | [a, b] = [3, 4];
3737
| ------ ^
3838
| |
3939
| cannot assign to this expression
4040
|
41-
= note: destructuring assignments are not yet supported
41+
= note: destructuring assignments are not currently supported
4242
= note: for more information, see https://github.com/rust-lang/rfcs/issues/372
4343

4444
error[E0368]: binary assignment operation `+=` cannot be applied to type `[{integer}; 2]`
45-
--> $DIR/destructuring-assignment.rs:11:5
45+
--> $DIR/note-unsupported.rs:11:5
4646
|
4747
LL | [a, b] += [3, 4];
4848
| ------^^^^^^^^^^
@@ -52,29 +52,29 @@ LL | [a, b] += [3, 4];
5252
= note: an implementation of `std::ops::AddAssign` might be missing for `[{integer}; 2]`
5353

5454
error[E0067]: invalid left-hand side of assignment
55-
--> $DIR/destructuring-assignment.rs:11:12
55+
--> $DIR/note-unsupported.rs:11:12
5656
|
5757
LL | [a, b] += [3, 4];
5858
| ------ ^^
5959
| |
6060
| cannot assign to this expression
6161
|
62-
= note: destructuring assignments are not yet supported
62+
= note: destructuring assignments are not currently supported
6363
= note: for more information, see https://github.com/rust-lang/rfcs/issues/372
6464

6565
error[E0070]: invalid left-hand side of assignment
66-
--> $DIR/destructuring-assignment.rs:16:22
66+
--> $DIR/note-unsupported.rs:16:22
6767
|
6868
LL | S { x: a, y: b } = s;
6969
| ---------------- ^
7070
| |
7171
| cannot assign to this expression
7272
|
73-
= note: destructuring assignments are not yet supported
73+
= note: destructuring assignments are not currently supported
7474
= note: for more information, see https://github.com/rust-lang/rfcs/issues/372
7575

7676
error[E0368]: binary assignment operation `+=` cannot be applied to type `S`
77-
--> $DIR/destructuring-assignment.rs:17:5
77+
--> $DIR/note-unsupported.rs:17:5
7878
|
7979
LL | S { x: a, y: b } += s;
8080
| ----------------^^^^^
@@ -84,36 +84,36 @@ LL | S { x: a, y: b } += s;
8484
= note: an implementation of `std::ops::AddAssign` might be missing for `S`
8585

8686
error[E0067]: invalid left-hand side of assignment
87-
--> $DIR/destructuring-assignment.rs:17:22
87+
--> $DIR/note-unsupported.rs:17:22
8888
|
8989
LL | S { x: a, y: b } += s;
9090
| ---------------- ^^
9191
| |
9292
| cannot assign to this expression
9393
|
94-
= note: destructuring assignments are not yet supported
94+
= note: destructuring assignments are not currently supported
9595
= note: for more information, see https://github.com/rust-lang/rfcs/issues/372
9696

9797
error[E0070]: invalid left-hand side of assignment
98-
--> $DIR/destructuring-assignment.rs:20:21
98+
--> $DIR/note-unsupported.rs:20:21
9999
|
100100
LL | S { x: a, ..s } = S { x: 3, y: 4 };
101101
| --------------- ^
102102
| |
103103
| cannot assign to this expression
104104
|
105-
= note: destructuring assignments are not yet supported
105+
= note: destructuring assignments are not currently supported
106106
= note: for more information, see https://github.com/rust-lang/rfcs/issues/372
107107

108108
error[E0070]: invalid left-hand side of assignment
109-
--> $DIR/destructuring-assignment.rs:24:17
109+
--> $DIR/note-unsupported.rs:24:17
110110
|
111111
LL | ((a, b), c) = ((3, 4), 5);
112112
| ----------- ^
113113
| |
114114
| cannot assign to this expression
115115
|
116-
= note: destructuring assignments are not yet supported
116+
= note: destructuring assignments are not currently supported
117117
= note: for more information, see https://github.com/rust-lang/rfcs/issues/372
118118

119119
error: aborting due to 11 previous errors

0 commit comments

Comments
 (0)