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