]> git.lizzy.rs Git - rust.git/commitdiff
Change `alt` to `match` in filenames.
authorLindsey Kuper <lindsey@composition.al>
Mon, 27 May 2013 21:28:16 +0000 (17:28 -0400)
committerLindsey Kuper <lindsey@composition.al>
Mon, 27 May 2013 21:28:39 +0000 (17:28 -0400)
130 files changed:
src/test/compile-fail/alt-arrows-block-then-binop.rs [deleted file]
src/test/compile-fail/alt-join.rs [deleted file]
src/test/compile-fail/alt-pattern-field-mismatch-2.rs [deleted file]
src/test/compile-fail/alt-pattern-field-mismatch.rs [deleted file]
src/test/compile-fail/alt-range-fail-dominate.rs [deleted file]
src/test/compile-fail/alt-range-fail.rs [deleted file]
src/test/compile-fail/alt-tag-nullary.rs [deleted file]
src/test/compile-fail/alt-tag-unary.rs [deleted file]
src/test/compile-fail/alt-vec-invalid.rs [deleted file]
src/test/compile-fail/alt-vec-mismatch-2.rs [deleted file]
src/test/compile-fail/alt-vec-mismatch.rs [deleted file]
src/test/compile-fail/alt-vec-unreachable.rs [deleted file]
src/test/compile-fail/bad-alt.rs [deleted file]
src/test/compile-fail/bad-match.rs [new file with mode: 0644]
src/test/compile-fail/match-arrows-block-then-binop.rs [new file with mode: 0644]
src/test/compile-fail/match-join.rs [new file with mode: 0644]
src/test/compile-fail/match-pattern-field-mismatch-2.rs [new file with mode: 0644]
src/test/compile-fail/match-pattern-field-mismatch.rs [new file with mode: 0644]
src/test/compile-fail/match-range-fail-dominate.rs [new file with mode: 0644]
src/test/compile-fail/match-range-fail.rs [new file with mode: 0644]
src/test/compile-fail/match-tag-nullary.rs [new file with mode: 0644]
src/test/compile-fail/match-tag-unary.rs [new file with mode: 0644]
src/test/compile-fail/match-vec-invalid.rs [new file with mode: 0644]
src/test/compile-fail/match-vec-mismatch-2.rs [new file with mode: 0644]
src/test/compile-fail/match-vec-mismatch.rs [new file with mode: 0644]
src/test/compile-fail/match-vec-unreachable.rs [new file with mode: 0644]
src/test/pretty/alt-naked-expr-long.rs [deleted file]
src/test/pretty/alt-naked-expr-medium.rs [deleted file]
src/test/pretty/alt-naked-expr.rs [deleted file]
src/test/pretty/match-naked-expr-long.rs [new file with mode: 0644]
src/test/pretty/match-naked-expr-medium.rs [new file with mode: 0644]
src/test/pretty/match-naked-expr.rs [new file with mode: 0644]
src/test/run-fail/alt-bot-fail.rs [deleted file]
src/test/run-fail/alt-disc-bot.rs [deleted file]
src/test/run-fail/alt-wildcards.rs [deleted file]
src/test/run-fail/expr-alt-fail-fn.rs [deleted file]
src/test/run-fail/expr-alt-fail.rs [deleted file]
src/test/run-fail/expr-match-fail-fn.rs [new file with mode: 0644]
src/test/run-fail/expr-match-fail.rs [new file with mode: 0644]
src/test/run-fail/match-bot-fail.rs [new file with mode: 0644]
src/test/run-fail/match-disc-bot.rs [new file with mode: 0644]
src/test/run-fail/match-wildcards.rs [new file with mode: 0644]
src/test/run-fail/unwind-alt.rs [deleted file]
src/test/run-fail/unwind-match.rs [new file with mode: 0644]
src/test/run-pass/alt-borrowed_str.rs [deleted file]
src/test/run-pass/alt-bot-2.rs [deleted file]
src/test/run-pass/alt-bot.rs [deleted file]
src/test/run-pass/alt-implicit-copy-unique.rs [deleted file]
src/test/run-pass/alt-join.rs [deleted file]
src/test/run-pass/alt-naked-record-expr.rs [deleted file]
src/test/run-pass/alt-naked-record.rs [deleted file]
src/test/run-pass/alt-path.rs [deleted file]
src/test/run-pass/alt-pattern-drop.rs [deleted file]
src/test/run-pass/alt-pattern-lit.rs [deleted file]
src/test/run-pass/alt-pattern-no-type-params.rs [deleted file]
src/test/run-pass/alt-pattern-simple.rs [deleted file]
src/test/run-pass/alt-phi.rs [deleted file]
src/test/run-pass/alt-range.rs [deleted file]
src/test/run-pass/alt-ref-binding-in-guard-3256.rs [deleted file]
src/test/run-pass/alt-ref-binding-mut-option.rs [deleted file]
src/test/run-pass/alt-ref-binding-mut.rs [deleted file]
src/test/run-pass/alt-ref-binding.rs [deleted file]
src/test/run-pass/alt-str.rs [deleted file]
src/test/run-pass/alt-tag.rs [deleted file]
src/test/run-pass/alt-unique-bind.rs [deleted file]
src/test/run-pass/alt-value-binding-in-guard-3291.rs [deleted file]
src/test/run-pass/alt-with-ret-arm.rs [deleted file]
src/test/run-pass/expr-alt-box.rs [deleted file]
src/test/run-pass/expr-alt-fail-all.rs [deleted file]
src/test/run-pass/expr-alt-fail.rs [deleted file]
src/test/run-pass/expr-alt-generic-box1.rs [deleted file]
src/test/run-pass/expr-alt-generic-box2.rs [deleted file]
src/test/run-pass/expr-alt-generic-unique1.rs [deleted file]
src/test/run-pass/expr-alt-generic-unique2.rs [deleted file]
src/test/run-pass/expr-alt-generic.rs [deleted file]
src/test/run-pass/expr-alt-struct.rs [deleted file]
src/test/run-pass/expr-alt-unique.rs [deleted file]
src/test/run-pass/expr-alt.rs [deleted file]
src/test/run-pass/expr-match-box.rs [new file with mode: 0644]
src/test/run-pass/expr-match-fail-all.rs [new file with mode: 0644]
src/test/run-pass/expr-match-fail.rs [new file with mode: 0644]
src/test/run-pass/expr-match-generic-box1.rs [new file with mode: 0644]
src/test/run-pass/expr-match-generic-box2.rs [new file with mode: 0644]
src/test/run-pass/expr-match-generic-unique1.rs [new file with mode: 0644]
src/test/run-pass/expr-match-generic-unique2.rs [new file with mode: 0644]
src/test/run-pass/expr-match-generic.rs [new file with mode: 0644]
src/test/run-pass/expr-match-struct.rs [new file with mode: 0644]
src/test/run-pass/expr-match-unique.rs [new file with mode: 0644]
src/test/run-pass/expr-match.rs [new file with mode: 0644]
src/test/run-pass/fat-arrow-alt.rs [deleted file]
src/test/run-pass/fat-arrow-match.rs [new file with mode: 0644]
src/test/run-pass/generic-tag-alt.rs [deleted file]
src/test/run-pass/generic-tag-match.rs [new file with mode: 0644]
src/test/run-pass/match-borrowed_str.rs [new file with mode: 0644]
src/test/run-pass/match-bot-2.rs [new file with mode: 0644]
src/test/run-pass/match-bot.rs [new file with mode: 0644]
src/test/run-pass/match-implicit-copy-unique.rs [new file with mode: 0644]
src/test/run-pass/match-join.rs [new file with mode: 0644]
src/test/run-pass/match-naked-record-expr.rs [new file with mode: 0644]
src/test/run-pass/match-naked-record.rs [new file with mode: 0644]
src/test/run-pass/match-path.rs [new file with mode: 0644]
src/test/run-pass/match-pattern-drop.rs [new file with mode: 0644]
src/test/run-pass/match-pattern-lit.rs [new file with mode: 0644]
src/test/run-pass/match-pattern-no-type-params.rs [new file with mode: 0644]
src/test/run-pass/match-pattern-simple.rs [new file with mode: 0644]
src/test/run-pass/match-phi.rs [new file with mode: 0644]
src/test/run-pass/match-range.rs [new file with mode: 0644]
src/test/run-pass/match-ref-binding-in-guard-3256.rs [new file with mode: 0644]
src/test/run-pass/match-ref-binding-mut-option.rs [new file with mode: 0644]
src/test/run-pass/match-ref-binding-mut.rs [new file with mode: 0644]
src/test/run-pass/match-ref-binding.rs [new file with mode: 0644]
src/test/run-pass/match-str.rs [new file with mode: 0644]
src/test/run-pass/match-tag.rs [new file with mode: 0644]
src/test/run-pass/match-unique-bind.rs [new file with mode: 0644]
src/test/run-pass/match-value-binding-in-guard-3291.rs [new file with mode: 0644]
src/test/run-pass/match-with-ret-arm.rs [new file with mode: 0644]
src/test/run-pass/nested-alts.rs [deleted file]
src/test/run-pass/nested-exhaustive-alt.rs [deleted file]
src/test/run-pass/nested-exhaustive-match.rs [new file with mode: 0644]
src/test/run-pass/nested-matchs.rs [new file with mode: 0644]
src/test/run-pass/simple-alt-generic-tag.rs [deleted file]
src/test/run-pass/simple-generic-alt.rs [deleted file]
src/test/run-pass/simple-generic-match.rs [new file with mode: 0644]
src/test/run-pass/simple-match-generic-tag.rs [new file with mode: 0644]
src/test/run-pass/unique-alt-discrim.rs [deleted file]
src/test/run-pass/unique-match-discrim.rs [new file with mode: 0644]
src/test/run-pass/use-uninit-alt.rs [deleted file]
src/test/run-pass/use-uninit-alt2.rs [deleted file]
src/test/run-pass/use-uninit-match.rs [new file with mode: 0644]
src/test/run-pass/use-uninit-match2.rs [new file with mode: 0644]

diff --git a/src/test/compile-fail/alt-arrows-block-then-binop.rs b/src/test/compile-fail/alt-arrows-block-then-binop.rs
deleted file mode 100644 (file)
index b6b2313..0000000
+++ /dev/null
@@ -1,17 +0,0 @@
-// 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.
-
-fn main() {
-
-    match 0 {
-      0 => {
-      } + 5 //~ ERROR unexpected token: `+`
-    }
-}
diff --git a/src/test/compile-fail/alt-join.rs b/src/test/compile-fail/alt-join.rs
deleted file mode 100644 (file)
index 3caac6d..0000000
+++ /dev/null
@@ -1,21 +0,0 @@
-// 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.
-
-// a good test that we merge paths correctly in the presence of a
-// variable that's used before it's declared
-
-fn my_fail() -> ! { fail!(); }
-
-fn main() {
-    match true { false => { my_fail(); } true => { } }
-
-    debug!(x); //~ ERROR unresolved name `x`.
-    let x: int;
-}
diff --git a/src/test/compile-fail/alt-pattern-field-mismatch-2.rs b/src/test/compile-fail/alt-pattern-field-mismatch-2.rs
deleted file mode 100644 (file)
index 3e704ed..0000000
+++ /dev/null
@@ -1,26 +0,0 @@
-// 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.
-
-fn main() {
-    enum color {
-        rgb(uint, uint, uint),
-        cmyk(uint, uint, uint, uint),
-        no_color,
-    }
-
-    fn foo(c: color) {
-        match c {
-          rgb(_, _, _) => { }
-          cmyk(_, _, _, _) => { }
-          no_color(_) => { }
-          //~^ ERROR this pattern has 1 field, but the corresponding variant has no fields
-        }
-    }
-}
diff --git a/src/test/compile-fail/alt-pattern-field-mismatch.rs b/src/test/compile-fail/alt-pattern-field-mismatch.rs
deleted file mode 100644 (file)
index ce52d03..0000000
+++ /dev/null
@@ -1,26 +0,0 @@
-// 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.
-
-fn main() {
-    enum color {
-        rgb(uint, uint, uint),
-        cmyk(uint, uint, uint, uint),
-        no_color,
-    }
-
-    fn foo(c: color) {
-        match c {
-          rgb(_, _) => { }
-          //~^ ERROR this pattern has 2 fields, but the corresponding variant has 3 fields
-          cmyk(_, _, _, _) => { }
-          no_color => { }
-        }
-    }
-}
diff --git a/src/test/compile-fail/alt-range-fail-dominate.rs b/src/test/compile-fail/alt-range-fail-dominate.rs
deleted file mode 100644 (file)
index 3f48451..0000000
+++ /dev/null
@@ -1,47 +0,0 @@
-// 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.
-
-//error-pattern: unreachable
-//error-pattern: unreachable
-//error-pattern: unreachable
-//error-pattern: unreachable
-//error-pattern: unreachable
-
-fn main() {
-    match 5u {
-      1u .. 10u => { }
-      5u .. 6u => { }
-      _ => {}
-    };
-
-    match 5u {
-      3u .. 6u => { }
-      4u .. 6u => { }
-      _ => {}
-    };
-
-    match 5u {
-      4u .. 6u => { }
-      4u .. 6u => { }
-      _ => {}
-    };
-
-    match 'c' {
-      'A' .. 'z' => {}
-      'a' .. 'z' => {}
-      _ => {}
-    };
-
-    match 1.0 {
-      0.01 .. 6.5 => {}
-      0.02 => {}
-      _ => {}
-    };
-}
diff --git a/src/test/compile-fail/alt-range-fail.rs b/src/test/compile-fail/alt-range-fail.rs
deleted file mode 100644 (file)
index dc7ebae..0000000
+++ /dev/null
@@ -1,29 +0,0 @@
-// 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.
-
-//error-pattern: lower range bound
-//error-pattern: non-numeric
-//error-pattern: mismatched types
-
-fn main() {
-    match 5u {
-      6u .. 1u => { }
-      _ => { }
-    };
-
-    match "wow" {
-      "bar" .. "foo" => { }
-    };
-
-    match 5u {
-      'c' .. 100u => { }
-      _ => { }
-    };
-}
diff --git a/src/test/compile-fail/alt-tag-nullary.rs b/src/test/compile-fail/alt-tag-nullary.rs
deleted file mode 100644 (file)
index 2b0c3db..0000000
+++ /dev/null
@@ -1,16 +0,0 @@
-// 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.
-
-// error-pattern: mismatched types
-
-enum a { A, }
-enum b { B, }
-
-fn main() { let x: a = A; match x { B => { } } }
diff --git a/src/test/compile-fail/alt-tag-unary.rs b/src/test/compile-fail/alt-tag-unary.rs
deleted file mode 100644 (file)
index a129ff1..0000000
+++ /dev/null
@@ -1,16 +0,0 @@
-// 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.
-
-// error-pattern: mismatched types
-
-enum a { A(int), }
-enum b { B(int), }
-
-fn main() { let x: a = A(0); match x { B(y) => { } } }
diff --git a/src/test/compile-fail/alt-vec-invalid.rs b/src/test/compile-fail/alt-vec-invalid.rs
deleted file mode 100644 (file)
index 2cf2d5b..0000000
+++ /dev/null
@@ -1,7 +0,0 @@
-fn main() {
-    let a = ~[];
-    match a {
-        [1, ..tail, ..tail] => {}, //~ ERROR: unexpected token: `..`
-        _ => ()
-    }
-}
diff --git a/src/test/compile-fail/alt-vec-mismatch-2.rs b/src/test/compile-fail/alt-vec-mismatch-2.rs
deleted file mode 100644 (file)
index 6ea0300..0000000
+++ /dev/null
@@ -1,5 +0,0 @@
-fn main() {
-    match () {
-        [()] => { } //~ ERROR mismatched types: expected `()` but found a vector pattern
-    }
-}
diff --git a/src/test/compile-fail/alt-vec-mismatch.rs b/src/test/compile-fail/alt-vec-mismatch.rs
deleted file mode 100644 (file)
index 85ed876..0000000
+++ /dev/null
@@ -1,6 +0,0 @@
-fn main() {
-    match ~"foo" {
-        ['f', 'o', .._] => { } //~ ERROR mismatched types: expected `~str` but found a vector pattern
-        _ => { }
-    }
-}
diff --git a/src/test/compile-fail/alt-vec-unreachable.rs b/src/test/compile-fail/alt-vec-unreachable.rs
deleted file mode 100644 (file)
index 2719d84..0000000
+++ /dev/null
@@ -1,20 +0,0 @@
-fn main() {
-    let x: ~[(int, int)] = ~[];
-    match x {
-        [a, (2, 3), _] => (),
-        [(1, 2), (2, 3), b] => (), //~ ERROR unreachable pattern
-        _ => ()
-    }
-
-    match [~"foo", ~"bar", ~"baz"] {
-        [a, _, _, .._] => { io::println(a); }
-        [~"foo", ~"bar", ~"baz", ~"foo", ~"bar"] => { } //~ ERROR unreachable pattern
-        _ => { }
-    }
-
-    match ['a', 'b', 'c'] {
-        ['a', 'b', 'c', .._tail] => {}
-        ['a', 'b', 'c'] => {} //~ ERROR unreachable pattern
-        _ => {}
-    }
-}
diff --git a/src/test/compile-fail/bad-alt.rs b/src/test/compile-fail/bad-alt.rs
deleted file mode 100644 (file)
index 041f84b..0000000
+++ /dev/null
@@ -1,6 +0,0 @@
-// error-pattern: expected
-
-fn main() {
-  let int x = 5;
-  match x;
-}
diff --git a/src/test/compile-fail/bad-match.rs b/src/test/compile-fail/bad-match.rs
new file mode 100644 (file)
index 0000000..041f84b
--- /dev/null
@@ -0,0 +1,6 @@
+// error-pattern: expected
+
+fn main() {
+  let int x = 5;
+  match x;
+}
diff --git a/src/test/compile-fail/match-arrows-block-then-binop.rs b/src/test/compile-fail/match-arrows-block-then-binop.rs
new file mode 100644 (file)
index 0000000..b6b2313
--- /dev/null
@@ -0,0 +1,17 @@
+// 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.
+
+fn main() {
+
+    match 0 {
+      0 => {
+      } + 5 //~ ERROR unexpected token: `+`
+    }
+}
diff --git a/src/test/compile-fail/match-join.rs b/src/test/compile-fail/match-join.rs
new file mode 100644 (file)
index 0000000..3caac6d
--- /dev/null
@@ -0,0 +1,21 @@
+// 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.
+
+// a good test that we merge paths correctly in the presence of a
+// variable that's used before it's declared
+
+fn my_fail() -> ! { fail!(); }
+
+fn main() {
+    match true { false => { my_fail(); } true => { } }
+
+    debug!(x); //~ ERROR unresolved name `x`.
+    let x: int;
+}
diff --git a/src/test/compile-fail/match-pattern-field-mismatch-2.rs b/src/test/compile-fail/match-pattern-field-mismatch-2.rs
new file mode 100644 (file)
index 0000000..3e704ed
--- /dev/null
@@ -0,0 +1,26 @@
+// 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.
+
+fn main() {
+    enum color {
+        rgb(uint, uint, uint),
+        cmyk(uint, uint, uint, uint),
+        no_color,
+    }
+
+    fn foo(c: color) {
+        match c {
+          rgb(_, _, _) => { }
+          cmyk(_, _, _, _) => { }
+          no_color(_) => { }
+          //~^ ERROR this pattern has 1 field, but the corresponding variant has no fields
+        }
+    }
+}
diff --git a/src/test/compile-fail/match-pattern-field-mismatch.rs b/src/test/compile-fail/match-pattern-field-mismatch.rs
new file mode 100644 (file)
index 0000000..ce52d03
--- /dev/null
@@ -0,0 +1,26 @@
+// 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.
+
+fn main() {
+    enum color {
+        rgb(uint, uint, uint),
+        cmyk(uint, uint, uint, uint),
+        no_color,
+    }
+
+    fn foo(c: color) {
+        match c {
+          rgb(_, _) => { }
+          //~^ ERROR this pattern has 2 fields, but the corresponding variant has 3 fields
+          cmyk(_, _, _, _) => { }
+          no_color => { }
+        }
+    }
+}
diff --git a/src/test/compile-fail/match-range-fail-dominate.rs b/src/test/compile-fail/match-range-fail-dominate.rs
new file mode 100644 (file)
index 0000000..3f48451
--- /dev/null
@@ -0,0 +1,47 @@
+// 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.
+
+//error-pattern: unreachable
+//error-pattern: unreachable
+//error-pattern: unreachable
+//error-pattern: unreachable
+//error-pattern: unreachable
+
+fn main() {
+    match 5u {
+      1u .. 10u => { }
+      5u .. 6u => { }
+      _ => {}
+    };
+
+    match 5u {
+      3u .. 6u => { }
+      4u .. 6u => { }
+      _ => {}
+    };
+
+    match 5u {
+      4u .. 6u => { }
+      4u .. 6u => { }
+      _ => {}
+    };
+
+    match 'c' {
+      'A' .. 'z' => {}
+      'a' .. 'z' => {}
+      _ => {}
+    };
+
+    match 1.0 {
+      0.01 .. 6.5 => {}
+      0.02 => {}
+      _ => {}
+    };
+}
diff --git a/src/test/compile-fail/match-range-fail.rs b/src/test/compile-fail/match-range-fail.rs
new file mode 100644 (file)
index 0000000..dc7ebae
--- /dev/null
@@ -0,0 +1,29 @@
+// 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.
+
+//error-pattern: lower range bound
+//error-pattern: non-numeric
+//error-pattern: mismatched types
+
+fn main() {
+    match 5u {
+      6u .. 1u => { }
+      _ => { }
+    };
+
+    match "wow" {
+      "bar" .. "foo" => { }
+    };
+
+    match 5u {
+      'c' .. 100u => { }
+      _ => { }
+    };
+}
diff --git a/src/test/compile-fail/match-tag-nullary.rs b/src/test/compile-fail/match-tag-nullary.rs
new file mode 100644 (file)
index 0000000..2b0c3db
--- /dev/null
@@ -0,0 +1,16 @@
+// 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.
+
+// error-pattern: mismatched types
+
+enum a { A, }
+enum b { B, }
+
+fn main() { let x: a = A; match x { B => { } } }
diff --git a/src/test/compile-fail/match-tag-unary.rs b/src/test/compile-fail/match-tag-unary.rs
new file mode 100644 (file)
index 0000000..a129ff1
--- /dev/null
@@ -0,0 +1,16 @@
+// 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.
+
+// error-pattern: mismatched types
+
+enum a { A(int), }
+enum b { B(int), }
+
+fn main() { let x: a = A(0); match x { B(y) => { } } }
diff --git a/src/test/compile-fail/match-vec-invalid.rs b/src/test/compile-fail/match-vec-invalid.rs
new file mode 100644 (file)
index 0000000..2cf2d5b
--- /dev/null
@@ -0,0 +1,7 @@
+fn main() {
+    let a = ~[];
+    match a {
+        [1, ..tail, ..tail] => {}, //~ ERROR: unexpected token: `..`
+        _ => ()
+    }
+}
diff --git a/src/test/compile-fail/match-vec-mismatch-2.rs b/src/test/compile-fail/match-vec-mismatch-2.rs
new file mode 100644 (file)
index 0000000..6ea0300
--- /dev/null
@@ -0,0 +1,5 @@
+fn main() {
+    match () {
+        [()] => { } //~ ERROR mismatched types: expected `()` but found a vector pattern
+    }
+}
diff --git a/src/test/compile-fail/match-vec-mismatch.rs b/src/test/compile-fail/match-vec-mismatch.rs
new file mode 100644 (file)
index 0000000..85ed876
--- /dev/null
@@ -0,0 +1,6 @@
+fn main() {
+    match ~"foo" {
+        ['f', 'o', .._] => { } //~ ERROR mismatched types: expected `~str` but found a vector pattern
+        _ => { }
+    }
+}
diff --git a/src/test/compile-fail/match-vec-unreachable.rs b/src/test/compile-fail/match-vec-unreachable.rs
new file mode 100644 (file)
index 0000000..2719d84
--- /dev/null
@@ -0,0 +1,20 @@
+fn main() {
+    let x: ~[(int, int)] = ~[];
+    match x {
+        [a, (2, 3), _] => (),
+        [(1, 2), (2, 3), b] => (), //~ ERROR unreachable pattern
+        _ => ()
+    }
+
+    match [~"foo", ~"bar", ~"baz"] {
+        [a, _, _, .._] => { io::println(a); }
+        [~"foo", ~"bar", ~"baz", ~"foo", ~"bar"] => { } //~ ERROR unreachable pattern
+        _ => { }
+    }
+
+    match ['a', 'b', 'c'] {
+        ['a', 'b', 'c', .._tail] => {}
+        ['a', 'b', 'c'] => {} //~ ERROR unreachable pattern
+        _ => {}
+    }
+}
diff --git a/src/test/pretty/alt-naked-expr-long.rs b/src/test/pretty/alt-naked-expr-long.rs
deleted file mode 100644 (file)
index 66ad3d5..0000000
+++ /dev/null
@@ -1,25 +0,0 @@
-// 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.
-
-// pp-exact
-
-// actually this doesn't quite look how I want it to, but I can't
-// get the prettyprinter to indent the long expr
-
-fn main() {
-    let x = Some(3);
-    let y =
-        match x {
-            Some(_) =>
-            ~"some" + ~"very" + ~"very" + ~"very" + ~"very" + ~"very" +
-                ~"very" + ~"very" + ~"very" + ~"long" + ~"string",
-            None => ~"none"
-        };
-}
diff --git a/src/test/pretty/alt-naked-expr-medium.rs b/src/test/pretty/alt-naked-expr-medium.rs
deleted file mode 100644 (file)
index 4ae129c..0000000
+++ /dev/null
@@ -1,20 +0,0 @@
-// 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.
-
-// pp-exact
-
-fn main() {
-    let x = Some(3);
-    let _y =
-        match x {
-            Some(_) => ~[~"some(_)", ~"not", ~"SO", ~"long", ~"string"],
-            None => ~[~"none"]
-        };
-}
diff --git a/src/test/pretty/alt-naked-expr.rs b/src/test/pretty/alt-naked-expr.rs
deleted file mode 100644 (file)
index 15c49cd..0000000
+++ /dev/null
@@ -1,16 +0,0 @@
-// 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.
-
-// pp-exact
-
-fn main() {
-    let x = Some(3);
-    let y = match x { Some(_) => ~"some(_)", None => ~"none" };
-}
diff --git a/src/test/pretty/match-naked-expr-long.rs b/src/test/pretty/match-naked-expr-long.rs
new file mode 100644 (file)
index 0000000..66ad3d5
--- /dev/null
@@ -0,0 +1,25 @@
+// 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.
+
+// pp-exact
+
+// actually this doesn't quite look how I want it to, but I can't
+// get the prettyprinter to indent the long expr
+
+fn main() {
+    let x = Some(3);
+    let y =
+        match x {
+            Some(_) =>
+            ~"some" + ~"very" + ~"very" + ~"very" + ~"very" + ~"very" +
+                ~"very" + ~"very" + ~"very" + ~"long" + ~"string",
+            None => ~"none"
+        };
+}
diff --git a/src/test/pretty/match-naked-expr-medium.rs b/src/test/pretty/match-naked-expr-medium.rs
new file mode 100644 (file)
index 0000000..4ae129c
--- /dev/null
@@ -0,0 +1,20 @@
+// 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.
+
+// pp-exact
+
+fn main() {
+    let x = Some(3);
+    let _y =
+        match x {
+            Some(_) => ~[~"some(_)", ~"not", ~"SO", ~"long", ~"string"],
+            None => ~[~"none"]
+        };
+}
diff --git a/src/test/pretty/match-naked-expr.rs b/src/test/pretty/match-naked-expr.rs
new file mode 100644 (file)
index 0000000..15c49cd
--- /dev/null
@@ -0,0 +1,16 @@
+// 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.
+
+// pp-exact
+
+fn main() {
+    let x = Some(3);
+    let y = match x { Some(_) => ~"some(_)", None => ~"none" };
+}
diff --git a/src/test/run-fail/alt-bot-fail.rs b/src/test/run-fail/alt-bot-fail.rs
deleted file mode 100644 (file)
index 2ba78e2..0000000
+++ /dev/null
@@ -1,19 +0,0 @@
-// 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.
-
-// error-pattern:explicit failure
-
-fn foo(s: ~str) { }
-
-fn main() {
-    let i =
-        match Some::<int>(3) { None::<int> => { fail!() } Some::<int>(_) => { fail!() } };
-    foo(i);
-}
diff --git a/src/test/run-fail/alt-disc-bot.rs b/src/test/run-fail/alt-disc-bot.rs
deleted file mode 100644 (file)
index 13ccd11..0000000
+++ /dev/null
@@ -1,14 +0,0 @@
-// 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.
-
-// error-pattern:quux
-fn f() -> ! { fail!("quux") }
-fn g() -> int { match f() { true => { 1 } false => { 0 } } }
-fn main() { g(); }
diff --git a/src/test/run-fail/alt-wildcards.rs b/src/test/run-fail/alt-wildcards.rs
deleted file mode 100644 (file)
index 306357b..0000000
+++ /dev/null
@@ -1,20 +0,0 @@
-// 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.
-
-// error-pattern:squirrelcupcake
-fn cmp() -> int {
-    match (option::Some('a'), option::None::<char>) {
-        (option::Some(_), _) => { fail!("squirrelcupcake"); }
-        (_, option::Some(_)) => { fail!(); }
-        _                    => { fail!("wat"); }
-    }
-}
-
-fn main() { error!(cmp()); }
diff --git a/src/test/run-fail/expr-alt-fail-fn.rs b/src/test/run-fail/expr-alt-fail-fn.rs
deleted file mode 100644 (file)
index 6476e57..0000000
+++ /dev/null
@@ -1,19 +0,0 @@
-// 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.
-
-
-
-
-// error-pattern:explicit failure
-fn f() -> ! { fail!() }
-
-fn g() -> int { let x = match true { true => { f() } false => { 10 } }; return x; }
-
-fn main() { g(); }
diff --git a/src/test/run-fail/expr-alt-fail.rs b/src/test/run-fail/expr-alt-fail.rs
deleted file mode 100644 (file)
index e2bf605..0000000
+++ /dev/null
@@ -1,15 +0,0 @@
-// 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.
-
-
-
-
-// error-pattern:explicit failure
-fn main() { let x = match true { false => { 0 } true => { fail!() } }; }
diff --git a/src/test/run-fail/expr-match-fail-fn.rs b/src/test/run-fail/expr-match-fail-fn.rs
new file mode 100644 (file)
index 0000000..6476e57
--- /dev/null
@@ -0,0 +1,19 @@
+// 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.
+
+
+
+
+// error-pattern:explicit failure
+fn f() -> ! { fail!() }
+
+fn g() -> int { let x = match true { true => { f() } false => { 10 } }; return x; }
+
+fn main() { g(); }
diff --git a/src/test/run-fail/expr-match-fail.rs b/src/test/run-fail/expr-match-fail.rs
new file mode 100644 (file)
index 0000000..e2bf605
--- /dev/null
@@ -0,0 +1,15 @@
+// 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.
+
+
+
+
+// error-pattern:explicit failure
+fn main() { let x = match true { false => { 0 } true => { fail!() } }; }
diff --git a/src/test/run-fail/match-bot-fail.rs b/src/test/run-fail/match-bot-fail.rs
new file mode 100644 (file)
index 0000000..2ba78e2
--- /dev/null
@@ -0,0 +1,19 @@
+// 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.
+
+// error-pattern:explicit failure
+
+fn foo(s: ~str) { }
+
+fn main() {
+    let i =
+        match Some::<int>(3) { None::<int> => { fail!() } Some::<int>(_) => { fail!() } };
+    foo(i);
+}
diff --git a/src/test/run-fail/match-disc-bot.rs b/src/test/run-fail/match-disc-bot.rs
new file mode 100644 (file)
index 0000000..13ccd11
--- /dev/null
@@ -0,0 +1,14 @@
+// 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.
+
+// error-pattern:quux
+fn f() -> ! { fail!("quux") }
+fn g() -> int { match f() { true => { 1 } false => { 0 } } }
+fn main() { g(); }
diff --git a/src/test/run-fail/match-wildcards.rs b/src/test/run-fail/match-wildcards.rs
new file mode 100644 (file)
index 0000000..306357b
--- /dev/null
@@ -0,0 +1,20 @@
+// 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.
+
+// error-pattern:squirrelcupcake
+fn cmp() -> int {
+    match (option::Some('a'), option::None::<char>) {
+        (option::Some(_), _) => { fail!("squirrelcupcake"); }
+        (_, option::Some(_)) => { fail!(); }
+        _                    => { fail!("wat"); }
+    }
+}
+
+fn main() { error!(cmp()); }
diff --git a/src/test/run-fail/unwind-alt.rs b/src/test/run-fail/unwind-alt.rs
deleted file mode 100644 (file)
index a976101..0000000
+++ /dev/null
@@ -1,24 +0,0 @@
-// 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.
-
-// Issue #945
-// error-pattern:non-exhaustive match failure
-fn test_box() {
-    @0;
-}
-fn test_str() {
-  let res = match false { true => { ~"happy" },
-     _ => fail!("non-exhaustive match failure") };
-  assert_eq!(res, ~"happy");
-}
-fn main() {
-    test_box();
-    test_str();
-}
diff --git a/src/test/run-fail/unwind-match.rs b/src/test/run-fail/unwind-match.rs
new file mode 100644 (file)
index 0000000..a976101
--- /dev/null
@@ -0,0 +1,24 @@
+// 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.
+
+// Issue #945
+// error-pattern:non-exhaustive match failure
+fn test_box() {
+    @0;
+}
+fn test_str() {
+  let res = match false { true => { ~"happy" },
+     _ => fail!("non-exhaustive match failure") };
+  assert_eq!(res, ~"happy");
+}
+fn main() {
+    test_box();
+    test_str();
+}
diff --git a/src/test/run-pass/alt-borrowed_str.rs b/src/test/run-pass/alt-borrowed_str.rs
deleted file mode 100644 (file)
index 1a58174..0000000
+++ /dev/null
@@ -1,53 +0,0 @@
-// xfail-test
-// xfail-fast
-// -*- rust -*-
-fn f1(ref_string: &str) {
-    match ref_string {
-        "a" => io::println("found a"),
-        "b" => io::println("found b"),
-        _ => io::println("not found")
-    }
-}
-
-fn f2(ref_string: &str) {
-    match ref_string {
-        "a" => io::println("found a"),
-        "b" => io::println("found b"),
-        s => io::println(fmt!("not found (%s)", s))
-    }
-}
-
-fn g1(ref_1: &str, ref_2: &str) {
-    match (ref_1, ref_2) {
-        ("a", "b") => io::println("found a,b"),
-        ("b", "c") => io::println("found b,c"),
-        _ => io::println("not found")
-    }
-}
-
-fn g2(ref_1: &str, ref_2: &str) {
-    match (ref_1, ref_2) {
-        ("a", "b") => io::println("found a,b"),
-        ("b", "c") => io::println("found b,c"),
-        (s1, s2) => io::println(fmt!("not found (%s, %s)", s1, s2))
-    }
-}
-
-pub fn main() {
-    f1(@"a");
-    f1(~"b");
-    f1(&"c");
-    f1("d");
-    f2(@"a");
-    f2(~"b");
-    f2(&"c");
-    f2("d");
-    g1(@"a", @"b");
-    g1(~"b", ~"c");
-    g1(&"c", &"d");
-    g1("d", "e");
-    g2(@"a", @"b");
-    g2(~"b", ~"c");
-    g2(&"c", &"d");
-    g2("d", "e");
-}
diff --git a/src/test/run-pass/alt-bot-2.rs b/src/test/run-pass/alt-bot-2.rs
deleted file mode 100644 (file)
index ba897bd..0000000
+++ /dev/null
@@ -1,13 +0,0 @@
-// 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.
-
-// n.b. This was only ever failing with optimization disabled.
-fn a() -> int { match return 1 { 2 => 3, _ => fail!() } }
-pub fn main() { a(); }
diff --git a/src/test/run-pass/alt-bot.rs b/src/test/run-pass/alt-bot.rs
deleted file mode 100644 (file)
index 78892a1..0000000
+++ /dev/null
@@ -1,16 +0,0 @@
-// 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.
-
-
-pub fn main() {
-    let i: int =
-        match Some::<int>(3) { None::<int> => { fail!() } Some::<int>(_) => { 5 } };
-    debug!("%?", i);
-}
diff --git a/src/test/run-pass/alt-implicit-copy-unique.rs b/src/test/run-pass/alt-implicit-copy-unique.rs
deleted file mode 100644 (file)
index 0497f11..0000000
+++ /dev/null
@@ -1,20 +0,0 @@
-// 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.
-
-struct Pair { a: ~int, b: ~int }
-
-pub fn main() {
-    let mut x = ~Pair {a: ~10, b: ~20};
-    match x {
-      ~Pair {a: ref mut a, b: ref mut b} => {
-        assert!(**a == 10); *a = ~30; assert!(**a == 30);
-      }
-    }
-}
diff --git a/src/test/run-pass/alt-join.rs b/src/test/run-pass/alt-join.rs
deleted file mode 100644 (file)
index 66b6476..0000000
+++ /dev/null
@@ -1,31 +0,0 @@
-// 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.
-
-
-extern mod extra;
-
-fn foo<T>(y: Option<T>) {
-    let mut x: int;
-    let mut rs: ~[int] = ~[];
-    /* tests that x doesn't get put in the precondition for the
-       entire if expression */
-
-    if true {
-    } else {
-        match y {
-          None::<T> => x = 17,
-          _ => x = 42
-        }
-        rs += ~[x];
-    }
-    return;
-}
-
-pub fn main() { debug!("hello"); foo::<int>(Some::<int>(5)); }
diff --git a/src/test/run-pass/alt-naked-record-expr.rs b/src/test/run-pass/alt-naked-record-expr.rs
deleted file mode 100644 (file)
index 649bdd2..0000000
+++ /dev/null
@@ -1,19 +0,0 @@
-// 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.
-
-struct X { x: int }
-
-pub fn main() {
-    let x = match 0 {
-      _ => X {
-        x: 0
-      }.x
-    };
-}
diff --git a/src/test/run-pass/alt-naked-record.rs b/src/test/run-pass/alt-naked-record.rs
deleted file mode 100644 (file)
index 4d89fdc..0000000
+++ /dev/null
@@ -1,19 +0,0 @@
-// 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.
-
-struct X { x: int }
-
-pub fn main() {
-    let x = match 0 {
-      _ => X {
-        x: 0
-      }
-    };
-}
diff --git a/src/test/run-pass/alt-path.rs b/src/test/run-pass/alt-path.rs
deleted file mode 100644 (file)
index 3da6bb9..0000000
+++ /dev/null
@@ -1,19 +0,0 @@
-// 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.
-
-
-
-mod m1 {
-    pub enum foo { foo1, foo2, }
-}
-
-fn bar(x: m1::foo) { match x { m1::foo1 => { } m1::foo2 => { } } }
-
-pub fn main() { }
diff --git a/src/test/run-pass/alt-pattern-drop.rs b/src/test/run-pass/alt-pattern-drop.rs
deleted file mode 100644 (file)
index 71bbb17..0000000
+++ /dev/null
@@ -1,43 +0,0 @@
-// 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.
-
-
-
-// -*- rust -*-
-enum t { make_t(@int), clam, }
-
-fn foo(s: @int) {
-    let count = ::std::sys::refcount(s);
-    let x: t = make_t(s); // ref up
-
-    match x {
-      make_t(y) => {
-        debug!("%?", y); // ref up then down
-
-      }
-      _ => { debug!("?"); fail!(); }
-    }
-    debug!(::std::sys::refcount(s));
-    assert_eq!(::std::sys::refcount(s), count + 1u);
-    let _ = ::std::sys::refcount(s); // don't get bitten by last-use.
-}
-
-pub fn main() {
-    let s: @int = @0; // ref up
-
-    let count = ::std::sys::refcount(s);
-
-    foo(s); // ref up then down
-
-    debug!("%u", ::std::sys::refcount(s));
-    let count2 = ::std::sys::refcount(s);
-    let _ = ::std::sys::refcount(s); // don't get bitten by last-use.
-    assert_eq!(count, count2);
-}
diff --git a/src/test/run-pass/alt-pattern-lit.rs b/src/test/run-pass/alt-pattern-lit.rs
deleted file mode 100644 (file)
index 3e01253..0000000
+++ /dev/null
@@ -1,21 +0,0 @@
-// 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.
-
-
-
-fn altlit(f: int) -> int {
-    match f {
-      10 => { debug!("case 10"); return 20; }
-      11 => { debug!("case 11"); return 22; }
-      _  => fail!("the impossible happened")
-    }
-}
-
-pub fn main() { assert!((altlit(10) == 20)); assert!((altlit(11) == 22)); }
diff --git a/src/test/run-pass/alt-pattern-no-type-params.rs b/src/test/run-pass/alt-pattern-no-type-params.rs
deleted file mode 100644 (file)
index feabf7a..0000000
+++ /dev/null
@@ -1,17 +0,0 @@
-// 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 maybe<T> { nothing, just(T), }
-
-fn foo(x: maybe<int>) {
-    match x { nothing => { error!("A"); } just(a) => { error!("B"); } }
-}
-
-pub fn main() { }
diff --git a/src/test/run-pass/alt-pattern-simple.rs b/src/test/run-pass/alt-pattern-simple.rs
deleted file mode 100644 (file)
index f405600..0000000
+++ /dev/null
@@ -1,15 +0,0 @@
-// 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.
-
-
-
-fn altsimple(f: int) { match f { x => () } }
-
-pub fn main() { }
diff --git a/src/test/run-pass/alt-phi.rs b/src/test/run-pass/alt-phi.rs
deleted file mode 100644 (file)
index 40d2158..0000000
+++ /dev/null
@@ -1,24 +0,0 @@
-// 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 thing { a, b, c, }
-
-fn foo(it: &fn(int)) { it(10); }
-
-pub fn main() {
-    let mut x = true;
-    match a {
-      a => { x = true; foo(|_i| { } ) }
-      b => { x = false; }
-      c => { x = false; }
-    }
-}
diff --git a/src/test/run-pass/alt-range.rs b/src/test/run-pass/alt-range.rs
deleted file mode 100644 (file)
index 6b02b21..0000000
+++ /dev/null
@@ -1,41 +0,0 @@
-// 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.
-
-pub fn main() {
-    match 5u {
-      1u..5u => {}
-      _ => fail!("should match range"),
-    }
-    match 5u {
-      6u..7u => fail!("shouldn't match range"),
-      _ => {}
-    }
-    match 5u {
-      1u => fail!("should match non-first range"),
-      2u..6u => {}
-      _ => fail!("math is broken")
-    }
-    match 'c' {
-      'a'..'z' => {}
-      _ => fail!("should suppport char ranges")
-    }
-    match -3 {
-      -7..5 => {}
-      _ => fail!("should match signed range")
-    }
-    match 3.0 {
-      1.0..5.0 => {}
-      _ => fail!("should match float range")
-    }
-    match -1.5 {
-      -3.6..3.6 => {}
-      _ => fail!("should match negative float range")
-    }
-}
diff --git a/src/test/run-pass/alt-ref-binding-in-guard-3256.rs b/src/test/run-pass/alt-ref-binding-in-guard-3256.rs
deleted file mode 100644 (file)
index ed7a631..0000000
+++ /dev/null
@@ -1,19 +0,0 @@
-// 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.
-
-pub fn main() {
-    let x = Some(unstable::sync::exclusive(true));
-    match x {
-        Some(ref z) if z.with(|b| *b) => {
-            do z.with |b| { assert!(*b); }
-        },
-        _ => fail!()
-    }
-}
diff --git a/src/test/run-pass/alt-ref-binding-mut-option.rs b/src/test/run-pass/alt-ref-binding-mut-option.rs
deleted file mode 100644 (file)
index 8d1e483..0000000
+++ /dev/null
@@ -1,18 +0,0 @@
-// 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.
-
-pub fn main() {
-    let mut v = Some(22);
-    match v {
-      None => {}
-      Some(ref mut p) => { *p += 1; }
-    }
-    assert_eq!(v, Some(23));
-}
diff --git a/src/test/run-pass/alt-ref-binding-mut.rs b/src/test/run-pass/alt-ref-binding-mut.rs
deleted file mode 100644 (file)
index 266f7cd..0000000
+++ /dev/null
@@ -1,25 +0,0 @@
-// 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.
-
-struct Rec {
-    f: int
-}
-
-fn destructure(x: &mut Rec) {
-    match *x {
-      Rec {f: ref mut f} => *f += 1
-    }
-}
-
-pub fn main() {
-    let mut v = Rec {f: 22};
-    destructure(&mut v);
-    assert_eq!(v.f, 23);
-}
diff --git a/src/test/run-pass/alt-ref-binding.rs b/src/test/run-pass/alt-ref-binding.rs
deleted file mode 100644 (file)
index 0b613df..0000000
+++ /dev/null
@@ -1,20 +0,0 @@
-// 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.
-
-fn destructure(x: Option<int>) -> int {
-    match x {
-      None => 0,
-      Some(ref v) => *v
-    }
-}
-
-pub fn main() {
-    assert_eq!(destructure(Some(22)), 22);
-}
diff --git a/src/test/run-pass/alt-str.rs b/src/test/run-pass/alt-str.rs
deleted file mode 100644 (file)
index 8bbcc50..0000000
+++ /dev/null
@@ -1,31 +0,0 @@
-// 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.
-
-// Issue #53
-
-pub fn main() {
-    match ~"test" { ~"not-test" => fail!(), ~"test" => (), _ => fail!() }
-
-    enum t { tag1(~str), tag2, }
-
-
-    match tag1(~"test") {
-      tag2 => fail!(),
-      tag1(~"not-test") => fail!(),
-      tag1(~"test") => (),
-      _ => fail!()
-    }
-
-    let x = match ~"a" { ~"a" => 1, ~"b" => 2, _ => fail!() };
-    assert_eq!(x, 1);
-
-    match ~"a" { ~"a" => { } ~"b" => { }, _ => fail!() }
-
-}
diff --git a/src/test/run-pass/alt-tag.rs b/src/test/run-pass/alt-tag.rs
deleted file mode 100644 (file)
index 9eeb12d..0000000
+++ /dev/null
@@ -1,38 +0,0 @@
-// 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.
-
-
-
-
-// -*- rust -*-
-enum color {
-    rgb(int, int, int),
-    rgba(int, int, int, int),
-    hsl(int, int, int),
-}
-
-fn process(c: color) -> int {
-    let mut x: int;
-    match c {
-      rgb(r, _, _) => { x = r; }
-      rgba(_, _, _, a) => { x = a; }
-      hsl(_, s, _) => { x = s; }
-    }
-    return x;
-}
-
-pub fn main() {
-    let gray: color = rgb(127, 127, 127);
-    let clear: color = rgba(50, 150, 250, 0);
-    let red: color = hsl(0, 255, 255);
-    assert_eq!(process(gray), 127);
-    assert_eq!(process(clear), 0);
-    assert_eq!(process(red), 255);
-}
diff --git a/src/test/run-pass/alt-unique-bind.rs b/src/test/run-pass/alt-unique-bind.rs
deleted file mode 100644 (file)
index 997cc1e..0000000
+++ /dev/null
@@ -1,18 +0,0 @@
-// 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.
-
-pub fn main() {
-    match ~100 {
-      ~x => {
-        debug!("%?", x);
-        assert_eq!(x, 100);
-      }
-    }
-}
diff --git a/src/test/run-pass/alt-value-binding-in-guard-3291.rs b/src/test/run-pass/alt-value-binding-in-guard-3291.rs
deleted file mode 100644 (file)
index 33785b2..0000000
+++ /dev/null
@@ -1,24 +0,0 @@
-// 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.
-
-fn foo(x: Option<~int>, b: bool) -> int {
-    match x {
-      None => { 1 }
-      Some(ref x) if b => { *x.clone() }
-      Some(_) => { 0 }
-    }
-}
-
-pub fn main() {
-    foo(Some(~22), true);
-    foo(Some(~22), false);
-    foo(None, true);
-    foo(None, false);
-}
diff --git a/src/test/run-pass/alt-with-ret-arm.rs b/src/test/run-pass/alt-with-ret-arm.rs
deleted file mode 100644 (file)
index f46521f..0000000
+++ /dev/null
@@ -1,21 +0,0 @@
-// 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.
-
-pub fn main() {
-    // sometimes we have had trouble finding
-    // the right type for f, as we unified
-    // bot and u32 here
-    let f = match uint::from_str(~"1234") {
-        None => return (),
-        Some(num) => num as u32
-    };
-    assert_eq!(f, 1234u32);
-    error!(f)
-}
diff --git a/src/test/run-pass/expr-alt-box.rs b/src/test/run-pass/expr-alt-box.rs
deleted file mode 100644 (file)
index 84a7863..0000000
+++ /dev/null
@@ -1,28 +0,0 @@
-// 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.
-
-
-
-
-// -*- rust -*-
-
-// Tests for match as expressions resulting in boxed types
-fn test_box() {
-    let res = match true { true => { @100 } _ => fail!("wat") };
-    assert_eq!(*res, 100);
-}
-
-fn test_str() {
-    let res = match true { true => { ~"happy" },
-                         _ => fail!("not happy at all") };
-    assert_eq!(res, ~"happy");
-}
-
-pub fn main() { test_box(); test_str(); }
diff --git a/src/test/run-pass/expr-alt-fail-all.rs b/src/test/run-pass/expr-alt-fail-all.rs
deleted file mode 100644 (file)
index 5234f58..0000000
+++ /dev/null
@@ -1,22 +0,0 @@
-// 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.
-
-
-
-
-// When all branches of an match expression result in fail, the entire
-// match expression results in fail.
-pub fn main() {
-    let x =
-        match true {
-          true => { 10 }
-          false => { match true { true => { fail!() } false => { fail!() } } }
-        };
-}
diff --git a/src/test/run-pass/expr-alt-fail.rs b/src/test/run-pass/expr-alt-fail.rs
deleted file mode 100644 (file)
index 3e1b967..0000000
+++ /dev/null
@@ -1,21 +0,0 @@
-// 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.
-
-fn test_simple() {
-    let r = match true { true => { true } false => { fail!() } };
-    assert_eq!(r, true);
-}
-
-fn test_box() {
-    let r = match true { true => { ~[10] } false => { fail!() } };
-    assert_eq!(r[0], 10);
-}
-
-pub fn main() { test_simple(); test_box(); }
diff --git a/src/test/run-pass/expr-alt-generic-box1.rs b/src/test/run-pass/expr-alt-generic-box1.rs
deleted file mode 100644 (file)
index 4ea2d0f..0000000
+++ /dev/null
@@ -1,27 +0,0 @@
-// 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.
-
-
-
-
-// -*- rust -*-
-type compare<T> = @fn(@T, @T) -> bool;
-
-fn test_generic<T>(expected: @T, eq: compare<T>) {
-    let actual: @T = match true { true => { expected }, _ => fail!() };
-    assert!((eq(expected, actual)));
-}
-
-fn test_box() {
-    fn compare_box(b1: @bool, b2: @bool) -> bool { return *b1 == *b2; }
-    test_generic::<bool>(@true, compare_box);
-}
-
-pub fn main() { test_box(); }
diff --git a/src/test/run-pass/expr-alt-generic-box2.rs b/src/test/run-pass/expr-alt-generic-box2.rs
deleted file mode 100644 (file)
index c5c89b4..0000000
+++ /dev/null
@@ -1,26 +0,0 @@
-// 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.
-
-// xfail-fast
-// -*- rust -*-
-
-type compare<T> = @fn(T, T) -> bool;
-
-fn test_generic<T:Copy>(expected: T, eq: compare<T>) {
-    let actual: T = match true { true => { expected }, _ => fail!("wat") };
-    assert!((eq(expected, actual)));
-}
-
-fn test_vec() {
-    fn compare_box(v1: @int, v2: @int) -> bool { return v1 == v2; }
-    test_generic::<@int>(@1, compare_box);
-}
-
-pub fn main() { test_vec(); }
diff --git a/src/test/run-pass/expr-alt-generic-unique1.rs b/src/test/run-pass/expr-alt-generic-unique1.rs
deleted file mode 100644 (file)
index 085d52d..0000000
+++ /dev/null
@@ -1,29 +0,0 @@
-// 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.
-
-
-
-// -*- rust -*-
-type compare<T> = @fn(~T, ~T) -> bool;
-
-fn test_generic<T:Copy+Clone>(expected: ~T, eq: compare<T>) {
-    let actual: ~T = match true {
-        true => { expected.clone() },
-        _ => fail!("wat")
-    };
-    assert!((eq(expected, actual)));
-}
-
-fn test_box() {
-    fn compare_box(b1: ~bool, b2: ~bool) -> bool { return *b1 == *b2; }
-    test_generic::<bool>(~true, compare_box);
-}
-
-pub fn main() { test_box(); }
diff --git a/src/test/run-pass/expr-alt-generic-unique2.rs b/src/test/run-pass/expr-alt-generic-unique2.rs
deleted file mode 100644 (file)
index 7ef1fb8..0000000
+++ /dev/null
@@ -1,29 +0,0 @@
-// 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.
-
-// xfail-fast
-// -*- rust -*-
-
-type compare<T> = @fn(T, T) -> bool;
-
-fn test_generic<T:Copy+Clone>(expected: T, eq: compare<T>) {
-    let actual: T = match true {
-        true => expected.clone(),
-        _ => fail!("wat")
-    };
-    assert!((eq(expected, actual)));
-}
-
-fn test_vec() {
-    fn compare_box(v1: ~int, v2: ~int) -> bool { return v1 == v2; }
-    test_generic::<~int>(~1, compare_box);
-}
-
-pub fn main() { test_vec(); }
diff --git a/src/test/run-pass/expr-alt-generic.rs b/src/test/run-pass/expr-alt-generic.rs
deleted file mode 100644 (file)
index 04a229f..0000000
+++ /dev/null
@@ -1,35 +0,0 @@
-// 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.
-
-// xfail-fast
-// -*- rust -*-
-
-type compare<T> = @fn(T, T) -> bool;
-
-fn test_generic<T:Copy>(expected: T, eq: compare<T>) {
-  let actual: T = match true { true => { expected }, _ => fail!("wat") };
-    assert!((eq(expected, actual)));
-}
-
-fn test_bool() {
-    fn compare_bool(b1: bool, b2: bool) -> bool { return b1 == b2; }
-    test_generic::<bool>(true, compare_bool);
-}
-
-struct Pair { a: int, b: int }
-
-fn test_rec() {
-    fn compare_rec(t1: Pair, t2: Pair) -> bool {
-        t1.a == t2.a && t1.b == t2.b
-    }
-    test_generic::<Pair>(Pair {a: 1, b: 2}, compare_rec);
-}
-
-pub fn main() { test_bool(); test_rec(); }
diff --git a/src/test/run-pass/expr-alt-struct.rs b/src/test/run-pass/expr-alt-struct.rs
deleted file mode 100644 (file)
index 57483d9..0000000
+++ /dev/null
@@ -1,38 +0,0 @@
-// 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.
-
-
-
-
-// -*- rust -*-
-
-// Tests for match as expressions resulting in struct types
-struct R { i: int }
-
-fn test_rec() {
-    let rs = match true { true => R {i: 100}, _ => fail!() };
-    assert_eq!(rs.i, 100);
-}
-
-enum mood { happy, sad, }
-
-impl cmp::Eq for mood {
-    fn eq(&self, other: &mood) -> bool {
-        ((*self) as uint) == ((*other) as uint)
-    }
-    fn ne(&self, other: &mood) -> bool { !(*self).eq(other) }
-}
-
-fn test_tag() {
-    let rs = match true { true => { happy } false => { sad } };
-    assert_eq!(rs, happy);
-}
-
-pub fn main() { test_rec(); test_tag(); }
diff --git a/src/test/run-pass/expr-alt-unique.rs b/src/test/run-pass/expr-alt-unique.rs
deleted file mode 100644 (file)
index cdd4e45..0000000
+++ /dev/null
@@ -1,22 +0,0 @@
-// 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.
-
-
-
-
-// -*- rust -*-
-
-// Tests for match as expressions resulting in boxed types
-fn test_box() {
-    let res = match true { true => { ~100 }, _ => fail!() };
-    assert_eq!(*res, 100);
-}
-
-pub fn main() { test_box(); }
diff --git a/src/test/run-pass/expr-alt.rs b/src/test/run-pass/expr-alt.rs
deleted file mode 100644 (file)
index a6324b9..0000000
+++ /dev/null
@@ -1,54 +0,0 @@
-// 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.
-
-
-
-
-// -*- rust -*-
-
-// Tests for using match as an expression
-fn test_basic() {
-    let mut rs: bool = match true { true => { true } false => { false } };
-    assert!((rs));
-    rs = match false { true => { false } false => { true } };
-    assert!((rs));
-}
-
-fn test_inferrence() {
-    let mut rs = match true { true => { true } false => { false } };
-    assert!((rs));
-}
-
-fn test_alt_as_alt_head() {
-    // Yeah, this is kind of confusing ...
-
-    let rs =
-        match match false { true => { true } false => { false } } {
-          true => { false }
-          false => { true }
-        };
-    assert!((rs));
-}
-
-fn test_alt_as_block_result() {
-    let rs =
-        match false {
-          true => { false }
-          false => { match true { true => { true } false => { false } } }
-        };
-    assert!((rs));
-}
-
-pub fn main() {
-    test_basic();
-    test_inferrence();
-    test_alt_as_alt_head();
-    test_alt_as_block_result();
-}
diff --git a/src/test/run-pass/expr-match-box.rs b/src/test/run-pass/expr-match-box.rs
new file mode 100644 (file)
index 0000000..84a7863
--- /dev/null
@@ -0,0 +1,28 @@
+// 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.
+
+
+
+
+// -*- rust -*-
+
+// Tests for match as expressions resulting in boxed types
+fn test_box() {
+    let res = match true { true => { @100 } _ => fail!("wat") };
+    assert_eq!(*res, 100);
+}
+
+fn test_str() {
+    let res = match true { true => { ~"happy" },
+                         _ => fail!("not happy at all") };
+    assert_eq!(res, ~"happy");
+}
+
+pub fn main() { test_box(); test_str(); }
diff --git a/src/test/run-pass/expr-match-fail-all.rs b/src/test/run-pass/expr-match-fail-all.rs
new file mode 100644 (file)
index 0000000..5234f58
--- /dev/null
@@ -0,0 +1,22 @@
+// 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.
+
+
+
+
+// When all branches of an match expression result in fail, the entire
+// match expression results in fail.
+pub fn main() {
+    let x =
+        match true {
+          true => { 10 }
+          false => { match true { true => { fail!() } false => { fail!() } } }
+        };
+}
diff --git a/src/test/run-pass/expr-match-fail.rs b/src/test/run-pass/expr-match-fail.rs
new file mode 100644 (file)
index 0000000..3e1b967
--- /dev/null
@@ -0,0 +1,21 @@
+// 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.
+
+fn test_simple() {
+    let r = match true { true => { true } false => { fail!() } };
+    assert_eq!(r, true);
+}
+
+fn test_box() {
+    let r = match true { true => { ~[10] } false => { fail!() } };
+    assert_eq!(r[0], 10);
+}
+
+pub fn main() { test_simple(); test_box(); }
diff --git a/src/test/run-pass/expr-match-generic-box1.rs b/src/test/run-pass/expr-match-generic-box1.rs
new file mode 100644 (file)
index 0000000..4ea2d0f
--- /dev/null
@@ -0,0 +1,27 @@
+// 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.
+
+
+
+
+// -*- rust -*-
+type compare<T> = @fn(@T, @T) -> bool;
+
+fn test_generic<T>(expected: @T, eq: compare<T>) {
+    let actual: @T = match true { true => { expected }, _ => fail!() };
+    assert!((eq(expected, actual)));
+}
+
+fn test_box() {
+    fn compare_box(b1: @bool, b2: @bool) -> bool { return *b1 == *b2; }
+    test_generic::<bool>(@true, compare_box);
+}
+
+pub fn main() { test_box(); }
diff --git a/src/test/run-pass/expr-match-generic-box2.rs b/src/test/run-pass/expr-match-generic-box2.rs
new file mode 100644 (file)
index 0000000..c5c89b4
--- /dev/null
@@ -0,0 +1,26 @@
+// 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.
+
+// xfail-fast
+// -*- rust -*-
+
+type compare<T> = @fn(T, T) -> bool;
+
+fn test_generic<T:Copy>(expected: T, eq: compare<T>) {
+    let actual: T = match true { true => { expected }, _ => fail!("wat") };
+    assert!((eq(expected, actual)));
+}
+
+fn test_vec() {
+    fn compare_box(v1: @int, v2: @int) -> bool { return v1 == v2; }
+    test_generic::<@int>(@1, compare_box);
+}
+
+pub fn main() { test_vec(); }
diff --git a/src/test/run-pass/expr-match-generic-unique1.rs b/src/test/run-pass/expr-match-generic-unique1.rs
new file mode 100644 (file)
index 0000000..085d52d
--- /dev/null
@@ -0,0 +1,29 @@
+// 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.
+
+
+
+// -*- rust -*-
+type compare<T> = @fn(~T, ~T) -> bool;
+
+fn test_generic<T:Copy+Clone>(expected: ~T, eq: compare<T>) {
+    let actual: ~T = match true {
+        true => { expected.clone() },
+        _ => fail!("wat")
+    };
+    assert!((eq(expected, actual)));
+}
+
+fn test_box() {
+    fn compare_box(b1: ~bool, b2: ~bool) -> bool { return *b1 == *b2; }
+    test_generic::<bool>(~true, compare_box);
+}
+
+pub fn main() { test_box(); }
diff --git a/src/test/run-pass/expr-match-generic-unique2.rs b/src/test/run-pass/expr-match-generic-unique2.rs
new file mode 100644 (file)
index 0000000..7ef1fb8
--- /dev/null
@@ -0,0 +1,29 @@
+// 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.
+
+// xfail-fast
+// -*- rust -*-
+
+type compare<T> = @fn(T, T) -> bool;
+
+fn test_generic<T:Copy+Clone>(expected: T, eq: compare<T>) {
+    let actual: T = match true {
+        true => expected.clone(),
+        _ => fail!("wat")
+    };
+    assert!((eq(expected, actual)));
+}
+
+fn test_vec() {
+    fn compare_box(v1: ~int, v2: ~int) -> bool { return v1 == v2; }
+    test_generic::<~int>(~1, compare_box);
+}
+
+pub fn main() { test_vec(); }
diff --git a/src/test/run-pass/expr-match-generic.rs b/src/test/run-pass/expr-match-generic.rs
new file mode 100644 (file)
index 0000000..04a229f
--- /dev/null
@@ -0,0 +1,35 @@
+// 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.
+
+// xfail-fast
+// -*- rust -*-
+
+type compare<T> = @fn(T, T) -> bool;
+
+fn test_generic<T:Copy>(expected: T, eq: compare<T>) {
+  let actual: T = match true { true => { expected }, _ => fail!("wat") };
+    assert!((eq(expected, actual)));
+}
+
+fn test_bool() {
+    fn compare_bool(b1: bool, b2: bool) -> bool { return b1 == b2; }
+    test_generic::<bool>(true, compare_bool);
+}
+
+struct Pair { a: int, b: int }
+
+fn test_rec() {
+    fn compare_rec(t1: Pair, t2: Pair) -> bool {
+        t1.a == t2.a && t1.b == t2.b
+    }
+    test_generic::<Pair>(Pair {a: 1, b: 2}, compare_rec);
+}
+
+pub fn main() { test_bool(); test_rec(); }
diff --git a/src/test/run-pass/expr-match-struct.rs b/src/test/run-pass/expr-match-struct.rs
new file mode 100644 (file)
index 0000000..57483d9
--- /dev/null
@@ -0,0 +1,38 @@
+// 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.
+
+
+
+
+// -*- rust -*-
+
+// Tests for match as expressions resulting in struct types
+struct R { i: int }
+
+fn test_rec() {
+    let rs = match true { true => R {i: 100}, _ => fail!() };
+    assert_eq!(rs.i, 100);
+}
+
+enum mood { happy, sad, }
+
+impl cmp::Eq for mood {
+    fn eq(&self, other: &mood) -> bool {
+        ((*self) as uint) == ((*other) as uint)
+    }
+    fn ne(&self, other: &mood) -> bool { !(*self).eq(other) }
+}
+
+fn test_tag() {
+    let rs = match true { true => { happy } false => { sad } };
+    assert_eq!(rs, happy);
+}
+
+pub fn main() { test_rec(); test_tag(); }
diff --git a/src/test/run-pass/expr-match-unique.rs b/src/test/run-pass/expr-match-unique.rs
new file mode 100644 (file)
index 0000000..cdd4e45
--- /dev/null
@@ -0,0 +1,22 @@
+// 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.
+
+
+
+
+// -*- rust -*-
+
+// Tests for match as expressions resulting in boxed types
+fn test_box() {
+    let res = match true { true => { ~100 }, _ => fail!() };
+    assert_eq!(*res, 100);
+}
+
+pub fn main() { test_box(); }
diff --git a/src/test/run-pass/expr-match.rs b/src/test/run-pass/expr-match.rs
new file mode 100644 (file)
index 0000000..a6324b9
--- /dev/null
@@ -0,0 +1,54 @@
+// 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.
+
+
+
+
+// -*- rust -*-
+
+// Tests for using match as an expression
+fn test_basic() {
+    let mut rs: bool = match true { true => { true } false => { false } };
+    assert!((rs));
+    rs = match false { true => { false } false => { true } };
+    assert!((rs));
+}
+
+fn test_inferrence() {
+    let mut rs = match true { true => { true } false => { false } };
+    assert!((rs));
+}
+
+fn test_alt_as_alt_head() {
+    // Yeah, this is kind of confusing ...
+
+    let rs =
+        match match false { true => { true } false => { false } } {
+          true => { false }
+          false => { true }
+        };
+    assert!((rs));
+}
+
+fn test_alt_as_block_result() {
+    let rs =
+        match false {
+          true => { false }
+          false => { match true { true => { true } false => { false } } }
+        };
+    assert!((rs));
+}
+
+pub fn main() {
+    test_basic();
+    test_inferrence();
+    test_alt_as_alt_head();
+    test_alt_as_block_result();
+}
diff --git a/src/test/run-pass/fat-arrow-alt.rs b/src/test/run-pass/fat-arrow-alt.rs
deleted file mode 100644 (file)
index f6b4996..0000000
+++ /dev/null
@@ -1,25 +0,0 @@
-// -*- rust -*-
-// 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 color {
-    red,
-    green,
-    blue
-}
-
-pub fn main() {
-    error!(match red {
-        red => { 1 }
-        green => { 2 }
-        blue => { 3 }
-    });
-}
diff --git a/src/test/run-pass/fat-arrow-match.rs b/src/test/run-pass/fat-arrow-match.rs
new file mode 100644 (file)
index 0000000..f6b4996
--- /dev/null
@@ -0,0 +1,25 @@
+// -*- rust -*-
+// 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 color {
+    red,
+    green,
+    blue
+}
+
+pub fn main() {
+    error!(match red {
+        red => { 1 }
+        green => { 2 }
+        blue => { 3 }
+    });
+}
diff --git a/src/test/run-pass/generic-tag-alt.rs b/src/test/run-pass/generic-tag-alt.rs
deleted file mode 100644 (file)
index 752dded..0000000
+++ /dev/null
@@ -1,21 +0,0 @@
-// 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 foo<T> { arm(T), }
-
-fn altfoo<T>(f: foo<T>) {
-    let mut hit = false;
-    match f { arm::<T>(x) => { debug!("in arm"); hit = true; } }
-    assert!((hit));
-}
-
-pub fn main() { altfoo::<int>(arm::<int>(10)); }
diff --git a/src/test/run-pass/generic-tag-match.rs b/src/test/run-pass/generic-tag-match.rs
new file mode 100644 (file)
index 0000000..752dded
--- /dev/null
@@ -0,0 +1,21 @@
+// 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 foo<T> { arm(T), }
+
+fn altfoo<T>(f: foo<T>) {
+    let mut hit = false;
+    match f { arm::<T>(x) => { debug!("in arm"); hit = true; } }
+    assert!((hit));
+}
+
+pub fn main() { altfoo::<int>(arm::<int>(10)); }
diff --git a/src/test/run-pass/match-borrowed_str.rs b/src/test/run-pass/match-borrowed_str.rs
new file mode 100644 (file)
index 0000000..1a58174
--- /dev/null
@@ -0,0 +1,53 @@
+// xfail-test
+// xfail-fast
+// -*- rust -*-
+fn f1(ref_string: &str) {
+    match ref_string {
+        "a" => io::println("found a"),
+        "b" => io::println("found b"),
+        _ => io::println("not found")
+    }
+}
+
+fn f2(ref_string: &str) {
+    match ref_string {
+        "a" => io::println("found a"),
+        "b" => io::println("found b"),
+        s => io::println(fmt!("not found (%s)", s))
+    }
+}
+
+fn g1(ref_1: &str, ref_2: &str) {
+    match (ref_1, ref_2) {
+        ("a", "b") => io::println("found a,b"),
+        ("b", "c") => io::println("found b,c"),
+        _ => io::println("not found")
+    }
+}
+
+fn g2(ref_1: &str, ref_2: &str) {
+    match (ref_1, ref_2) {
+        ("a", "b") => io::println("found a,b"),
+        ("b", "c") => io::println("found b,c"),
+        (s1, s2) => io::println(fmt!("not found (%s, %s)", s1, s2))
+    }
+}
+
+pub fn main() {
+    f1(@"a");
+    f1(~"b");
+    f1(&"c");
+    f1("d");
+    f2(@"a");
+    f2(~"b");
+    f2(&"c");
+    f2("d");
+    g1(@"a", @"b");
+    g1(~"b", ~"c");
+    g1(&"c", &"d");
+    g1("d", "e");
+    g2(@"a", @"b");
+    g2(~"b", ~"c");
+    g2(&"c", &"d");
+    g2("d", "e");
+}
diff --git a/src/test/run-pass/match-bot-2.rs b/src/test/run-pass/match-bot-2.rs
new file mode 100644 (file)
index 0000000..ba897bd
--- /dev/null
@@ -0,0 +1,13 @@
+// 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.
+
+// n.b. This was only ever failing with optimization disabled.
+fn a() -> int { match return 1 { 2 => 3, _ => fail!() } }
+pub fn main() { a(); }
diff --git a/src/test/run-pass/match-bot.rs b/src/test/run-pass/match-bot.rs
new file mode 100644 (file)
index 0000000..78892a1
--- /dev/null
@@ -0,0 +1,16 @@
+// 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.
+
+
+pub fn main() {
+    let i: int =
+        match Some::<int>(3) { None::<int> => { fail!() } Some::<int>(_) => { 5 } };
+    debug!("%?", i);
+}
diff --git a/src/test/run-pass/match-implicit-copy-unique.rs b/src/test/run-pass/match-implicit-copy-unique.rs
new file mode 100644 (file)
index 0000000..0497f11
--- /dev/null
@@ -0,0 +1,20 @@
+// 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.
+
+struct Pair { a: ~int, b: ~int }
+
+pub fn main() {
+    let mut x = ~Pair {a: ~10, b: ~20};
+    match x {
+      ~Pair {a: ref mut a, b: ref mut b} => {
+        assert!(**a == 10); *a = ~30; assert!(**a == 30);
+      }
+    }
+}
diff --git a/src/test/run-pass/match-join.rs b/src/test/run-pass/match-join.rs
new file mode 100644 (file)
index 0000000..66b6476
--- /dev/null
@@ -0,0 +1,31 @@
+// 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.
+
+
+extern mod extra;
+
+fn foo<T>(y: Option<T>) {
+    let mut x: int;
+    let mut rs: ~[int] = ~[];
+    /* tests that x doesn't get put in the precondition for the
+       entire if expression */
+
+    if true {
+    } else {
+        match y {
+          None::<T> => x = 17,
+          _ => x = 42
+        }
+        rs += ~[x];
+    }
+    return;
+}
+
+pub fn main() { debug!("hello"); foo::<int>(Some::<int>(5)); }
diff --git a/src/test/run-pass/match-naked-record-expr.rs b/src/test/run-pass/match-naked-record-expr.rs
new file mode 100644 (file)
index 0000000..649bdd2
--- /dev/null
@@ -0,0 +1,19 @@
+// 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.
+
+struct X { x: int }
+
+pub fn main() {
+    let x = match 0 {
+      _ => X {
+        x: 0
+      }.x
+    };
+}
diff --git a/src/test/run-pass/match-naked-record.rs b/src/test/run-pass/match-naked-record.rs
new file mode 100644 (file)
index 0000000..4d89fdc
--- /dev/null
@@ -0,0 +1,19 @@
+// 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.
+
+struct X { x: int }
+
+pub fn main() {
+    let x = match 0 {
+      _ => X {
+        x: 0
+      }
+    };
+}
diff --git a/src/test/run-pass/match-path.rs b/src/test/run-pass/match-path.rs
new file mode 100644 (file)
index 0000000..3da6bb9
--- /dev/null
@@ -0,0 +1,19 @@
+// 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.
+
+
+
+mod m1 {
+    pub enum foo { foo1, foo2, }
+}
+
+fn bar(x: m1::foo) { match x { m1::foo1 => { } m1::foo2 => { } } }
+
+pub fn main() { }
diff --git a/src/test/run-pass/match-pattern-drop.rs b/src/test/run-pass/match-pattern-drop.rs
new file mode 100644 (file)
index 0000000..71bbb17
--- /dev/null
@@ -0,0 +1,43 @@
+// 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.
+
+
+
+// -*- rust -*-
+enum t { make_t(@int), clam, }
+
+fn foo(s: @int) {
+    let count = ::std::sys::refcount(s);
+    let x: t = make_t(s); // ref up
+
+    match x {
+      make_t(y) => {
+        debug!("%?", y); // ref up then down
+
+      }
+      _ => { debug!("?"); fail!(); }
+    }
+    debug!(::std::sys::refcount(s));
+    assert_eq!(::std::sys::refcount(s), count + 1u);
+    let _ = ::std::sys::refcount(s); // don't get bitten by last-use.
+}
+
+pub fn main() {
+    let s: @int = @0; // ref up
+
+    let count = ::std::sys::refcount(s);
+
+    foo(s); // ref up then down
+
+    debug!("%u", ::std::sys::refcount(s));
+    let count2 = ::std::sys::refcount(s);
+    let _ = ::std::sys::refcount(s); // don't get bitten by last-use.
+    assert_eq!(count, count2);
+}
diff --git a/src/test/run-pass/match-pattern-lit.rs b/src/test/run-pass/match-pattern-lit.rs
new file mode 100644 (file)
index 0000000..3e01253
--- /dev/null
@@ -0,0 +1,21 @@
+// 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.
+
+
+
+fn altlit(f: int) -> int {
+    match f {
+      10 => { debug!("case 10"); return 20; }
+      11 => { debug!("case 11"); return 22; }
+      _  => fail!("the impossible happened")
+    }
+}
+
+pub fn main() { assert!((altlit(10) == 20)); assert!((altlit(11) == 22)); }
diff --git a/src/test/run-pass/match-pattern-no-type-params.rs b/src/test/run-pass/match-pattern-no-type-params.rs
new file mode 100644 (file)
index 0000000..feabf7a
--- /dev/null
@@ -0,0 +1,17 @@
+// 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 maybe<T> { nothing, just(T), }
+
+fn foo(x: maybe<int>) {
+    match x { nothing => { error!("A"); } just(a) => { error!("B"); } }
+}
+
+pub fn main() { }
diff --git a/src/test/run-pass/match-pattern-simple.rs b/src/test/run-pass/match-pattern-simple.rs
new file mode 100644 (file)
index 0000000..f405600
--- /dev/null
@@ -0,0 +1,15 @@
+// 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.
+
+
+
+fn altsimple(f: int) { match f { x => () } }
+
+pub fn main() { }
diff --git a/src/test/run-pass/match-phi.rs b/src/test/run-pass/match-phi.rs
new file mode 100644 (file)
index 0000000..40d2158
--- /dev/null
@@ -0,0 +1,24 @@
+// 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 thing { a, b, c, }
+
+fn foo(it: &fn(int)) { it(10); }
+
+pub fn main() {
+    let mut x = true;
+    match a {
+      a => { x = true; foo(|_i| { } ) }
+      b => { x = false; }
+      c => { x = false; }
+    }
+}
diff --git a/src/test/run-pass/match-range.rs b/src/test/run-pass/match-range.rs
new file mode 100644 (file)
index 0000000..6b02b21
--- /dev/null
@@ -0,0 +1,41 @@
+// 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.
+
+pub fn main() {
+    match 5u {
+      1u..5u => {}
+      _ => fail!("should match range"),
+    }
+    match 5u {
+      6u..7u => fail!("shouldn't match range"),
+      _ => {}
+    }
+    match 5u {
+      1u => fail!("should match non-first range"),
+      2u..6u => {}
+      _ => fail!("math is broken")
+    }
+    match 'c' {
+      'a'..'z' => {}
+      _ => fail!("should suppport char ranges")
+    }
+    match -3 {
+      -7..5 => {}
+      _ => fail!("should match signed range")
+    }
+    match 3.0 {
+      1.0..5.0 => {}
+      _ => fail!("should match float range")
+    }
+    match -1.5 {
+      -3.6..3.6 => {}
+      _ => fail!("should match negative float range")
+    }
+}
diff --git a/src/test/run-pass/match-ref-binding-in-guard-3256.rs b/src/test/run-pass/match-ref-binding-in-guard-3256.rs
new file mode 100644 (file)
index 0000000..ed7a631
--- /dev/null
@@ -0,0 +1,19 @@
+// 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.
+
+pub fn main() {
+    let x = Some(unstable::sync::exclusive(true));
+    match x {
+        Some(ref z) if z.with(|b| *b) => {
+            do z.with |b| { assert!(*b); }
+        },
+        _ => fail!()
+    }
+}
diff --git a/src/test/run-pass/match-ref-binding-mut-option.rs b/src/test/run-pass/match-ref-binding-mut-option.rs
new file mode 100644 (file)
index 0000000..8d1e483
--- /dev/null
@@ -0,0 +1,18 @@
+// 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.
+
+pub fn main() {
+    let mut v = Some(22);
+    match v {
+      None => {}
+      Some(ref mut p) => { *p += 1; }
+    }
+    assert_eq!(v, Some(23));
+}
diff --git a/src/test/run-pass/match-ref-binding-mut.rs b/src/test/run-pass/match-ref-binding-mut.rs
new file mode 100644 (file)
index 0000000..266f7cd
--- /dev/null
@@ -0,0 +1,25 @@
+// 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.
+
+struct Rec {
+    f: int
+}
+
+fn destructure(x: &mut Rec) {
+    match *x {
+      Rec {f: ref mut f} => *f += 1
+    }
+}
+
+pub fn main() {
+    let mut v = Rec {f: 22};
+    destructure(&mut v);
+    assert_eq!(v.f, 23);
+}
diff --git a/src/test/run-pass/match-ref-binding.rs b/src/test/run-pass/match-ref-binding.rs
new file mode 100644 (file)
index 0000000..0b613df
--- /dev/null
@@ -0,0 +1,20 @@
+// 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.
+
+fn destructure(x: Option<int>) -> int {
+    match x {
+      None => 0,
+      Some(ref v) => *v
+    }
+}
+
+pub fn main() {
+    assert_eq!(destructure(Some(22)), 22);
+}
diff --git a/src/test/run-pass/match-str.rs b/src/test/run-pass/match-str.rs
new file mode 100644 (file)
index 0000000..8bbcc50
--- /dev/null
@@ -0,0 +1,31 @@
+// 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.
+
+// Issue #53
+
+pub fn main() {
+    match ~"test" { ~"not-test" => fail!(), ~"test" => (), _ => fail!() }
+
+    enum t { tag1(~str), tag2, }
+
+
+    match tag1(~"test") {
+      tag2 => fail!(),
+      tag1(~"not-test") => fail!(),
+      tag1(~"test") => (),
+      _ => fail!()
+    }
+
+    let x = match ~"a" { ~"a" => 1, ~"b" => 2, _ => fail!() };
+    assert_eq!(x, 1);
+
+    match ~"a" { ~"a" => { } ~"b" => { }, _ => fail!() }
+
+}
diff --git a/src/test/run-pass/match-tag.rs b/src/test/run-pass/match-tag.rs
new file mode 100644 (file)
index 0000000..9eeb12d
--- /dev/null
@@ -0,0 +1,38 @@
+// 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.
+
+
+
+
+// -*- rust -*-
+enum color {
+    rgb(int, int, int),
+    rgba(int, int, int, int),
+    hsl(int, int, int),
+}
+
+fn process(c: color) -> int {
+    let mut x: int;
+    match c {
+      rgb(r, _, _) => { x = r; }
+      rgba(_, _, _, a) => { x = a; }
+      hsl(_, s, _) => { x = s; }
+    }
+    return x;
+}
+
+pub fn main() {
+    let gray: color = rgb(127, 127, 127);
+    let clear: color = rgba(50, 150, 250, 0);
+    let red: color = hsl(0, 255, 255);
+    assert_eq!(process(gray), 127);
+    assert_eq!(process(clear), 0);
+    assert_eq!(process(red), 255);
+}
diff --git a/src/test/run-pass/match-unique-bind.rs b/src/test/run-pass/match-unique-bind.rs
new file mode 100644 (file)
index 0000000..997cc1e
--- /dev/null
@@ -0,0 +1,18 @@
+// 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.
+
+pub fn main() {
+    match ~100 {
+      ~x => {
+        debug!("%?", x);
+        assert_eq!(x, 100);
+      }
+    }
+}
diff --git a/src/test/run-pass/match-value-binding-in-guard-3291.rs b/src/test/run-pass/match-value-binding-in-guard-3291.rs
new file mode 100644 (file)
index 0000000..33785b2
--- /dev/null
@@ -0,0 +1,24 @@
+// 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.
+
+fn foo(x: Option<~int>, b: bool) -> int {
+    match x {
+      None => { 1 }
+      Some(ref x) if b => { *x.clone() }
+      Some(_) => { 0 }
+    }
+}
+
+pub fn main() {
+    foo(Some(~22), true);
+    foo(Some(~22), false);
+    foo(None, true);
+    foo(None, false);
+}
diff --git a/src/test/run-pass/match-with-ret-arm.rs b/src/test/run-pass/match-with-ret-arm.rs
new file mode 100644 (file)
index 0000000..f46521f
--- /dev/null
@@ -0,0 +1,21 @@
+// 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.
+
+pub fn main() {
+    // sometimes we have had trouble finding
+    // the right type for f, as we unified
+    // bot and u32 here
+    let f = match uint::from_str(~"1234") {
+        None => return (),
+        Some(num) => num as u32
+    };
+    assert_eq!(f, 1234u32);
+    error!(f)
+}
diff --git a/src/test/run-pass/nested-alts.rs b/src/test/run-pass/nested-alts.rs
deleted file mode 100644 (file)
index dfbd583..0000000
+++ /dev/null
@@ -1,25 +0,0 @@
-// 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.
-
-
-fn baz() -> ! { fail!(); }
-
-fn foo() {
-    match Some::<int>(5) {
-      Some::<int>(x) => {
-        let mut bar;
-        match None::<int> { None::<int> => { bar = 5; } _ => { baz(); } }
-        debug!(bar);
-      }
-      None::<int> => { debug!("hello"); }
-    }
-}
-
-pub fn main() { foo(); }
diff --git a/src/test/run-pass/nested-exhaustive-alt.rs b/src/test/run-pass/nested-exhaustive-alt.rs
deleted file mode 100644 (file)
index e5ecd82..0000000
+++ /dev/null
@@ -1,20 +0,0 @@
-// 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.
-
-struct Foo { foo: bool, bar: Option<int>, baz: int }
-
-pub fn main() {
-    match @Foo{foo: true, bar: Some(10), baz: 20} {
-      @Foo{foo: true, bar: Some(_), _} => {}
-      @Foo{foo: false, bar: None, _} => {}
-      @Foo{foo: true, bar: None, _} => {}
-      @Foo{foo: false, bar: Some(_), _} => {}
-    }
-}
diff --git a/src/test/run-pass/nested-exhaustive-match.rs b/src/test/run-pass/nested-exhaustive-match.rs
new file mode 100644 (file)
index 0000000..e5ecd82
--- /dev/null
@@ -0,0 +1,20 @@
+// 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.
+
+struct Foo { foo: bool, bar: Option<int>, baz: int }
+
+pub fn main() {
+    match @Foo{foo: true, bar: Some(10), baz: 20} {
+      @Foo{foo: true, bar: Some(_), _} => {}
+      @Foo{foo: false, bar: None, _} => {}
+      @Foo{foo: true, bar: None, _} => {}
+      @Foo{foo: false, bar: Some(_), _} => {}
+    }
+}
diff --git a/src/test/run-pass/nested-matchs.rs b/src/test/run-pass/nested-matchs.rs
new file mode 100644 (file)
index 0000000..dfbd583
--- /dev/null
@@ -0,0 +1,25 @@
+// 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.
+
+
+fn baz() -> ! { fail!(); }
+
+fn foo() {
+    match Some::<int>(5) {
+      Some::<int>(x) => {
+        let mut bar;
+        match None::<int> { None::<int> => { bar = 5; } _ => { baz(); } }
+        debug!(bar);
+      }
+      None::<int> => { debug!("hello"); }
+    }
+}
+
+pub fn main() { foo(); }
diff --git a/src/test/run-pass/simple-alt-generic-tag.rs b/src/test/run-pass/simple-alt-generic-tag.rs
deleted file mode 100644 (file)
index 6f7f2af..0000000
+++ /dev/null
@@ -1,18 +0,0 @@
-// 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 opt<T> { none, }
-
-pub fn main() {
-    let x = none::<int>;
-    match x { none::<int> => { debug!("hello world"); } }
-}
diff --git a/src/test/run-pass/simple-generic-alt.rs b/src/test/run-pass/simple-generic-alt.rs
deleted file mode 100644 (file)
index 3f3b1c8..0000000
+++ /dev/null
@@ -1,15 +0,0 @@
-// 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 clam<T> { a(T), }
-
-pub fn main() { let c = a(2); match c { a::<int>(_) => { } } }
diff --git a/src/test/run-pass/simple-generic-match.rs b/src/test/run-pass/simple-generic-match.rs
new file mode 100644 (file)
index 0000000..3f3b1c8
--- /dev/null
@@ -0,0 +1,15 @@
+// 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 clam<T> { a(T), }
+
+pub fn main() { let c = a(2); match c { a::<int>(_) => { } } }
diff --git a/src/test/run-pass/simple-match-generic-tag.rs b/src/test/run-pass/simple-match-generic-tag.rs
new file mode 100644 (file)
index 0000000..6f7f2af
--- /dev/null
@@ -0,0 +1,18 @@
+// 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 opt<T> { none, }
+
+pub fn main() {
+    let x = none::<int>;
+    match x { none::<int> => { debug!("hello world"); } }
+}
diff --git a/src/test/run-pass/unique-alt-discrim.rs b/src/test/run-pass/unique-alt-discrim.rs
deleted file mode 100644 (file)
index 1f0b13d..0000000
+++ /dev/null
@@ -1,18 +0,0 @@
-// 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.
-
-// Issue #961
-
-fn altsimple() {
-    match ~true {
-      _ => { }
-    }
-}
-pub fn main() { }
diff --git a/src/test/run-pass/unique-match-discrim.rs b/src/test/run-pass/unique-match-discrim.rs
new file mode 100644 (file)
index 0000000..1f0b13d
--- /dev/null
@@ -0,0 +1,18 @@
+// 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.
+
+// Issue #961
+
+fn altsimple() {
+    match ~true {
+      _ => { }
+    }
+}
+pub fn main() { }
diff --git a/src/test/run-pass/use-uninit-alt.rs b/src/test/run-pass/use-uninit-alt.rs
deleted file mode 100644 (file)
index f4943ed..0000000
+++ /dev/null
@@ -1,21 +0,0 @@
-// 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.
-
-
-
-fn foo<T>(o: myoption<T>) -> int {
-    let mut x: int = 5;
-    match o { none::<T> => { } some::<T>(t) => { x += 1; } }
-    return x;
-}
-
-enum myoption<T> { none, some(T), }
-
-pub fn main() { debug!(5); }
diff --git a/src/test/run-pass/use-uninit-alt2.rs b/src/test/run-pass/use-uninit-alt2.rs
deleted file mode 100644 (file)
index 802c861..0000000
+++ /dev/null
@@ -1,21 +0,0 @@
-// 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.
-
-
-
-fn foo<T>(o: myoption<T>) -> int {
-    let mut x: int;
-    match o { none::<T> => { fail!(); } some::<T>(t) => { x = 5; } }
-    return x;
-}
-
-enum myoption<T> { none, some(T), }
-
-pub fn main() { debug!(5); }
diff --git a/src/test/run-pass/use-uninit-match.rs b/src/test/run-pass/use-uninit-match.rs
new file mode 100644 (file)
index 0000000..f4943ed
--- /dev/null
@@ -0,0 +1,21 @@
+// 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.
+
+
+
+fn foo<T>(o: myoption<T>) -> int {
+    let mut x: int = 5;
+    match o { none::<T> => { } some::<T>(t) => { x += 1; } }
+    return x;
+}
+
+enum myoption<T> { none, some(T), }
+
+pub fn main() { debug!(5); }
diff --git a/src/test/run-pass/use-uninit-match2.rs b/src/test/run-pass/use-uninit-match2.rs
new file mode 100644 (file)
index 0000000..802c861
--- /dev/null
@@ -0,0 +1,21 @@
+// 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.
+
+
+
+fn foo<T>(o: myoption<T>) -> int {
+    let mut x: int;
+    match o { none::<T> => { fail!(); } some::<T>(t) => { x = 5; } }
+    return x;
+}
+
+enum myoption<T> { none, some(T), }
+
+pub fn main() { debug!(5); }