From afd4cccd621c11304822d4550dc39a62b57d1a64 Mon Sep 17 00:00:00 2001
From: ggomez <guillaume1.gomez@gmail.com>
Date: Tue, 17 May 2016 15:01:31 +0200
Subject: [PATCH] Add new error code tests

---
 src/test/compile-fail/E0027.rs | 22 ++++++++++++++++++++++
 src/test/compile-fail/E0029.rs | 18 ++++++++++++++++++
 src/test/compile-fail/E0030.rs | 16 ++++++++++++++++
 src/test/compile-fail/E0033.rs | 19 +++++++++++++++++++
 src/test/compile-fail/E0034.rs | 26 ++++++++++++++++++++++++++
 src/test/compile-fail/E0035.rs | 20 ++++++++++++++++++++
 6 files changed, 121 insertions(+)
 create mode 100644 src/test/compile-fail/E0027.rs
 create mode 100644 src/test/compile-fail/E0029.rs
 create mode 100644 src/test/compile-fail/E0030.rs
 create mode 100644 src/test/compile-fail/E0033.rs
 create mode 100644 src/test/compile-fail/E0034.rs
 create mode 100644 src/test/compile-fail/E0035.rs

diff --git a/src/test/compile-fail/E0027.rs b/src/test/compile-fail/E0027.rs
new file mode 100644
index 00000000000..b2f20442b77
--- /dev/null
+++ b/src/test/compile-fail/E0027.rs
@@ -0,0 +1,22 @@
+// 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.
+
+struct Dog {
+    name: String,
+    age: u32,
+}
+
+fn main() {
+    let d = Dog { name: "Rusty".to_string(), age: 8 };
+
+    match d {
+        Dog { age: x } => {} //~ ERROR E0027
+    }
+}
diff --git a/src/test/compile-fail/E0029.rs b/src/test/compile-fail/E0029.rs
new file mode 100644
index 00000000000..9cbdec99520
--- /dev/null
+++ b/src/test/compile-fail/E0029.rs
@@ -0,0 +1,18 @@
+// 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.
+
+fn main() {
+    let s = "hoho";
+
+    match s {
+        "hello" ... "world" => {} //~ ERROR E0029
+        _ => {}
+    }
+}
diff --git a/src/test/compile-fail/E0030.rs b/src/test/compile-fail/E0030.rs
new file mode 100644
index 00000000000..7f26f6cdb84
--- /dev/null
+++ b/src/test/compile-fail/E0030.rs
@@ -0,0 +1,16 @@
+// 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.
+
+
+fn main() {
+    match 5u32 {
+        1000 ... 5 => {} //~ ERROR E0030
+    }
+}
diff --git a/src/test/compile-fail/E0033.rs b/src/test/compile-fail/E0033.rs
new file mode 100644
index 00000000000..946600013f3
--- /dev/null
+++ b/src/test/compile-fail/E0033.rs
@@ -0,0 +1,19 @@
+// 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.
+
+trait SomeTrait {
+    fn foo();
+}
+
+fn main() {
+    let trait_obj: &SomeTrait = SomeTrait; //~ ERROR E0425
+                                           //~^ ERROR E0038
+    let &invalid = trait_obj; //~ ERROR E0033
+}
diff --git a/src/test/compile-fail/E0034.rs b/src/test/compile-fail/E0034.rs
new file mode 100644
index 00000000000..669bece0f7d
--- /dev/null
+++ b/src/test/compile-fail/E0034.rs
@@ -0,0 +1,26 @@
+// 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.
+
+struct Test;
+
+trait Trait1 {
+    fn foo();
+}
+
+trait Trait2 {
+    fn foo();
+}
+
+impl Trait1 for Test { fn foo() {} }
+impl Trait2 for Test { fn foo() {} }
+
+fn main() {
+    Test::foo() //~ ERROR E0034
+}
diff --git a/src/test/compile-fail/E0035.rs b/src/test/compile-fail/E0035.rs
new file mode 100644
index 00000000000..43f46e3578c
--- /dev/null
+++ b/src/test/compile-fail/E0035.rs
@@ -0,0 +1,20 @@
+// 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.
+
+struct Test;
+
+impl Test {
+    fn method(&self) {}
+}
+
+fn main() {
+    let x = Test;
+    x.method::<i32>(); //~ ERROR E0035
+}