]> git.lizzy.rs Git - rust.git/commitdiff
Add new error code tests
authorggomez <guillaume1.gomez@gmail.com>
Fri, 20 May 2016 13:18:30 +0000 (15:18 +0200)
committerGuillaume Gomez <guillaume1.gomez@gmail.com>
Sun, 22 May 2016 17:26:21 +0000 (19:26 +0200)
13 files changed:
src/test/compile-fail/E0062.rs [new file with mode: 0644]
src/test/compile-fail/E0063.rs [new file with mode: 0644]
src/test/compile-fail/E0067.rs [new file with mode: 0644]
src/test/compile-fail/E0069.rs [new file with mode: 0644]
src/test/compile-fail/E0070.rs [new file with mode: 0644]
src/test/compile-fail/E0071.rs [new file with mode: 0644]
src/test/compile-fail/E0072.rs [new file with mode: 0644]
src/test/compile-fail/E0075.rs [new file with mode: 0644]
src/test/compile-fail/E0076.rs [new file with mode: 0644]
src/test/compile-fail/E0077.rs [new file with mode: 0644]
src/test/compile-fail/E0079.rs [new file with mode: 0644]
src/test/compile-fail/E0080.rs [new file with mode: 0644]
src/test/compile-fail/E0081.rs [new file with mode: 0644]

diff --git a/src/test/compile-fail/E0062.rs b/src/test/compile-fail/E0062.rs
new file mode 100644 (file)
index 0000000..86ec7db
--- /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.
+
+struct Foo {
+    x: i32
+}
+
+fn main() {
+    let x = Foo {
+        x: 0,
+        x: 0, //~ ERROR E0062
+    };
+}
diff --git a/src/test/compile-fail/E0063.rs b/src/test/compile-fail/E0063.rs
new file mode 100644 (file)
index 0000000..c94f807
--- /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.
+
+struct Foo {
+    x: i32,
+    y: i32
+}
+
+fn main() {
+    let x = Foo { x: 0 }; //~ ERROR E0063
+}
diff --git a/src/test/compile-fail/E0067.rs b/src/test/compile-fail/E0067.rs
new file mode 100644 (file)
index 0000000..a3fc30e
--- /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.
+
+use std::collections::LinkedList;
+
+fn main() {
+    LinkedList::new() += 1; //~ ERROR E0368
+                            //~^ ERROR E0067
+}
diff --git a/src/test/compile-fail/E0069.rs b/src/test/compile-fail/E0069.rs
new file mode 100644 (file)
index 0000000..d164d86
--- /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.
+
+fn foo() -> u8 {
+    return; //~ ERROR E0069
+}
+
+fn main() {
+}
diff --git a/src/test/compile-fail/E0070.rs b/src/test/compile-fail/E0070.rs
new file mode 100644 (file)
index 0000000..ba66bd0
--- /dev/null
@@ -0,0 +1,23 @@
+// 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.
+
+const SOME_CONST : i32 = 12;
+
+fn some_other_func() {}
+
+fn some_function() {
+    SOME_CONST = 14; //~ ERROR E0070
+    1 = 3; //~ ERROR E0070
+    some_other_func() = 4; //~ ERROR E0070
+                           //~^ ERROR E0308
+}
+
+fn main() {
+}
diff --git a/src/test/compile-fail/E0071.rs b/src/test/compile-fail/E0071.rs
new file mode 100644 (file)
index 0000000..658c8fb
--- /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.
+
+enum Foo { FirstValue(i32) }
+
+fn main() {
+    let u = Foo::FirstValue { value: 0 }; //~ ERROR E0071
+    let t = u32 { value: 4 }; //~ ERROR E0071
+}
diff --git a/src/test/compile-fail/E0072.rs b/src/test/compile-fail/E0072.rs
new file mode 100644 (file)
index 0000000..2f96ba1
--- /dev/null
@@ -0,0 +1,17 @@
+// 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 ListNode { //~ ERROR E0072
+    head: u8,
+    tail: Option<ListNode>,
+}
+
+fn main() {
+}
diff --git a/src/test/compile-fail/E0075.rs b/src/test/compile-fail/E0075.rs
new file mode 100644 (file)
index 0000000..d778390
--- /dev/null
@@ -0,0 +1,17 @@
+// 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)]
+
+#[repr(simd)]
+struct Bad; //~ ERROR E0075
+
+fn main() {
+}
diff --git a/src/test/compile-fail/E0076.rs b/src/test/compile-fail/E0076.rs
new file mode 100644 (file)
index 0000000..b0f02a0
--- /dev/null
@@ -0,0 +1,17 @@
+// 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)]
+
+#[repr(simd)]
+struct Bad(u16, u32, u32); //~ ERROR E0076
+
+fn main() {
+}
diff --git a/src/test/compile-fail/E0077.rs b/src/test/compile-fail/E0077.rs
new file mode 100644 (file)
index 0000000..b074e90
--- /dev/null
@@ -0,0 +1,17 @@
+// 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)]
+
+#[repr(simd)]
+struct Bad(String); //~ ERROR E0077
+
+fn main() {
+}
diff --git a/src/test/compile-fail/E0079.rs b/src/test/compile-fail/E0079.rs
new file mode 100644 (file)
index 0000000..23957c7
--- /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.
+
+enum Foo {
+    Q = "32" //~ ERROR E0079
+}
+
+fn main() {
+}
diff --git a/src/test/compile-fail/E0080.rs b/src/test/compile-fail/E0080.rs
new file mode 100644 (file)
index 0000000..0329209
--- /dev/null
@@ -0,0 +1,17 @@
+// 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.
+
+enum Enum {
+    X = (1 << 500), //~ ERROR E0080
+    Y = (1 / 0) //~ ERROR E0080
+}
+
+fn main() {
+}
diff --git a/src/test/compile-fail/E0081.rs b/src/test/compile-fail/E0081.rs
new file mode 100644 (file)
index 0000000..b632655
--- /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.
+
+enum Enum {
+    P = 3,
+    X = 3, //~ ERROR E0081
+    Y = 5
+}
+
+fn main() {
+}