about summary refs log tree commit diff
path: root/src/test
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2014-07-04 12:01:22 +0000
committerbors <bors@rust-lang.org>2014-07-04 12:01:22 +0000
commitc0b76abf91aa204be0cb9336988eec48d91bcfd7 (patch)
treefa1cabbe248fd1735d0044c8f9eee40a20a45a26 /src/test
parent36d7d746c8366d78b332cffdff85318e709b38ca (diff)
parentc2c27faa35212eea653c7095cca6817be6c48fb1 (diff)
downloadrust-c0b76abf91aa204be0cb9336988eec48d91bcfd7.tar.gz
rust-c0b76abf91aa204be0cb9336988eec48d91bcfd7.zip
auto merge of #15388 : jakub-/rust/issue-12285, r=pcwalton
Unit-like struct patterns are irrefutable, no need for a branch.

And some cleanup while I'm at it.
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!()
+    }
+}