about summary refs log tree commit diff
path: root/src/test/compile-fail
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2016-05-26 22:46:08 -0700
committerbors <bors@rust-lang.org>2016-05-26 22:46:08 -0700
commit36d5dc7c9bcfd287b5c4e4ac3e2f0ab93bdaa0c9 (patch)
tree7e1af7784abe1ebab1c219d13e1a57439eb91996 /src/test/compile-fail
parent97e3a2401e4b2f659d69ed0c0822cae04e3495b7 (diff)
parent63dfbdbc1bc1ace106a525682f77b3d08af9ad71 (diff)
downloadrust-36d5dc7c9bcfd287b5c4e4ac3e2f0ab93bdaa0c9.tar.gz
rust-36d5dc7c9bcfd287b5c4e4ac3e2f0ab93bdaa0c9.zip
Auto merge of #33864 - Manishearth:breaking-batch, r=Manishearth
Batch up libsyntax breaking changes

cc https://github.com/rust-lang/rust/issues/31645
Diffstat (limited to 'src/test/compile-fail')
-rw-r--r--src/test/compile-fail/issue-32004.rs4
-rw-r--r--src/test/compile-fail/match-pattern-field-mismatch-2.rs2
-rw-r--r--src/test/compile-fail/pat-tuple-bad-type.rs27
-rw-r--r--src/test/compile-fail/pat-tuple-feature-gate.rs (renamed from src/test/compile-fail/E0024.rs)13
-rw-r--r--src/test/compile-fail/pat-tuple-overfield.rs28
-rw-r--r--src/test/compile-fail/pattern-error-continue.rs2
6 files changed, 63 insertions, 13 deletions
diff --git a/src/test/compile-fail/issue-32004.rs b/src/test/compile-fail/issue-32004.rs
index 0227a80fd75..8d74154655f 100644
--- a/src/test/compile-fail/issue-32004.rs
+++ b/src/test/compile-fail/issue-32004.rs
@@ -18,12 +18,12 @@ struct S;
 fn main() {
     match Foo::Baz {
         Foo::Bar => {}
-        //~^ ERROR this pattern has 0 fields, but the corresponding variant
+        //~^ ERROR `Foo::Bar` does not name a tuple variant or a tuple struct
         _ => {}
     }
 
     match S {
         S(()) => {}
-        //~^ ERROR this pattern has 1 field, but the corresponding struct
+        //~^ ERROR `S` does not name a tuple variant or a tuple struct
     }
 }
diff --git a/src/test/compile-fail/match-pattern-field-mismatch-2.rs b/src/test/compile-fail/match-pattern-field-mismatch-2.rs
index e63ddf6c7fd..a4ba93ea173 100644
--- a/src/test/compile-fail/match-pattern-field-mismatch-2.rs
+++ b/src/test/compile-fail/match-pattern-field-mismatch-2.rs
@@ -20,7 +20,7 @@ fn main() {
           color::rgb(_, _, _) => { }
           color::cmyk(_, _, _, _) => { }
           color::no_color(_) => { }
-          //~^ ERROR this pattern has 1 field, but the corresponding variant has no fields
+          //~^ ERROR `color::no_color` does not name a tuple variant or a tuple struct
         }
     }
 }
diff --git a/src/test/compile-fail/pat-tuple-bad-type.rs b/src/test/compile-fail/pat-tuple-bad-type.rs
new file mode 100644
index 00000000000..0d50a30dd05
--- /dev/null
+++ b/src/test/compile-fail/pat-tuple-bad-type.rs
@@ -0,0 +1,27 @@
+// Copyright 2016 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.
+
+#![feature(dotdot_in_tuple_patterns)]
+
+fn main() {
+    let x;
+
+    match x {
+        (..) => {} //~ ERROR the type of this value must be known in this context
+        _ => {}
+    }
+
+    match 0u8 {
+        (..) => {} //~ ERROR mismatched types
+        _ => {}
+    }
+
+    x = 10;
+}
diff --git a/src/test/compile-fail/E0024.rs b/src/test/compile-fail/pat-tuple-feature-gate.rs
index 18f4dcf19d7..55ca05bdef3 100644
--- a/src/test/compile-fail/E0024.rs
+++ b/src/test/compile-fail/pat-tuple-feature-gate.rs
@@ -8,15 +8,10 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-enum Number {
-    Zero,
-    One(u32)
-}
-
 fn main() {
-    let x = Number::Zero;
-    match x {
-        Number::Zero(inside) => {}, //~ ERROR E0024
-        Number::One(inside) => {},
+    match 0 {
+        (..) => {} //~ ERROR `..` in tuple patterns is experimental
+        (pat, ..) => {} //~ ERROR `..` in tuple patterns is experimental
+        S(pat, ..) => {} //~ ERROR `..` in tuple struct patterns is experimental
     }
 }
diff --git a/src/test/compile-fail/pat-tuple-overfield.rs b/src/test/compile-fail/pat-tuple-overfield.rs
new file mode 100644
index 00000000000..034ef4a72e2
--- /dev/null
+++ b/src/test/compile-fail/pat-tuple-overfield.rs
@@ -0,0 +1,28 @@
+// Copyright 2016 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.
+
+#![feature(dotdot_in_tuple_patterns)]
+
+struct S(u8, u8, u8);
+
+fn main() {
+    match (1, 2, 3) {
+        (1, 2, 3, 4) => {} //~ ERROR mismatched types
+        (1, 2, .., 3, 4) => {} //~ ERROR mismatched types
+        _ => {}
+    }
+    match S(1, 2, 3) {
+        S(1, 2, 3, 4) => {}
+        //~^ ERROR this pattern has 4 fields, but the corresponding struct has 3 fields
+        S(1, 2, .., 3, 4) => {}
+        //~^ ERROR this pattern has 4 fields, but the corresponding struct has 3 fields
+        _ => {}
+    }
+}
diff --git a/src/test/compile-fail/pattern-error-continue.rs b/src/test/compile-fail/pattern-error-continue.rs
index d9f3bb3c40f..507012e8c5c 100644
--- a/src/test/compile-fail/pattern-error-continue.rs
+++ b/src/test/compile-fail/pattern-error-continue.rs
@@ -25,7 +25,7 @@ fn f(_c: char) {}
 fn main() {
     match A::B(1, 2) {
         A::B(_, _, _) => (), //~ ERROR this pattern has 3 fields, but
-        A::D(_) => (),       //~ ERROR this pattern has 1 field, but
+        A::D(_) => (),       //~ ERROR `A::D` does not name a tuple variant or a tuple struct
         _ => ()
     }
     match 'c' {