about summary refs log tree commit diff
diff options
context:
space:
mode:
authorLuqman Aden <laden@csclub.uwaterloo.ca>2013-06-20 19:23:31 -0400
committerLuqman Aden <laden@csclub.uwaterloo.ca>2013-06-20 19:23:31 -0400
commit41e90f2156236d8b4a0ab74e3ed9aadaa7d11d58 (patch)
treebf501b313d86444b75ef7d8e55b3e6d3a3c58692
parent31b4b53797337a3750bcb63b19b78642816f76de (diff)
downloadrust-41e90f2156236d8b4a0ab74e3ed9aadaa7d11d58.tar.gz
rust-41e90f2156236d8b4a0ab74e3ed9aadaa7d11d58.zip
Add test for duplicate definitions of structs and enum struct variants.
-rw-r--r--src/test/compile-fail/dup-struct-enum-struct-variant.rs17
1 files changed, 17 insertions, 0 deletions
diff --git a/src/test/compile-fail/dup-struct-enum-struct-variant.rs b/src/test/compile-fail/dup-struct-enum-struct-variant.rs
new file mode 100644
index 00000000000..69e6b5c6856
--- /dev/null
+++ b/src/test/compile-fail/dup-struct-enum-struct-variant.rs
@@ -0,0 +1,17 @@
+// Copyright 2013 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 { C { a: int, b: int } }
+struct C { a: int, b: int }         //~ ERROR error: duplicate definition of type `C`
+
+struct A { x: int }
+enum Bar { A { x: int } }           //~ ERROR error: duplicate definition of type `A`
+
+fn main() {}