From 62e387102ab4f46e4b72ae9261bb4b65fc32f506 Mon Sep 17 00:00:00 2001 From: ggomez Date: Fri, 20 May 2016 15:18:30 +0200 Subject: [PATCH] Add new error code tests --- src/test/compile-fail/E0062.rs | 20 ++++++++++++++++++++ src/test/compile-fail/E0063.rs | 18 ++++++++++++++++++ src/test/compile-fail/E0067.rs | 16 ++++++++++++++++ src/test/compile-fail/E0069.rs | 16 ++++++++++++++++ src/test/compile-fail/E0070.rs | 23 +++++++++++++++++++++++ src/test/compile-fail/E0071.rs | 16 ++++++++++++++++ src/test/compile-fail/E0072.rs | 17 +++++++++++++++++ src/test/compile-fail/E0075.rs | 17 +++++++++++++++++ src/test/compile-fail/E0076.rs | 17 +++++++++++++++++ src/test/compile-fail/E0077.rs | 17 +++++++++++++++++ src/test/compile-fail/E0079.rs | 16 ++++++++++++++++ src/test/compile-fail/E0080.rs | 17 +++++++++++++++++ src/test/compile-fail/E0081.rs | 18 ++++++++++++++++++ 13 files changed, 228 insertions(+) create mode 100644 src/test/compile-fail/E0062.rs create mode 100644 src/test/compile-fail/E0063.rs create mode 100644 src/test/compile-fail/E0067.rs create mode 100644 src/test/compile-fail/E0069.rs create mode 100644 src/test/compile-fail/E0070.rs create mode 100644 src/test/compile-fail/E0071.rs create mode 100644 src/test/compile-fail/E0072.rs create mode 100644 src/test/compile-fail/E0075.rs create mode 100644 src/test/compile-fail/E0076.rs create mode 100644 src/test/compile-fail/E0077.rs create mode 100644 src/test/compile-fail/E0079.rs create mode 100644 src/test/compile-fail/E0080.rs create mode 100644 src/test/compile-fail/E0081.rs diff --git a/src/test/compile-fail/E0062.rs b/src/test/compile-fail/E0062.rs new file mode 100644 index 00000000000..86ec7db14b5 --- /dev/null +++ b/src/test/compile-fail/E0062.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 or the MIT license +// , 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 index 00000000000..c94f807d807 --- /dev/null +++ b/src/test/compile-fail/E0063.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 or the MIT license +// , 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 index 00000000000..a3fc30ee1c7 --- /dev/null +++ b/src/test/compile-fail/E0067.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 or the MIT license +// , 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 index 00000000000..d164d863487 --- /dev/null +++ b/src/test/compile-fail/E0069.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 or the MIT license +// , 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 index 00000000000..ba66bd03aef --- /dev/null +++ b/src/test/compile-fail/E0070.rs @@ -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 or the MIT license +// , 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 index 00000000000..658c8fb1551 --- /dev/null +++ b/src/test/compile-fail/E0071.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 or the MIT license +// , 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 index 00000000000..2f96ba1046d --- /dev/null +++ b/src/test/compile-fail/E0072.rs @@ -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 or the MIT license +// , 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, +} + +fn main() { +} diff --git a/src/test/compile-fail/E0075.rs b/src/test/compile-fail/E0075.rs new file mode 100644 index 00000000000..d7783904e2e --- /dev/null +++ b/src/test/compile-fail/E0075.rs @@ -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 or the MIT license +// , 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 index 00000000000..b0f02a03e00 --- /dev/null +++ b/src/test/compile-fail/E0076.rs @@ -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 or the MIT license +// , 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 index 00000000000..b074e90b2c0 --- /dev/null +++ b/src/test/compile-fail/E0077.rs @@ -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 or the MIT license +// , 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 index 00000000000..23957c72ff0 --- /dev/null +++ b/src/test/compile-fail/E0079.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 or the MIT license +// , 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 index 00000000000..0329209d44b --- /dev/null +++ b/src/test/compile-fail/E0080.rs @@ -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 or the MIT license +// , 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 index 00000000000..b63265564b3 --- /dev/null +++ b/src/test/compile-fail/E0081.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 or the MIT license +// , 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() { +}