]> git.lizzy.rs Git - rust.git/blob - src/test/compile-fail/issue-21546.rs
Fix issue #21546 and refactor NsDef
[rust.git] / src / test / compile-fail / issue-21546.rs
1 // Copyright 2015 The Rust Project Developers. See the COPYRIGHT
2 // file at the top-level directory of this distribution and at
3 // http://rust-lang.org/COPYRIGHT.
4 //
5 // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6 // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7 // <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8 // option. This file may not be copied, modified, or distributed
9 // except according to those terms.
10
11 // Also works as a test for #14564
12
13 #[allow(non_snake_case)]
14 mod Foo { }
15 //~^ NOTE first definition of type or module `Foo`
16
17 #[allow(dead_code)]
18 struct Foo;
19 //~^ ERROR duplicate definition of type or module `Foo`
20
21
22 #[allow(non_snake_case)]
23 mod Bar { }
24 //~^ NOTE first definition of type or module `Bar`
25
26 #[allow(dead_code)]
27 struct Bar(i32);
28 //~^ ERROR duplicate definition of type or module `Bar`
29
30
31 #[allow(dead_code)]
32 struct Baz(i32);
33 //~^ NOTE first definition of type or module
34
35 #[allow(non_snake_case)]
36 mod Baz { }
37 //~^ ERROR duplicate definition of type or module `Baz`
38
39
40 #[allow(dead_code)]
41 struct Qux { x: bool }
42 //~^ NOTE first definition of type or module
43
44 #[allow(non_snake_case)]
45 mod Qux { }
46 //~^ ERROR duplicate definition of type or module `Qux`
47
48
49 #[allow(dead_code)]
50 struct Quux;
51 //~^ NOTE first definition of type or module
52
53 #[allow(non_snake_case)]
54 mod Quux { }
55 //~^ ERROR duplicate definition of type or module `Quux`
56
57
58 #[allow(dead_code)]
59 enum Corge { A, B }
60
61 #[allow(non_snake_case)]
62 mod Corge { }
63 //~^ ERROR duplicate definition of type or module `Corge`
64
65 fn main() { }