about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
authorEduard-Mihai Burtescu <edy.burt@gmail.com>2016-08-18 06:12:23 +0300
committerGitHub <noreply@github.com>2016-08-18 06:12:23 +0300
commitd36b296cb6d0b6d242ddfe835cdd4f883de9735c (patch)
tree7b4d93a47a12bb29fa00e4bf8f39e14e46420a30 /src
parent8ccc11b31bbb1de3813d2baa92aed2fcaf090586 (diff)
parent8d78237701f9646cd0ddc4645512e7cde3c58e5e (diff)
downloadrust-d36b296cb6d0b6d242ddfe835cdd4f883de9735c.tar.gz
rust-d36b296cb6d0b6d242ddfe835cdd4f883de9735c.zip
Rollup merge of #35768 - GuillaumeGomez:err_codes, r=jonathandturner
Add new error code tests

r? @jonathandturner
Diffstat (limited to 'src')
-rw-r--r--src/librustc_resolve/diagnostics.rs2
-rw-r--r--src/test/compile-fail/E0423.rs15
-rw-r--r--src/test/compile-fail/E0424.rs22
-rw-r--r--src/test/compile-fail/E0425.rs18
-rw-r--r--src/test/compile-fail/E0426.rs15
-rw-r--r--src/test/compile-fail/E0428.rs16
-rw-r--r--src/test/compile-fail/E0429.rs15
-rw-r--r--src/test/compile-fail/E0430.rs15
-rw-r--r--src/test/compile-fail/E0431.rs14
-rw-r--r--src/test/compile-fail/E0432.rs14
-rw-r--r--src/test/compile-fail/E0433.rs13
-rw-r--r--src/test/compile-fail/E0434.rs19
-rw-r--r--src/test/compile-fail/E0435.rs14
-rw-r--r--src/test/compile-fail/E0437.rs18
-rw-r--r--src/test/compile-fail/E0438.rs20
-rw-r--r--src/test/compile-fail/E0439.rs18
-rw-r--r--src/test/compile-fail/E0440.rs22
17 files changed, 269 insertions, 1 deletions
diff --git a/src/librustc_resolve/diagnostics.rs b/src/librustc_resolve/diagnostics.rs
index 11ef75ee6a8..5183d68065c 100644
--- a/src/librustc_resolve/diagnostics.rs
+++ b/src/librustc_resolve/diagnostics.rs
@@ -891,7 +891,7 @@ A `struct` variant name was used like a function name.
 Erroneous code example:
 
 ```compile_fail,E0423
-struct Foo { a: bool};
+struct Foo { a: bool };
 
 let f = Foo();
 // error: `Foo` is a struct variant name, but this expression uses
diff --git a/src/test/compile-fail/E0423.rs b/src/test/compile-fail/E0423.rs
new file mode 100644
index 00000000000..f5fea77cf96
--- /dev/null
+++ b/src/test/compile-fail/E0423.rs
@@ -0,0 +1,15 @@
+// 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 () {
+    struct Foo { a: bool };
+
+    let f = Foo(); //~ ERROR E0423
+}
diff --git a/src/test/compile-fail/E0424.rs b/src/test/compile-fail/E0424.rs
new file mode 100644
index 00000000000..445d0c5f3ed
--- /dev/null
+++ b/src/test/compile-fail/E0424.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 Foo;
+
+impl Foo {
+    fn bar(self) {}
+
+    fn foo() {
+        self.bar(); //~ ERROR E0424
+    }
+}
+
+fn main () {
+}
diff --git a/src/test/compile-fail/E0425.rs b/src/test/compile-fail/E0425.rs
new file mode 100644
index 00000000000..70f4b1107ad
--- /dev/null
+++ b/src/test/compile-fail/E0425.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.
+
+trait Foo {
+    fn bar() {
+        Self; //~ ERROR E0425
+    }
+}
+
+fn main () {
+}
diff --git a/src/test/compile-fail/E0426.rs b/src/test/compile-fail/E0426.rs
new file mode 100644
index 00000000000..2eb4c2d3b5e
--- /dev/null
+++ b/src/test/compile-fail/E0426.rs
@@ -0,0 +1,15 @@
+// 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 () {
+    loop {
+        break 'a; //~ ERROR E0426
+    }
+}
diff --git a/src/test/compile-fail/E0428.rs b/src/test/compile-fail/E0428.rs
new file mode 100644
index 00000000000..42e237d31cb
--- /dev/null
+++ b/src/test/compile-fail/E0428.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.
+
+struct Bar;
+struct Bar; //~ ERROR E0428
+            //~^ ERROR E0428
+
+fn main () {
+}
diff --git a/src/test/compile-fail/E0429.rs b/src/test/compile-fail/E0429.rs
new file mode 100644
index 00000000000..a7d19744f3f
--- /dev/null
+++ b/src/test/compile-fail/E0429.rs
@@ -0,0 +1,15 @@
+// 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.
+
+use std::fmt::self; //~ ERROR E0429
+                    //~^ ERROR E0432
+
+fn main () {
+}
diff --git a/src/test/compile-fail/E0430.rs b/src/test/compile-fail/E0430.rs
new file mode 100644
index 00000000000..992876dd294
--- /dev/null
+++ b/src/test/compile-fail/E0430.rs
@@ -0,0 +1,15 @@
+// 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.
+
+use std::fmt::{self, self}; //~ ERROR E0430
+                            //~^ ERROR E0252
+
+fn main () {
+}
diff --git a/src/test/compile-fail/E0431.rs b/src/test/compile-fail/E0431.rs
new file mode 100644
index 00000000000..09ddc1efaf4
--- /dev/null
+++ b/src/test/compile-fail/E0431.rs
@@ -0,0 +1,14 @@
+// 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.
+
+use {self}; //~ ERROR E0431
+
+fn main () {
+}
diff --git a/src/test/compile-fail/E0432.rs b/src/test/compile-fail/E0432.rs
new file mode 100644
index 00000000000..08d699ee4ca
--- /dev/null
+++ b/src/test/compile-fail/E0432.rs
@@ -0,0 +1,14 @@
+// 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.
+
+use something::Foo; //~ ERROR E0432
+
+fn main () {
+}
diff --git a/src/test/compile-fail/E0433.rs b/src/test/compile-fail/E0433.rs
new file mode 100644
index 00000000000..916d6220eb9
--- /dev/null
+++ b/src/test/compile-fail/E0433.rs
@@ -0,0 +1,13 @@
+// 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 map = HashMap::new(); //~ ERROR E0433
+}
diff --git a/src/test/compile-fail/E0434.rs b/src/test/compile-fail/E0434.rs
new file mode 100644
index 00000000000..747d9f72c42
--- /dev/null
+++ b/src/test/compile-fail/E0434.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.
+
+fn foo() {
+    let y = 5;
+    fn bar() -> u32 {
+        y //~ ERROR E0434
+    }
+}
+
+fn main () {
+}
diff --git a/src/test/compile-fail/E0435.rs b/src/test/compile-fail/E0435.rs
new file mode 100644
index 00000000000..f6cba15a0bf
--- /dev/null
+++ b/src/test/compile-fail/E0435.rs
@@ -0,0 +1,14 @@
+// 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 foo = 42u32;
+    const FOO : u32 = foo; //~ ERROR E0435
+}
diff --git a/src/test/compile-fail/E0437.rs b/src/test/compile-fail/E0437.rs
new file mode 100644
index 00000000000..7440a82773e
--- /dev/null
+++ b/src/test/compile-fail/E0437.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.
+
+trait Foo {}
+
+impl Foo for i32 {
+    type Bar = bool; //~ ERROR E0437
+}
+
+fn main () {
+}
diff --git a/src/test/compile-fail/E0438.rs b/src/test/compile-fail/E0438.rs
new file mode 100644
index 00000000000..b3d45307204
--- /dev/null
+++ b/src/test/compile-fail/E0438.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.
+
+#![feature(associated_consts)]
+
+trait Foo {}
+
+impl Foo for i32 {
+    const BAR: bool = true; //~ ERROR E0438
+}
+
+fn main () {
+}
diff --git a/src/test/compile-fail/E0439.rs b/src/test/compile-fail/E0439.rs
new file mode 100644
index 00000000000..52443432021
--- /dev/null
+++ b/src/test/compile-fail/E0439.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.
+
+#![feature(platform_intrinsics)]
+
+extern "platform-intrinsic" {
+    fn simd_shuffle<A,B>(a: A, b: A, c: [u32; 8]) -> B; //~ ERROR E0439
+}
+
+fn main () {
+}
diff --git a/src/test/compile-fail/E0440.rs b/src/test/compile-fail/E0440.rs
new file mode 100644
index 00000000000..04e7584008d
--- /dev/null
+++ b/src/test/compile-fail/E0440.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.
+
+#![feature(repr_simd)]
+#![feature(platform_intrinsics)]
+
+#[repr(simd)]
+struct f64x2(f64, f64);
+
+extern "platform-intrinsic" {
+    fn x86_mm_movemask_pd<T>(x: f64x2) -> i32; //~ ERROR E0440
+}
+
+fn main () {
+}