]> git.lizzy.rs Git - rust.git/commitdiff
Add new error code tests
authorGuillaume Gomez <guillaume1.gomez@gmail.com>
Wed, 17 Aug 2016 21:45:10 +0000 (23:45 +0200)
committerGuillaume Gomez <guillaume1.gomez@gmail.com>
Wed, 17 Aug 2016 21:45:10 +0000 (23:45 +0200)
17 files changed:
src/librustc_resolve/diagnostics.rs
src/test/compile-fail/E0423.rs [new file with mode: 0644]
src/test/compile-fail/E0424.rs [new file with mode: 0644]
src/test/compile-fail/E0425.rs [new file with mode: 0644]
src/test/compile-fail/E0426.rs [new file with mode: 0644]
src/test/compile-fail/E0428.rs [new file with mode: 0644]
src/test/compile-fail/E0429.rs [new file with mode: 0644]
src/test/compile-fail/E0430.rs [new file with mode: 0644]
src/test/compile-fail/E0431.rs [new file with mode: 0644]
src/test/compile-fail/E0432.rs [new file with mode: 0644]
src/test/compile-fail/E0433.rs [new file with mode: 0644]
src/test/compile-fail/E0434.rs [new file with mode: 0644]
src/test/compile-fail/E0435.rs [new file with mode: 0644]
src/test/compile-fail/E0437.rs [new file with mode: 0644]
src/test/compile-fail/E0438.rs [new file with mode: 0644]
src/test/compile-fail/E0439.rs [new file with mode: 0644]
src/test/compile-fail/E0440.rs [new file with mode: 0644]

index 11ef75ee6a8fc4fcc90596feebccca7687c16fb0..5183d68065c7d1b1acb8ce0ba91e49bc6bda4726 100644 (file)
@@ -891,7 +891,7 @@ fn main () {
 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 (file)
index 0000000..f5fea77
--- /dev/null
@@ -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 (file)
index 0000000..445d0c5
--- /dev/null
@@ -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 (file)
index 0000000..70f4b11
--- /dev/null
@@ -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 (file)
index 0000000..2eb4c2d
--- /dev/null
@@ -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 (file)
index 0000000..42e237d
--- /dev/null
@@ -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 (file)
index 0000000..a7d1974
--- /dev/null
@@ -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 (file)
index 0000000..992876d
--- /dev/null
@@ -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 (file)
index 0000000..09ddc1e
--- /dev/null
@@ -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 (file)
index 0000000..08d699e
--- /dev/null
@@ -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 (file)
index 0000000..916d622
--- /dev/null
@@ -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 (file)
index 0000000..747d9f7
--- /dev/null
@@ -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 (file)
index 0000000..f6cba15
--- /dev/null
@@ -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 (file)
index 0000000..7440a82
--- /dev/null
@@ -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 (file)
index 0000000..b3d4530
--- /dev/null
@@ -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 (file)
index 0000000..5244343
--- /dev/null
@@ -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 (file)
index 0000000..04e7584
--- /dev/null
@@ -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 () {
+}