diff options
| author | Caio <c410.f3r@gmail.com> | 2021-04-17 18:53:54 -0300 |
|---|---|---|
| committer | Caio <c410.f3r@gmail.com> | 2021-04-17 18:53:54 -0300 |
| commit | 4e6d6abc6a514988ae13cea41993688d8cf9dd4a (patch) | |
| tree | 8949623d58304ad65b5e095f7ac026938adbad06 /src/test/ui/destructuring-assignment | |
| parent | 4029d4d0be03b10edccb65588b522ad541b5ccaf (diff) | |
| download | rust-4e6d6abc6a514988ae13cea41993688d8cf9dd4a.tar.gz rust-4e6d6abc6a514988ae13cea41993688d8cf9dd4a.zip | |
Move some tests to more reasonable directories - 6
Diffstat (limited to 'src/test/ui/destructuring-assignment')
| -rw-r--r-- | src/test/ui/destructuring-assignment/bad-expr-lhs.rs | 12 | ||||
| -rw-r--r-- | src/test/ui/destructuring-assignment/bad-expr-lhs.stderr | 66 |
2 files changed, 78 insertions, 0 deletions
diff --git a/src/test/ui/destructuring-assignment/bad-expr-lhs.rs b/src/test/ui/destructuring-assignment/bad-expr-lhs.rs new file mode 100644 index 00000000000..39536f12e3b --- /dev/null +++ b/src/test/ui/destructuring-assignment/bad-expr-lhs.rs @@ -0,0 +1,12 @@ +fn main() { + 1 = 2; //~ ERROR invalid left-hand side of assignment + 1 += 2; //~ ERROR invalid left-hand side of assignment + (1, 2) = (3, 4); //~ ERROR destructuring assignments are unstable + //~| ERROR invalid left-hand side of assignment + //~| ERROR invalid left-hand side of assignment + + let (a, b) = (1, 2); + (a, b) = (3, 4); //~ ERROR destructuring assignments are unstable + + None = Some(3); //~ ERROR invalid left-hand side of assignment +} diff --git a/src/test/ui/destructuring-assignment/bad-expr-lhs.stderr b/src/test/ui/destructuring-assignment/bad-expr-lhs.stderr new file mode 100644 index 00000000000..d4b2193d09f --- /dev/null +++ b/src/test/ui/destructuring-assignment/bad-expr-lhs.stderr @@ -0,0 +1,66 @@ +error[E0658]: destructuring assignments are unstable + --> $DIR/bad-expr-lhs.rs:4:12 + | +LL | (1, 2) = (3, 4); + | ------ ^ + | | + | cannot assign to this expression + | + = note: see issue #71126 <https://github.com/rust-lang/rust/issues/71126> for more information + = help: add `#![feature(destructuring_assignment)]` to the crate attributes to enable + +error[E0658]: destructuring assignments are unstable + --> $DIR/bad-expr-lhs.rs:9:12 + | +LL | (a, b) = (3, 4); + | ------ ^ + | | + | cannot assign to this expression + | + = note: see issue #71126 <https://github.com/rust-lang/rust/issues/71126> for more information + = help: add `#![feature(destructuring_assignment)]` to the crate attributes to enable + +error[E0070]: invalid left-hand side of assignment + --> $DIR/bad-expr-lhs.rs:2:7 + | +LL | 1 = 2; + | - ^ + | | + | cannot assign to this expression + +error[E0067]: invalid left-hand side of assignment + --> $DIR/bad-expr-lhs.rs:3:7 + | +LL | 1 += 2; + | - ^^ + | | + | cannot assign to this expression + +error[E0070]: invalid left-hand side of assignment + --> $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: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:11:10 + | +LL | None = Some(3); + | ---- ^ + | | + | cannot assign to this expression + +error: aborting due to 7 previous errors + +Some errors have detailed explanations: E0067, E0070, E0658. +For more information about an error, try `rustc --explain E0067`. |
