about summary refs log tree commit diff
path: root/src/test/ui
diff options
context:
space:
mode:
Diffstat (limited to 'src/test/ui')
-rw-r--r--src/test/ui/lint/lint-group-nonstandard-style.stderr6
-rw-r--r--src/test/ui/lint/lint-non-camel-case-types.rs22
-rw-r--r--src/test/ui/lint/lint-non-camel-case-types.stderr90
-rw-r--r--src/test/ui/lint/lint-non-camel-case-variant.rs10
-rw-r--r--src/test/ui/lint/lint-non-camel-case-with-trailing-underscores.rs11
-rw-r--r--src/test/ui/lint/lint-nonstandard-style-unicode.rs16
-rw-r--r--src/test/ui/utf8_idents.rs2
-rw-r--r--src/test/ui/utf8_idents.stderr4
8 files changed, 95 insertions, 66 deletions
diff --git a/src/test/ui/lint/lint-group-nonstandard-style.stderr b/src/test/ui/lint/lint-group-nonstandard-style.stderr
index 176f246ad76..f3c7d70054b 100644
--- a/src/test/ui/lint/lint-group-nonstandard-style.stderr
+++ b/src/test/ui/lint/lint-group-nonstandard-style.stderr
@@ -1,8 +1,8 @@
-warning: type `snake_case` should have a camel case name such as `SnakeCase`
-  --> $DIR/lint-group-nonstandard-style.rs:22:9
+warning: type `snake_case` should have a camel case name
+  --> $DIR/lint-group-nonstandard-style.rs:22:16
    |
 LL |         struct snake_case; //~ WARN should have a camel
-   |         ^^^^^^^^^^^^^^^^^^
+   |                ^^^^^^^^^^ help: convert the identifier to camel case: `SnakeCase`
    |
 note: lint level defined here
   --> $DIR/lint-group-nonstandard-style.rs:18:17
diff --git a/src/test/ui/lint/lint-non-camel-case-types.rs b/src/test/ui/lint/lint-non-camel-case-types.rs
index 436763b8316..bca1992605b 100644
--- a/src/test/ui/lint/lint-non-camel-case-types.rs
+++ b/src/test/ui/lint/lint-non-camel-case-types.rs
@@ -2,31 +2,31 @@
 #![allow(dead_code)]
 
 struct ONE_TWO_THREE;
-//~^ ERROR type `ONE_TWO_THREE` should have a camel case name such as `OneTwoThree`
+//~^ ERROR type `ONE_TWO_THREE` should have a camel case name
 
-struct foo { //~ ERROR type `foo` should have a camel case name such as `Foo`
+struct foo { //~ ERROR type `foo` should have a camel case name
     bar: isize,
 }
 
-enum foo2 { //~ ERROR type `foo2` should have a camel case name such as `Foo2`
+enum foo2 { //~ ERROR type `foo2` should have a camel case name
     Bar
 }
 
-struct foo3 { //~ ERROR type `foo3` should have a camel case name such as `Foo3`
+struct foo3 { //~ ERROR type `foo3` should have a camel case name
     bar: isize
 }
 
-type foo4 = isize; //~ ERROR type `foo4` should have a camel case name such as `Foo4`
+type foo4 = isize; //~ ERROR type `foo4` should have a camel case name
 
 enum Foo5 {
-    bar //~ ERROR variant `bar` should have a camel case name such as `Bar`
+    bar //~ ERROR variant `bar` should have a camel case name
 }
 
-trait foo6 { //~ ERROR trait `foo6` should have a camel case name such as `Foo6`
+trait foo6 { //~ ERROR trait `foo6` should have a camel case name
     fn dummy(&self) { }
 }
 
-fn f<ty>(_: ty) {} //~ ERROR type parameter `ty` should have a camel case name such as `Ty`
+fn f<ty>(_: ty) {} //~ ERROR type parameter `ty` should have a camel case name
 
 #[repr(C)]
 struct foo7 {
@@ -35,10 +35,10 @@ struct foo7 {
 
 struct X86_64;
 
-struct X86__64; //~ ERROR type `X86__64` should have a camel case name such as `X86_64`
+struct X86__64; //~ ERROR type `X86__64` should have a camel case name
 
-struct Abc_123; //~ ERROR type `Abc_123` should have a camel case name such as `Abc123`
+struct Abc_123; //~ ERROR type `Abc_123` should have a camel case name
 
-struct A1_b2_c3; //~ ERROR type `A1_b2_c3` should have a camel case name such as `A1B2C3`
+struct A1_b2_c3; //~ ERROR type `A1_b2_c3` should have a camel case name
 
 fn main() { }
diff --git a/src/test/ui/lint/lint-non-camel-case-types.stderr b/src/test/ui/lint/lint-non-camel-case-types.stderr
index 31a85559771..74f9a5993b8 100644
--- a/src/test/ui/lint/lint-non-camel-case-types.stderr
+++ b/src/test/ui/lint/lint-non-camel-case-types.stderr
@@ -1,8 +1,8 @@
-error: type `ONE_TWO_THREE` should have a camel case name such as `OneTwoThree`
-  --> $DIR/lint-non-camel-case-types.rs:4:1
+error: type `ONE_TWO_THREE` should have a camel case name
+  --> $DIR/lint-non-camel-case-types.rs:4:8
    |
 LL | struct ONE_TWO_THREE;
-   | ^^^^^^^^^^^^^^^^^^^^^
+   |        ^^^^^^^^^^^^^ help: convert the identifier to camel case: `OneTwoThree`
    |
 note: lint level defined here
   --> $DIR/lint-non-camel-case-types.rs:1:11
@@ -10,73 +10,65 @@ note: lint level defined here
 LL | #![forbid(non_camel_case_types)]
    |           ^^^^^^^^^^^^^^^^^^^^
 
-error: type `foo` should have a camel case name such as `Foo`
-  --> $DIR/lint-non-camel-case-types.rs:7:1
+error: type `foo` should have a camel case name
+  --> $DIR/lint-non-camel-case-types.rs:7:8
    |
-LL | / struct foo { //~ ERROR type `foo` should have a camel case name such as `Foo`
-LL | |     bar: isize,
-LL | | }
-   | |_^
+LL | struct foo { //~ ERROR type `foo` should have a camel case name
+   |        ^^^ help: convert the identifier to camel case: `Foo`
 
-error: type `foo2` should have a camel case name such as `Foo2`
-  --> $DIR/lint-non-camel-case-types.rs:11:1
+error: type `foo2` should have a camel case name
+  --> $DIR/lint-non-camel-case-types.rs:11:6
    |
-LL | / enum foo2 { //~ ERROR type `foo2` should have a camel case name such as `Foo2`
-LL | |     Bar
-LL | | }
-   | |_^
+LL | enum foo2 { //~ ERROR type `foo2` should have a camel case name
+   |      ^^^^ help: convert the identifier to camel case: `Foo2`
 
-error: type `foo3` should have a camel case name such as `Foo3`
-  --> $DIR/lint-non-camel-case-types.rs:15:1
+error: type `foo3` should have a camel case name
+  --> $DIR/lint-non-camel-case-types.rs:15:8
    |
-LL | / struct foo3 { //~ ERROR type `foo3` should have a camel case name such as `Foo3`
-LL | |     bar: isize
-LL | | }
-   | |_^
+LL | struct foo3 { //~ ERROR type `foo3` should have a camel case name
+   |        ^^^^ help: convert the identifier to camel case: `Foo3`
 
-error: type `foo4` should have a camel case name such as `Foo4`
-  --> $DIR/lint-non-camel-case-types.rs:19:1
+error: type `foo4` should have a camel case name
+  --> $DIR/lint-non-camel-case-types.rs:19:6
    |
-LL | type foo4 = isize; //~ ERROR type `foo4` should have a camel case name such as `Foo4`
-   | ^^^^^^^^^^^^^^^^^^
+LL | type foo4 = isize; //~ ERROR type `foo4` should have a camel case name
+   |      ^^^^ help: convert the identifier to camel case: `Foo4`
 
-error: variant `bar` should have a camel case name such as `Bar`
+error: variant `bar` should have a camel case name
   --> $DIR/lint-non-camel-case-types.rs:22:5
    |
-LL |     bar //~ ERROR variant `bar` should have a camel case name such as `Bar`
-   |     ^^^
+LL |     bar //~ ERROR variant `bar` should have a camel case name
+   |     ^^^ help: convert the identifier to camel case: `Bar`
 
-error: trait `foo6` should have a camel case name such as `Foo6`
-  --> $DIR/lint-non-camel-case-types.rs:25:1
+error: trait `foo6` should have a camel case name
+  --> $DIR/lint-non-camel-case-types.rs:25:7
    |
-LL | / trait foo6 { //~ ERROR trait `foo6` should have a camel case name such as `Foo6`
-LL | |     fn dummy(&self) { }
-LL | | }
-   | |_^
+LL | trait foo6 { //~ ERROR trait `foo6` should have a camel case name
+   |       ^^^^ help: convert the identifier to camel case: `Foo6`
 
-error: type parameter `ty` should have a camel case name such as `Ty`
+error: type parameter `ty` should have a camel case name
   --> $DIR/lint-non-camel-case-types.rs:29:6
    |
-LL | fn f<ty>(_: ty) {} //~ ERROR type parameter `ty` should have a camel case name such as `Ty`
-   |      ^^
+LL | fn f<ty>(_: ty) {} //~ ERROR type parameter `ty` should have a camel case name
+   |      ^^ help: convert the identifier to camel case: `Ty`
 
-error: type `X86__64` should have a camel case name such as `X86_64`
-  --> $DIR/lint-non-camel-case-types.rs:38:1
+error: type `X86__64` should have a camel case name
+  --> $DIR/lint-non-camel-case-types.rs:38:8
    |
-LL | struct X86__64; //~ ERROR type `X86__64` should have a camel case name such as `X86_64`
-   | ^^^^^^^^^^^^^^^
+LL | struct X86__64; //~ ERROR type `X86__64` should have a camel case name
+   |        ^^^^^^^ help: convert the identifier to camel case: `X86_64`
 
-error: type `Abc_123` should have a camel case name such as `Abc123`
-  --> $DIR/lint-non-camel-case-types.rs:40:1
+error: type `Abc_123` should have a camel case name
+  --> $DIR/lint-non-camel-case-types.rs:40:8
    |
-LL | struct Abc_123; //~ ERROR type `Abc_123` should have a camel case name such as `Abc123`
-   | ^^^^^^^^^^^^^^^
+LL | struct Abc_123; //~ ERROR type `Abc_123` should have a camel case name
+   |        ^^^^^^^ help: convert the identifier to camel case: `Abc123`
 
-error: type `A1_b2_c3` should have a camel case name such as `A1B2C3`
-  --> $DIR/lint-non-camel-case-types.rs:42:1
+error: type `A1_b2_c3` should have a camel case name
+  --> $DIR/lint-non-camel-case-types.rs:42:8
    |
-LL | struct A1_b2_c3; //~ ERROR type `A1_b2_c3` should have a camel case name such as `A1B2C3`
-   | ^^^^^^^^^^^^^^^^
+LL | struct A1_b2_c3; //~ ERROR type `A1_b2_c3` should have a camel case name
+   |        ^^^^^^^^ help: convert the identifier to camel case: `A1B2C3`
 
 error: aborting due to 11 previous errors
 
diff --git a/src/test/ui/lint/lint-non-camel-case-variant.rs b/src/test/ui/lint/lint-non-camel-case-variant.rs
new file mode 100644
index 00000000000..1f06b283984
--- /dev/null
+++ b/src/test/ui/lint/lint-non-camel-case-variant.rs
@@ -0,0 +1,10 @@
+// compile-pass
+
+#![deny(non_camel_case_types)]
+
+pub enum Foo {
+    #[allow(non_camel_case_types)]
+    bar
+}
+
+fn main() {}
diff --git a/src/test/ui/lint/lint-non-camel-case-with-trailing-underscores.rs b/src/test/ui/lint/lint-non-camel-case-with-trailing-underscores.rs
new file mode 100644
index 00000000000..c2fdfb4fe42
--- /dev/null
+++ b/src/test/ui/lint/lint-non-camel-case-with-trailing-underscores.rs
@@ -0,0 +1,11 @@
+// compile-pass
+
+#![allow(dead_code)]
+// This is ok because we often use the trailing underscore to mean 'prime'
+
+// pretty-expanded FIXME #23616
+
+#[forbid(non_camel_case_types)]
+type Foo_ = isize;
+
+pub fn main() { }
diff --git a/src/test/ui/lint/lint-nonstandard-style-unicode.rs b/src/test/ui/lint/lint-nonstandard-style-unicode.rs
new file mode 100644
index 00000000000..a0b4130c3e9
--- /dev/null
+++ b/src/test/ui/lint/lint-nonstandard-style-unicode.rs
@@ -0,0 +1,16 @@
+// compile-pass
+
+#![allow(dead_code)]
+
+#![forbid(non_camel_case_types)]
+#![forbid(non_upper_case_globals)]
+#![feature(non_ascii_idents)]
+
+// Some scripts (e.g., hiragana) don't have a concept of
+// upper/lowercase
+
+struct ヒ;
+
+static ラ: usize = 0;
+
+pub fn main() {}
diff --git a/src/test/ui/utf8_idents.rs b/src/test/ui/utf8_idents.rs
index bed0d9bb2be..e601c6e4555 100644
--- a/src/test/ui/utf8_idents.rs
+++ b/src/test/ui/utf8_idents.rs
@@ -3,7 +3,7 @@
 fn foo<
     'β, //~ ERROR non-ascii idents are not fully supported
     γ  //~ ERROR non-ascii idents are not fully supported
-       //~^ WARN type parameter `γ` should have a camel case name such as `Γ`
+       //~^ WARN type parameter `γ` should have a camel case name
 >() {}
 
 struct X {
diff --git a/src/test/ui/utf8_idents.stderr b/src/test/ui/utf8_idents.stderr
index 1ccf767491c..268dd99d060 100644
--- a/src/test/ui/utf8_idents.stderr
+++ b/src/test/ui/utf8_idents.stderr
@@ -30,11 +30,11 @@ LL |     let α = 0.00001f64; //~ ERROR non-ascii idents are not fully supported
    |
    = help: add #![feature(non_ascii_idents)] to the crate attributes to enable
 
-warning: type parameter `γ` should have a camel case name such as `Γ`
+warning: type parameter `γ` should have a camel case name
   --> $DIR/utf8_idents.rs:5:5
    |
 LL |     γ  //~ ERROR non-ascii idents are not fully supported
-   |     ^
+   |     ^ help: convert the identifier to camel case: `Γ`
    |
    = note: #[warn(non_camel_case_types)] on by default