diff options
| author | bors <bors@rust-lang.org> | 2019-12-23 21:49:44 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2019-12-23 21:49:44 +0000 |
| commit | a4cd03dee2b57216b5c95084a0b46de130946ad7 (patch) | |
| tree | f7b088dc1993e10a614283fbecc7a7bef4d6e552 /src/test/ui/error-codes | |
| parent | 9ae6cedb8d1e37469be1434642a3e403fce50a03 (diff) | |
| parent | acfe58272cb188e2da69d2bf1285bf2d954de9a2 (diff) | |
| download | rust-a4cd03dee2b57216b5c95084a0b46de130946ad7.tar.gz rust-a4cd03dee2b57216b5c95084a0b46de130946ad7.zip | |
Auto merge of #66296 - Centril:bindings_after_at-init, r=pnkfelix
Initial implementation of `#![feature(bindings_after_at)]` Following up on #16053, under the gate `#![feature(bindings_after_at)]`, `x @ Some(y)` is allowed subject to restrictions necessary for soundness. The implementation and test suite should be fairly complete now. One aspect that is not covered is the interaction with nested `#![feature(or_patterns)]`. This is not possible to test at the moment in a good way because that feature has not progressed sufficiently and has fatal errors in MIR building. We should make sure to add such tests before we stabilize both features (but shipping one of them is fine). r? @pnkfelix cc @nikomatsakis @matthewjasper @pcwalton cc https://github.com/rust-lang/rust/issues/65490
Diffstat (limited to 'src/test/ui/error-codes')
| -rw-r--r-- | src/test/ui/error-codes/E0007.rs | 3 | ||||
| -rw-r--r-- | src/test/ui/error-codes/E0007.stderr | 14 | ||||
| -rw-r--r-- | src/test/ui/error-codes/E0009.stderr | 2 | ||||
| -rw-r--r-- | src/test/ui/error-codes/E0303.rs | 8 | ||||
| -rw-r--r-- | src/test/ui/error-codes/E0303.stderr | 19 |
5 files changed, 7 insertions, 39 deletions
diff --git a/src/test/ui/error-codes/E0007.rs b/src/test/ui/error-codes/E0007.rs index cdda735ba44..022ac5fc113 100644 --- a/src/test/ui/error-codes/E0007.rs +++ b/src/test/ui/error-codes/E0007.rs @@ -1,9 +1,10 @@ +#![feature(bindings_after_at)] + fn main() { let x = Some("s".to_string()); match x { op_string @ Some(s) => {}, //~^ ERROR E0007 - //~| ERROR E0303 //~| ERROR E0382 None => {}, } diff --git a/src/test/ui/error-codes/E0007.stderr b/src/test/ui/error-codes/E0007.stderr index 89a6298c875..31af9171725 100644 --- a/src/test/ui/error-codes/E0007.stderr +++ b/src/test/ui/error-codes/E0007.stderr @@ -1,17 +1,11 @@ error[E0007]: cannot bind by-move with sub-bindings - --> $DIR/E0007.rs:4:9 + --> $DIR/E0007.rs:6:9 | LL | op_string @ Some(s) => {}, | ^^^^^^^^^^^^^^^^^^^ binds an already bound by-move value by moving it -error[E0303]: pattern bindings are not allowed after an `@` - --> $DIR/E0007.rs:4:26 - | -LL | op_string @ Some(s) => {}, - | ^ not allowed after `@` - error[E0382]: use of moved value - --> $DIR/E0007.rs:4:26 + --> $DIR/E0007.rs:6:26 | LL | let x = Some("s".to_string()); | - move occurs because `x` has type `std::option::Option<std::string::String>`, which does not implement the `Copy` trait @@ -22,7 +16,7 @@ LL | op_string @ Some(s) => {}, | | value used here after move | value moved here -error: aborting due to 3 previous errors +error: aborting due to 2 previous errors -Some errors have detailed explanations: E0007, E0303, E0382. +Some errors have detailed explanations: E0007, E0382. For more information about an error, try `rustc --explain E0007`. diff --git a/src/test/ui/error-codes/E0009.stderr b/src/test/ui/error-codes/E0009.stderr index f8acb9a09d9..446a436d647 100644 --- a/src/test/ui/error-codes/E0009.stderr +++ b/src/test/ui/error-codes/E0009.stderr @@ -2,7 +2,7 @@ error[E0009]: cannot bind by-move and by-ref in the same pattern --> $DIR/E0009.rs:5:15 | LL | Some((y, ref z)) => {}, - | ^ ----- both by-ref and by-move used + | ^ ----- by-ref pattern here | | | by-move pattern here diff --git a/src/test/ui/error-codes/E0303.rs b/src/test/ui/error-codes/E0303.rs deleted file mode 100644 index 0530d43b653..00000000000 --- a/src/test/ui/error-codes/E0303.rs +++ /dev/null @@ -1,8 +0,0 @@ -fn main() { - match Some("hi".to_string()) { - ref op_string_ref @ Some(s) => {}, - //~^ ERROR pattern bindings are not allowed after an `@` [E0303] - //~| ERROR E0009 - None => {}, - } -} diff --git a/src/test/ui/error-codes/E0303.stderr b/src/test/ui/error-codes/E0303.stderr deleted file mode 100644 index af537ce5625..00000000000 --- a/src/test/ui/error-codes/E0303.stderr +++ /dev/null @@ -1,19 +0,0 @@ -error[E0009]: cannot bind by-move and by-ref in the same pattern - --> $DIR/E0303.rs:3:34 - | -LL | ref op_string_ref @ Some(s) => {}, - | -------------------------^- - | | | - | | by-move pattern here - | both by-ref and by-move used - -error[E0303]: pattern bindings are not allowed after an `@` - --> $DIR/E0303.rs:3:34 - | -LL | ref op_string_ref @ Some(s) => {}, - | ^ not allowed after `@` - -error: aborting due to 2 previous errors - -Some errors have detailed explanations: E0009, E0303. -For more information about an error, try `rustc --explain E0009`. |
