summaryrefslogtreecommitdiffstats
path: root/src/test/ui/lint/lint-nonstandard-style-unicode-1.rs
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-17 12:02:58 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-17 12:02:58 +0000
commit698f8c2f01ea549d77d7dc3338a12e04c11057b9 (patch)
tree173a775858bd501c378080a10dca74132f05bc50 /src/test/ui/lint/lint-nonstandard-style-unicode-1.rs
parentInitial commit. (diff)
downloadrustc-698f8c2f01ea549d77d7dc3338a12e04c11057b9.tar.xz
rustc-698f8c2f01ea549d77d7dc3338a12e04c11057b9.zip
Adding upstream version 1.64.0+dfsg1.upstream/1.64.0+dfsg1
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to '')
-rw-r--r--src/test/ui/lint/lint-nonstandard-style-unicode-1.rs49
1 files changed, 49 insertions, 0 deletions
diff --git a/src/test/ui/lint/lint-nonstandard-style-unicode-1.rs b/src/test/ui/lint/lint-nonstandard-style-unicode-1.rs
new file mode 100644
index 000000000..7c45c0993
--- /dev/null
+++ b/src/test/ui/lint/lint-nonstandard-style-unicode-1.rs
@@ -0,0 +1,49 @@
+#![allow(dead_code)]
+
+#![forbid(non_camel_case_types)]
+
+// Some scripts (e.g., hiragana) don't have a concept of
+// upper/lowercase
+
+// 1. non_camel_case_types
+
+// Can start with non-lowercase letter
+struct Θχ;
+struct ヒa;
+
+struct χa;
+//~^ ERROR type `χa` should have an upper camel case name
+
+// If there's already leading or trailing underscores, they get trimmed before checking.
+// This is fine:
+struct _ヒb;
+
+// This is not:
+struct __χa;
+//~^ ERROR type `__χa` should have an upper camel case name
+
+// Besides this, we cannot have two continuous underscores in the middle.
+
+struct 对__否;
+//~^ ERROR type `对__否` should have an upper camel case name
+
+struct ヒ__χ;
+//~^ ERROR type `ヒ__χ` should have an upper camel case name
+
+// also cannot have lowercase letter next to an underscore.
+// so this triggers the lint:
+
+struct Hello_你好;
+//~^ ERROR type `Hello_你好` should have an upper camel case name
+
+struct Hello_World;
+//~^ ERROR type `Hello_World` should have an upper camel case name
+
+struct 你_ӟ;
+//~^ ERROR type `你_ӟ` should have an upper camel case name
+
+// and this is ok:
+
+struct 你_好;
+
+fn main() {}