[gcc r14-7704] gccrs: Add tests for Unicode identifiers

Arthur Cohen cohenarthur@gcc.gnu.org
Tue Jan 16 17:55:16 GMT 2024


https://gcc.gnu.org/g:83e9ae73f47d6965206d6eee64a4550dea0a8a6b

commit r14-7704-g83e9ae73f47d6965206d6eee64a4550dea0a8a6b
Author: Raiki Tamura <tamaron1203@gmail.com>
Date:   Wed Jun 28 18:34:05 2023 +0900

    gccrs: Add tests for Unicode identifiers
    
    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>

Diff:
---
 gcc/testsuite/rust/compile/torture/raw_identifiers.rs  |  8 ++++++++
 gcc/testsuite/rust/compile/torture/utf8_identifiers.rs | 18 ++++++++++++++++++
 2 files changed, 26 insertions(+)

diff --git a/gcc/testsuite/rust/compile/torture/raw_identifiers.rs b/gcc/testsuite/rust/compile/torture/raw_identifiers.rs
index 7e6cd916244..a093f69cebb 100644
--- a/gcc/testsuite/rust/compile/torture/raw_identifiers.rs
+++ b/gcc/testsuite/rust/compile/torture/raw_identifiers.rs
@@ -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
index 00000000000..7fb86eb5ff0
--- /dev/null
+++ b/gcc/testsuite/rust/compile/torture/utf8_identifiers.rs
@@ -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
+}


More information about the Gcc-cvs mailing list