about summary refs log tree commit diff
path: root/src/test
diff options
context:
space:
mode:
authorAriel Ben-Yehuda <arielb1@mail.tau.ac.il>2015-07-28 16:52:54 +0300
committerAriel Ben-Yehuda <arielb1@mail.tau.ac.il>2015-07-28 19:51:08 +0300
commit757b0c176fa185fda59283efaf0d8079b702ca69 (patch)
tree4537c9102290e62de75a32cb1043b58ca46f2ff8 /src/test
parent4c371bb6de7a1c21b7403b86a66a8ce3318ff003 (diff)
downloadrust-757b0c176fa185fda59283efaf0d8079b702ca69.tar.gz
rust-757b0c176fa185fda59283efaf0d8079b702ca69.zip
prohibit the lhs of an @-pattern being a constant
as this breaks code that worked under some conditions, this is a
[breaking-change]

Fixes #27033
Fixes #27077
Diffstat (limited to 'src/test')
-rw-r--r--src/test/compile-fail/issue-27033.rs22
1 files changed, 22 insertions, 0 deletions
diff --git a/src/test/compile-fail/issue-27033.rs b/src/test/compile-fail/issue-27033.rs
new file mode 100644
index 00000000000..051edfe5f45
--- /dev/null
+++ b/src/test/compile-fail/issue-27033.rs
@@ -0,0 +1,22 @@
+// Copyright 2015 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+fn main() {
+    match Some(1) {
+        None @ _ => {} //~ ERROR declaration of `None` shadows an enum variant
+    };
+    const C: u8 = 1;
+    match 1 {
+        C @ 2 => { //~ ERROR only irrefutable patterns allowed here
+            println!("{}", C);
+        }
+        _ => {}
+    };
+}