]> git.lizzy.rs Git - rust.git/blob - src/test/compile-fail/lint-non-camel-case-types.rs
Auto merge of #22541 - Manishearth:rollup, r=Gankro
[rust.git] / src / test / compile-fail / 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 foo { //~ ERROR type `foo` should have a camel case name such as `Foo`
15     bar: isize,
16 }
17
18 enum foo2 { //~ ERROR type `foo2` should have a camel case name such as `Foo2`
19     Bar
20 }
21
22 struct foo3 { //~ ERROR type `foo3` should have a camel case name such as `Foo3`
23     bar: isize
24 }
25
26 type foo4 = isize; //~ ERROR type `foo4` should have a camel case name such as `Foo4`
27
28 enum Foo5 {
29     bar //~ ERROR variant `bar` should have a camel case name such as `Bar`
30 }
31
32 trait foo6 { //~ ERROR trait `foo6` should have a camel case name such as `Foo6`
33     fn dummy(&self) { }
34 }
35
36 fn f<ty>(_: ty) {} //~ ERROR type parameter `ty` should have a camel case name such as `Ty`
37
38 #[repr(C)]
39 struct foo7 {
40     bar: isize,
41 }
42
43 type __ = isize; //~ ERROR type `__` should have a camel case name such as `CamelCase`
44
45 fn main() { }