]> git.lizzy.rs Git - rust.git/blob - src/test/compile-fail/issue-21546.rs
Auto merge of #35856 - phimuemue:master, r=brson
[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 previous definition of `Foo` here
16
17 #[allow(dead_code)]
18 struct Foo;
19 //~^ ERROR a module named `Foo` has already been defined in this module
20 //~| NOTE already defined
21
22 #[allow(non_snake_case)]
23 mod Bar { }
24 //~^ NOTE previous definition of `Bar` here
25
26 #[allow(dead_code)]
27 struct Bar(i32);
28 //~^ ERROR a module named `Bar` has already been defined
29 //~| NOTE already defined
30
31
32 #[allow(dead_code)]
33 struct Baz(i32);
34 //~^ NOTE previous definition
35
36 #[allow(non_snake_case)]
37 mod Baz { }
38 //~^ ERROR a type named `Baz` has already been defined
39 //~| NOTE already defined
40
41
42 #[allow(dead_code)]
43 struct Qux { x: bool }
44 //~^ NOTE previous definition
45
46 #[allow(non_snake_case)]
47 mod Qux { }
48 //~^ ERROR a type named `Qux` has already been defined
49 //~| NOTE already defined
50
51
52 #[allow(dead_code)]
53 struct Quux;
54 //~^ NOTE previous definition
55
56 #[allow(non_snake_case)]
57 mod Quux { }
58 //~^ ERROR a type named `Quux` has already been defined
59 //~| NOTE already defined
60
61
62 #[allow(dead_code)]
63 enum Corge { A, B }
64 //~^ NOTE previous definition
65
66 #[allow(non_snake_case)]
67 mod Corge { }
68 //~^ ERROR a type named `Corge` has already been defined
69 //~| NOTE already defined
70
71 fn main() { }