]> git.lizzy.rs Git - rust.git/blob - src/test/ui/lint/lint-non-camel-case-types.rs
Move parse-fail tests to UI
[rust.git] / src / test / ui / lint / lint-non-camel-case-types.rs
1 // Copyright 2012 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 #![forbid(non_camel_case_types)]
12 #![allow(dead_code)]
13
14 struct ONE_TWO_THREE;
15 //~^ ERROR type `ONE_TWO_THREE` should have a camel case name such as `OneTwoThree`
16
17 struct foo { //~ ERROR type `foo` should have a camel case name such as `Foo`
18     bar: isize,
19 }
20
21 enum foo2 { //~ ERROR type `foo2` should have a camel case name such as `Foo2`
22     Bar
23 }
24
25 struct foo3 { //~ ERROR type `foo3` should have a camel case name such as `Foo3`
26     bar: isize
27 }
28
29 type foo4 = isize; //~ ERROR type `foo4` should have a camel case name such as `Foo4`
30
31 enum Foo5 {
32     bar //~ ERROR variant `bar` should have a camel case name such as `Bar`
33 }
34
35 trait foo6 { //~ ERROR trait `foo6` should have a camel case name such as `Foo6`
36     fn dummy(&self) { }
37 }
38
39 fn f<ty>(_: ty) {} //~ ERROR type parameter `ty` should have a camel case name such as `Ty`
40
41 #[repr(C)]
42 struct foo7 {
43     bar: isize,
44 }
45
46 struct X86_64;
47
48 struct X86__64; //~ ERROR type `X86__64` should have a camel case name such as `X86_64`
49
50 struct Abc_123; //~ ERROR type `Abc_123` should have a camel case name such as `Abc123`
51
52 struct A1_b2_c3; //~ ERROR type `A1_b2_c3` should have a camel case name such as `A1B2C3`
53
54 fn main() { }