about summary refs log tree commit diff
path: root/src/test/ui/compile-fail-migration/resolve-inconsistent-binding-mode.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/test/ui/compile-fail-migration/resolve-inconsistent-binding-mode.rs')
-rw-r--r--src/test/ui/compile-fail-migration/resolve-inconsistent-binding-mode.rs50
1 files changed, 50 insertions, 0 deletions
diff --git a/src/test/ui/compile-fail-migration/resolve-inconsistent-binding-mode.rs b/src/test/ui/compile-fail-migration/resolve-inconsistent-binding-mode.rs
new file mode 100644
index 00000000000..63d33a9e5fa
--- /dev/null
+++ b/src/test/ui/compile-fail-migration/resolve-inconsistent-binding-mode.rs
@@ -0,0 +1,50 @@
+// Copyright 2012 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.
+
+enum opts {
+    a(isize), b(isize), c(isize)
+}
+
+fn matcher1(x: opts) {
+    match x {
+      opts::a(ref i) | opts::b(i) => {}
+      //~^ ERROR variable `i` is bound in inconsistent ways within the same match arm
+      //~^^ ERROR mismatched types
+      opts::c(_) => {}
+    }
+}
+
+fn matcher2(x: opts) {
+    match x {
+      opts::a(ref i) | opts::b(i) => {}
+      //~^ ERROR variable `i` is bound in inconsistent ways within the same match arm
+      //~^^ ERROR mismatched types
+      opts::c(_) => {}
+    }
+}
+
+fn matcher4(x: opts) {
+    match x {
+      opts::a(ref mut i) | opts::b(ref i) => {}
+      //~^ ERROR variable `i` is bound in inconsistent ways within the same match arm
+      //~^^ ERROR mismatched types
+      opts::c(_) => {}
+    }
+}
+
+
+fn matcher5(x: opts) {
+    match x {
+      opts::a(ref i) | opts::b(ref i) => {}
+      opts::c(_) => {}
+    }
+}
+
+fn main() {}