about summary refs log tree commit diff
path: root/src/test
diff options
context:
space:
mode:
authorJakub Wieczorek <jakub@jakub.cc>2014-07-03 22:53:20 +0200
committerJakub Wieczorek <jakub@jakub.cc>2014-07-04 00:29:47 +0200
commitc2c27faa35212eea653c7095cca6817be6c48fb1 (patch)
tree843fbaf895f37e358a0e6d08cc69b1edac18444d /src/test
parenteda75bcf42ad99e3e4c99585d39705fccac606ee (diff)
downloadrust-c2c27faa35212eea653c7095cca6817be6c48fb1.tar.gz
rust-c2c27faa35212eea653c7095cca6817be6c48fb1.zip
Fix #12285
Unit-like struct patterns are irrefutable, no need for a branch.
Diffstat (limited to 'src/test')
-rw-r--r--src/test/run-pass/issue-12285.rs22
1 files changed, 22 insertions, 0 deletions
diff --git a/src/test/run-pass/issue-12285.rs b/src/test/run-pass/issue-12285.rs
new file mode 100644
index 00000000000..563771212aa
--- /dev/null
+++ b/src/test/run-pass/issue-12285.rs
@@ -0,0 +1,22 @@
+// Copyright 2014 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.
+
+struct S;
+
+fn main() {
+    match Some(&S) {
+        Some(&S) => {},
+        _x => unreachable!()
+    }
+    match Some(&S) {
+        Some(&S) => {},
+        None => unreachable!()
+    }
+}