]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
gccrs: Add tests for Unicode identifiers
authorRaiki Tamura <tamaron1203@gmail.com>
Wed, 28 Jun 2023 09:34:05 +0000 (18:34 +0900)
committerArthur Cohen <arthur.cohen@embecosm.com>
Tue, 16 Jan 2024 17:46:31 +0000 (18:46 +0100)
gcc/testsuite/ChangeLog:

* rust/compile/torture/raw_identifiers.rs: New test.
* rust/compile/torture/utf8_identifiers.rs: New test.

Signed-off-by: Raiki Tamura <tamaron1203@gmail.com>
gcc/testsuite/rust/compile/torture/raw_identifiers.rs
gcc/testsuite/rust/compile/torture/utf8_identifiers.rs [new file with mode: 0644]

index 7e6cd916244462c640da4d16ab8e1404c17d2eda..a093f69cebbb616be1661613a311c98fcfe5437b 100644 (file)
@@ -1,3 +1,11 @@
 pub fn square(num: i32) -> i32 {
     r#num * num
 }
+
+pub fn kimchi() -> i32 {
+    // UTF-8 raw indentifiers
+    let r#김치 = 1;
+    let r#泡菜 = 1;
+    let r#кимчи = 1;
+    r#김치 + r#泡菜 + r#кимчи
+}
diff --git a/gcc/testsuite/rust/compile/torture/utf8_identifiers.rs b/gcc/testsuite/rust/compile/torture/utf8_identifiers.rs
new file mode 100644 (file)
index 0000000..7fb86eb
--- /dev/null
@@ -0,0 +1,18 @@
+pub fn f() {
+    let crab = ();
+
+    let Κάβουρας = 0.001;
+    // { dg-warning "unused name" "" { target *-*-* } .-1 }
+    let 게 = "";
+    // { dg-warning "unused name" "" { target *-*-* } .-1 }
+    let سلطعون = 0.;
+    // { dg-warning "unused name" "" { target *-*-* } .-1 }
+
+    let _: &'かに () = &crab;
+}
+
+pub fn g<'β, γ>() {}
+
+struct _S {
+    δ: i32
+}