diff options
| author | Mazdak Farrokhzad <twingoow@gmail.com> | 2019-11-11 11:39:52 +0100 |
|---|---|---|
| committer | Mazdak Farrokhzad <twingoow@gmail.com> | 2019-12-23 14:47:19 +0100 |
| commit | 5f92a56ed69d9384429353b713d74f67ee8f957c (patch) | |
| tree | da908b902c53cb63c03f8b2e5a98209691737cef /src/test/ui/error-codes | |
| parent | a916ac22b9f7f1f0f7aba0a41a789b3ecd765018 (diff) | |
| download | rust-5f92a56ed69d9384429353b713d74f67ee8f957c.tar.gz rust-5f92a56ed69d9384429353b713d74f67ee8f957c.zip | |
Introduce `#![feature(bindings_after_at)]`.
Under the gate, `x @ Some(y)` is allowed. This is subject to various restrictions for soundness.
Diffstat (limited to 'src/test/ui/error-codes')
| -rw-r--r-- | src/test/ui/error-codes/E0007.rs | 4 | ||||
| -rw-r--r-- | src/test/ui/error-codes/E0007.stderr | 22 | ||||
| -rw-r--r-- | src/test/ui/error-codes/E0303.rs | 8 | ||||
| -rw-r--r-- | src/test/ui/error-codes/E0303.stderr | 19 |
4 files changed, 15 insertions, 38 deletions
diff --git a/src/test/ui/error-codes/E0007.rs b/src/test/ui/error-codes/E0007.rs index cdda735ba44..4f7fc0dc232 100644 --- a/src/test/ui/error-codes/E0007.rs +++ b/src/test/ui/error-codes/E0007.rs @@ -1,9 +1,11 @@ +#![feature(bindings_after_at)] +//~^ WARN the feature `bindings_after_at` is incomplete and may cause the compiler to crash + 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..d7b8050c3a4 100644 --- a/src/test/ui/error-codes/E0007.stderr +++ b/src/test/ui/error-codes/E0007.stderr @@ -1,17 +1,19 @@ -error[E0007]: cannot bind by-move with sub-bindings - --> $DIR/E0007.rs:4:9 +warning: the feature `bindings_after_at` is incomplete and may cause the compiler to crash + --> $DIR/E0007.rs:1:12 | -LL | op_string @ Some(s) => {}, - | ^^^^^^^^^^^^^^^^^^^ binds an already bound by-move value by moving it +LL | #![feature(bindings_after_at)] + | ^^^^^^^^^^^^^^^^^ + | + = note: `#[warn(incomplete_features)]` on by default -error[E0303]: pattern bindings are not allowed after an `@` - --> $DIR/E0007.rs:4:26 +error[E0007]: cannot bind by-move with sub-bindings + --> $DIR/E0007.rs:7:9 | LL | op_string @ Some(s) => {}, - | ^ not allowed after `@` + | ^^^^^^^^^^^^^^^^^^^ binds an already bound by-move value by moving it error[E0382]: use of moved value - --> $DIR/E0007.rs:4:26 + --> $DIR/E0007.rs:7: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 +24,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/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`. |
