about summary refs log tree commit diff
path: root/src/test
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2013-04-30 17:39:36 -0700
committerbors <bors@rust-lang.org>2013-04-30 17:39:36 -0700
commit7a857673ff76c966ceb061e3794b119e2e498c40 (patch)
treefc892d62bbdcf12076f7c30e8a3c5e50e9979741 /src/test
parent9329bd669d704fffeed90c1f6703518345e6c2fd (diff)
parent4493cf49cdaeb7aea974b9155a678fb8c9e3e390 (diff)
auto merge of #6103 : catamorphism/rust/nonfatal-errors, r=catamorphism
r? @nikomatsakis typeck::check::_match wasn't suppressing derived errors properly.
Fixed it. (This will fix #5100)
Diffstat (limited to 'src/test')
-rw-r--r--src/test/compile-fail/alt-vec-mismatch-2.rs2
-rw-r--r--src/test/compile-fail/alt-vec-mismatch.rs2
-rw-r--r--src/test/compile-fail/issue-5100.rs44
3 files changed, 46 insertions, 2 deletions
diff --git a/src/test/compile-fail/alt-vec-mismatch-2.rs b/src/test/compile-fail/alt-vec-mismatch-2.rs
index 9e8fb84951d..6ea0300cf1e 100644
--- a/src/test/compile-fail/alt-vec-mismatch-2.rs
+++ b/src/test/compile-fail/alt-vec-mismatch-2.rs
@@ -1,5 +1,5 @@
 fn main() {
     match () {
-        [()] => { } //~ ERROR mismatched type: expected `()` but found vector
+        [()] => { } //~ 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
index ef4d92ea491..85ed8761ee9 100644
--- a/src/test/compile-fail/alt-vec-mismatch.rs
+++ b/src/test/compile-fail/alt-vec-mismatch.rs
@@ -1,6 +1,6 @@
 fn main() {
     match ~"foo" {
-        ['f', 'o', .._] => { } //~ ERROR mismatched type: expected `~str` but found vector
+        ['f', 'o', .._] => { } //~ ERROR mismatched types: expected `~str` but found a vector pattern
         _ => { }
     }
 }
diff --git a/src/test/compile-fail/issue-5100.rs b/src/test/compile-fail/issue-5100.rs
new file mode 100644
index 00000000000..dbfdb38f721
--- /dev/null
+++ b/src/test/compile-fail/issue-5100.rs
@@ -0,0 +1,44 @@
+// Copyright 2013 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 A { B, C }
+
+fn main() {
+    match (true, false) {
+        B => (), //~ ERROR expected `(bool,bool)` but found an enum or structure pattern
+        _ => ()
+    }
+
+    match (true, false) {
+        (true, false, false) => () //~ ERROR mismatched types: expected `(bool,bool)` but found `(bool,bool,bool)` (expected a tuple with 2 elements but found one with 3 elements)
+    }
+
+    match (true, false) {
+        @(true, false) => () //~ ERROR mismatched types: expected `(bool,bool)` but found an @-box pattern
+    }
+
+    match (true, false) {
+        ~(true, false) => () //~ ERROR mismatched types: expected `(bool,bool)` but found a ~-box pattern
+    }
+
+    match (true, false) {
+        &(true, false) => () //~ ERROR mismatched types: expected `(bool,bool)` but found an &-pointer pattern
+    }
+
+
+    let v = [('a', 'b')   //~ ERROR expected function but found `(char,char)`
+             ('c', 'd'),
+             ('e', 'f')];
+
+    for v.each |&(x,y)| {} // should be OK
+
+    // Make sure none of the errors above were fatal
+    let x: char = true; //~ ERROR expected `char` but found `bool`
+}