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 or the MIT license +// , 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 or the MIT license +// , 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 or the MIT license +// , 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 or the MIT license +// , 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 or the MIT license +// , 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 or the MIT license +// , 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::(); //~ ERROR E0035 +}